最終更新:2021-03-02 (火) 02:21:25 (1113d)
Linux/USBガジェット/HID
概要
- The HID Gadget driver provides emulation of USB Human Interface Devices (HID).
- The basic HID handling is done in the kernel, and HID reports can be sent/received through I/O on the /dev/hidgX character devices.
.config
ドライバ
ドキュメント・サンプル
デバイスファイル
ソースコード
カーネル側
ユーザ側
手順
- http://www.linuxquestions.org/questions/linux-newbie-8/linux-usb-gadget-hid-driver-problem-840733-print/
- step1: go to the link below.
- step2: copy the following two structures from the above link and paste into drivers/usb/gadget/hid.c
- hidg_func_descriptor my_hid_data
- platform_device my_hid
int status; status = platform_device_register(&my_hid); if (status < 0) { platform_driver_unregister(&my_hid); return status; }
- step3: compile the hid module
- step4: load the module
ディスクリプタの定義
kernel.org/doc/Documentation/usb/gadget_hid.txt
- g_hid is a platform driver, so to use it you need to add struct platform_device(s) to your platform code defining the HID function descriptors you want to use.
https://users.atmark-techno.com/blog/750/2465
- /arch/arm/mach-shmobile/board-armadillo810.c b/arch/arm/mach-shmobile/board-armadillo810.cの中に
- hidg_func_descriptor my_hid_dataとplatform_device my_hidを定義して
- platform_device_register(&my_hid);してる
g_hid-demo
- Normally the platform_device descriptor would be part of the board support for the device, e.g. in arch/arm/mach-omap2/devices.c, but for convenience I am putting it in to the g_hid module to make easier for testing.
参考
- Use pcDuino as a Mouse When its connected to a PC through USB OTG
- http://www.linuxquestions.org/questions/linux-newbie-8/linux-usb-gadget-hid-driver-problem-840733/
- Do More With Less
- https://www.mail-archive.com/linux-usb@vger.kernel.org/msg06155.html
- Turning your Raspberry PI Zero into a USB Gadget
- https://users.atmark-techno.com/blog/750/2465