1

So, I have configured and reconfigured the Pi Zero multiple times now for it to behave like a HID keyboard. It appears as a keyboard as well, but as soon as it is connected, it gets disconnected.

This is what dmesg says on the PC that Pi is connected to:

[ 1481.243001] usb 1-1: New USB device found, idVendor=1d6b, idProduct=0104, bcdDevice= 1.00
[ 1481.243011] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1481.243018] usb 1-1: Product: My virtual keyboard
[ 1481.243025] usb 1-1: Manufacturer: My manufacturer
[ 1481.243031] usb 1-1: SerialNumber: 0123456789
[ 1481.348588] usb 1-1: USB disconnect, device number 16
[ 1481.354283] usbcore: registered new interface driver usbhid
[ 1481.354285] usbhid: USB HID core driver
[ 1541.338789] usb 1-1: new high-speed USB device number 18 using xhci_hcd
[ 1541.482947] usb 1-1: New USB device found, idVendor=1d6b, idProduct=0104, bcdDevice= 1.00
[ 1541.482956] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1541.482962] usb 1-1: Product: My virtual keyboard
[ 1541.482969] usb 1-1: Manufacturer: My manufacturer
[ 1541.482974] usb 1-1: SerialNumber: 0123456789
[ 1541.486432] input: My manufacturer My virtual keyboard as /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/0003:1D6B:0104.0002/input/input26
[ 1541.542977] hid-generic 0003:1D6B:0104.0002: input,hidraw1: USB HID v1.01 Keyboard [My manufacturer My virtual keyboard] on usb-0000:00:14.0-1/input0
[ 1541.751085] usb 1-1: USB disconnect, device number 18
[ 1543.732239] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
[ 1543.855484] usb 1-1: new high-speed USB device number 20 using xhci_hcd
[ 1543.996164] usb 1-1: New USB device found, idVendor=1d6b, idProduct=0104, bcdDevice= 1.00
[ 1543.996174] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1543.996180] usb 1-1: Product: My virtual keyboard
[ 1543.996186] usb 1-1: Manufacturer: My manufacturer
[ 1543.996191] usb 1-1: SerialNumber: 0123456789
[ 1543.999703] input: My manufacturer My virtual keyboard as /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/0003:1D6B:0104.0003/input/input27
[ 1544.059539] hid-generic 0003:1D6B:0104.0003: input,hidraw1: USB HID v1.01 Keyboard [My manufacturer My virtual keyboard] on usb-0000:00:14.0-1/input0
[ 1544.082932] usb 1-1: USB disconnect, device number 20
[ 1545.655547] usb usb1-port1: Cannot enable. Maybe the USB cable is bad?
[ 1545.778800] usb 1-1: new high-speed USB device number 22 using xhci_hcd
[ 1545.902183] usb 1-1: device descriptor read/64, error -71
[ 1548.218941] usb 1-1: new high-speed USB device number 23 using xhci_hcd
[ 1551.122655] usb 1-1: new high-speed USB device number 24 using xhci_hcd

This is what dmesg says on pi:

[   53.842199] dwc2 20980000.usb: bound driver configfs-gadget
  • what does the device you're connecting the Pi to say about the "keyboard" – Jaromanda X Mar 11 at 22:48
  • @jaromanda-x this dmesg log is of the device I am connecting the Pi to – Querious Mar 12 at 7:52
  • oh, so that's not the pi - misunderstood - what's the dmesg output on the pi then - I wonder if the pi isn't getting enough power – Jaromanda X Mar 12 at 8:37
  • @JaromandaX I added, but dmesg on pi doesn't have much to go on to.. I'd also like to point out that the dmesg on pc very rarely shows it connected as hidraw device, when I am lucky. Not sure why – Querious Mar 12 at 8:52
  • I tried switching the wire after all else failed, as kernel logs suggested.. And it worked! Which is crazy because I got this cable in the kit with pi. – Querious Mar 12 at 20:41
1

I tried switching cables, and it worked. It turns out the cable that I was using was powering the pi correctly, but I guess something was wrong with it that prevented the pi to be seen as a HID device. I changed the cable and it worked like a charm!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.