Hello again, I had written previously in regards to getting an embedded PXA255 chip to work as a simulated USB mouse using the GadgetFS API. I have been able to properly alter the example usb.c code example from GadgetFS to initialize properly as a USB mouse. It uses only the control ep0 thread. Using the USB Snooper, the mouse sends all of the required descriptors (including the HID report descriptor) to the host when required. However, in trying to implement what I thought would be the 'easiest' part of the code, writing the simulated mouse bytes to the endpoint, I am encountering some major problems.
After the device sends the HID report descriptor to the host, the device is unable to perform any additional writes to fd. I have printed out the contents of the buffer after filling them in with the desired 'mouse movement byte', and this works perfectly. It is only when I attempt to write this buffer to fd that I receive the (-1) message. I have tried writing this buffer in numerous places of the code following the report descriptor, and the write fails every time. The errno on the failure is ESRCH = No such process. I thought perhaps there was a problem writing the 'mouse bytes', and have simplified the code to simply try writing a small buffer. This write also fails each time, in each spot of the code. I believe that in using the control endpoint, the host will poll the endpoint for the information (from the usb spec, it seems that the host polling does not have a specific bRequestType, it simply uses the bRequest = 9 (class) and looks for a report of the correct format). I have followed the USBSnoop traces for both a working mouse, as well as this attempt at an embedded simulation mouse, and the snoops for both mice are exactly the same. (Which is disheartening as the working mouse moves, while this simulation fails each time it is attempted!) I would appreciate any help on this last piece of the puzzle! I asked a few of my coworkers about this problem yesterday, and after trying the write in numerous places over quite a few hours, this problem has each of us completely stumped. (Also, thank you Dave for clarifying the Control out/in transfers. I initially thought maybe this problem was occurring due to my thinking of these incorrectly! I almost wish it had been that 'quick' of a solution.) I have attached the modified usb.c code which now initializes as a Logitech USB mouse. Right now, the code uses the s_iCounter to tell which USB request is being sent, and after the report descriptor is sent, it attempts to write a simple buffer to fd. I'd greatly appreciate any help, we are all scratching our heads on this end. I've looked through the USB spec and Google, and this does not seem to be a well documented problem. Thank you, Colleen
usb.c
Description: Binary data
