Skip to content

Navigation Menu

Sign in
Sign up

usb hid gadget under Linux #694

Answered by mcuee
mckinley94c asked this question in Q&A
Discussion options

New to embedded system and hardware level programming. Does this repo allow for a linux desktop to act as hid for a Windows machine? Or is it internal so it would a hid on the same machine this repo is running on? Sorry for my ignorance and thank you for any help.

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

No. hidapi (as well as libusb) is for the host side.

For device side, you should look at linux gadget. Your Linux host may or may not support it.
https://www.kernel.org/doc/html/v6.11/driver-api/usb/gadget.html
https://docs.kernel.org/usb/gadget_hid.html

Examples from github:
https://github.com/vpelletier/python-functionfs/tree/master/examples/hid
https://github.com/xairy/raw-gadget/blob/master/examples/keyboard.c

You must be logged in to vote
1 reply
Comment options

If you host does not support, not so sure if you can use the following or not (emulated HID device). I tend to think it may not work for your use case.
https://github.com/martinpitt/umockdev/tree/main/devices/hidraw

Answer selected by mcuee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /