hid_gadget_test icon indicating copy to clipboard operation
hid_gadget_test copied to clipboard

/dev/hidg0: Invalid argument

Open Aljumaili85 opened this issue 7 years ago • 5 comments

Hi Aagallag, I was following your answers on the discussion here : https://bbs.nextthing.co/t/using-usb-otg-to-act-like-a-keyboard/769/11 I manged to hack the hid.c on my system , every thing went well and now the host is read my board as HID gadget ( which is fine ) but I want to use the hid_gadget_test app to send some keystroke to my host . unfortunately I get this error [ /dev/hidg0: Invalid argument ] after I enter my key combination + enter

I appreciate any suggestion

Aljumaili85 avatar Feb 19 '18 14:02 Aljumaili85

just an update , its perfectly work on Linux , the problem above is only when I connect it to MS Windows

Aljumaili85 avatar Feb 19 '18 15:02 Aljumaili85

Can you provide the full output when running the hid_gadget_test? Also, are there any errors showing up in dmesg with regards to HID Gadget?

aagallag avatar Feb 21 '18 05:02 aagallag

sure,

1) dmesg output

//////////////////////////// after Running the gadget /////////////////////////////

[ 207.682916] [sw_udc]: [sw_usb_udc]: binding gadget driver 'g_hid' [ 207.687750] [sw_udc]: alloc request: ep(0xc07f5d58, ep0, 64), req(0xeea241c0) [ 207.702464] [sw_udc]: alloc request: ep(0xc07f5da4, ep1-bulk, 64), req(0xee4f1f80) [ 207.714056] g_hid gadget: HID Gadget, version: 2010/03/16 [ 207.722503] g_hid gadget: g_hid ready [ 207.727062] [sw_udc]: usbd_start_work [ 207.784889] [sw_udc]: IRQ: suspend [ 207.787022] [sw_udc]: ERR: usb speed is unkown [ 207.901021] [sw_udc]: IRQ: reset [ 207.902980] [sw_udc]: irq: reset happen, throw away all urb [ 207.991123] [sw_udc]: [ 207.994713] +++++++++++++++++++++++++++++++++++++ [ 207.995604] [sw_udc]: usb enter full speed. [ 207.998587] [sw_udc]: [ 208.002161] +++++++++++++++++++++++++++++++++++++ [ 208.008129] retire_capture_urb: 43 callbacks suppressed [ 208.014357] [sw_udc]: IRQ: reset [ 208.016303] [sw_udc]: irq: reset happen, throw away all urb [ 208.094947] [sw_udc]: Set address 24

////////////////////////// after start using the test application ///////////////

[ 422.287745] WRN:L2385(drivers/usb/sunxi_usb/udc/sw_udc.c):ERR: sw_udc_queue: inval 2 [ 422.295851] g_hid gadget: usb_ep_queue error on int endpoint 4294967274

2) Test application terminal :

/dev/hidg0: Invalid argument

Aljumaili85 avatar Feb 21 '18 11:02 Aljumaili85

[ 422.287745] WRN:L2385(drivers/usb/sunxi_usb/udc/sw_udc.c):ERR: sw_udc_queue: inval 2

Look like this is the line of code that's failing: https://github.com/linux-sunxi/linux-sunxi/blob/sunxi-3.4/drivers/usb/sunxi_usb/udc/sw_udc.c#L2385

Not sure if this is a bug in the Linux Sunxi kernel or a bug with hid_gadget_test (or maybe the HID gadget module).

Perhaps the USB flow on Windows is different than on Linux. I would like to see a usbcapture of both when it's working on Linux and when it's failing with Windows. I'll try and find my CHIP this weekend and capture the USB traffic if you are not able to provide this.

aagallag avatar Feb 22 '18 07:02 aagallag

Thank you, I would like to stop by this point : do you think it should work with Windows ? or maybe its implementation support only Linux (maybe macOS too) . because , for example, here they provide some Windows INF file to support the multifunction composite gadget but I couldn’t find anything about HID gadget so I assumed it should work .

Aljumaili85 avatar Feb 22 '18 07:02 Aljumaili85