I have this configuration of the devices HOST_PS
<----> Transmitter
<---- Touchscreen
.
Currently on my transmitter I have created a composite USB gadget device which could contain up to 5 HID devices, (2Mouse, 2Keyboard, Touchscreen). HOST PC could enumerate all of them and everything is working properly. From transmitter side I am writing HID report data comeing from the touchscreen to the corresponding /dev/hidg device and Host PC acts correctly. The problem occurred when
report descriptor
and all the corresponding data(dev, no_out_endpoint, protocol, report_desc, report_length, subclass
) to /sys/kernel/config/usb_gadget/Nhid/functions/hid.usb0/
.After all this steps the HOST_PC could enumerate the touchscreen properly but the tocushes doesn't work(I also know why).
HOST_PC printing this message hid-multitouch xxx:yyy:zzz.uuu: failed to fetch feature 7
.
Some touchscreens using Feature reports
for allowing the HOST to have configurable device. If I connect the Touchscreen directly to the PC I can see the following under the hood. I'll describe the final steps before sending the input reports from the touchscreen.
The problem hid-multitouch xxx:yyy:zzz.uuu: failed to fetch feature 7
is though I am setting the report descriptor to USB_GADGET's HID device and HOST_PS enumerates it properly, I am not sending
the feature report
to the host
as it requested in step 2 above
.
QUESTION:
How to send feature report from device to HOST_PC, if the device is USB_GADGET composite HID device. In usual for sending the Input report
(HID data) I am writing the incoming data from the touchscreen to the corresponding /dev/hidg<N>
device.
NOTES:
The HOST_PC is Linux(Ubuntu, CentOS,... doesn't metter) and I ma not interested on Windows.
The Touchscreen works perfectly if I connect it to the PC directly.
I don't want to modify the touchscreen's report descriptor, remove feature report part and solve the problem like that.
PS:
I know this is a little bit complicated but Thanks in advance.
In case someone would have this kind of problem in future. This is not a bug in Linux USB_GADGET driver but I would honestly say that it is a missing feature which is not implemented. This is a link to the place where the implementation wasn't done https://github.com/torvalds/linux/blob/master/drivers/usb/gadget/function/f_hid.c#L652.
If someone wants to send feature_report(s) from device to HOST, than you probably will need to implement it in driver.
This is my modification to USB_GADGET driver that will allow to send feature reports to the HOST. https://github.com/torvalds/linux/compare/master...AydinyanNarek:patch-1
PS. I don't have enough time to create pull request and other staff for applying this patch to the kernel. If someone would be interested on this than you can take this patch that I have created, polish the code and apply for a patch.