thewh1teagle/zero-hid

Problem of HID interface

alin256 opened this issue · 4 comments

HID does not seem to work on Raspbian GNU/Linux 11 (bullseye).

I am running the keyboard example from the readme.

Process ProcessWithResult-1:
Traceback (most recent call last):
  File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/home/aliner/.local/lib/python3.9/site-packages/zero_hid/hid/write.py", line 45, in run
    result.return_value = self._target(*self._args, **self._kwargs)
  File "/home/aliner/.local/lib/python3.9/site-packages/zero_hid/hid/write.py", line 65, in _write_to_hid_interface_immediately
    hid_handle.write(bytearray(buffer))
BrokenPipeError: [Errno 108] Cannot send after transport endpoint shutdown
Traceback (most recent call last):
  File "/home/aliner/zero-hid-test/keyboard.py", line 4, in <module>
    k.type('Hello world!')
  File "/home/aliner/.local/lib/python3.9/site-packages/zero_hid/Keyboard.py", line 30, in type
    send_keystroke(self.dev, mods, keys[0])
  File "/home/aliner/.local/lib/python3.9/site-packages/zero_hid/hid/keyboard.py", line 8, in send_keystroke
    hid_write.write_to_hid_interface(keyboard_path, buf)
  File "/home/aliner/.local/lib/python3.9/site-packages/zero_hid/hid/write.py", line 93, in write_to_hid_interface
    raise WriteError(
zero_hid.hid.write.WriteError: Failed to write to HID interface: /dev/hidg0. Is USB cable connected and Gadget module installed? check https://git.io/J1T7Q

Have you followed the instructions from the error?
https://git.io/J1T7Q

Yes, I did run the commands from the manual prior to the script.

And I had a shitty Micro-USB cable :(

Thank you for the quick follow-up!

@alin256 this issue is still there in mac.It is coming when running in mac.In linux it was working fine.