Issues with simulating a keyboard device with gadgetfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

I am trying to understand how usb.c, the only working user mode driver
example that I found on the net that uses gadgetfs. Using that code as
the base I am trying to write a HID keyboard driver (user mode) with
Net2280 peripheral device controller to simulate working of a
keyboard. I referred to the following discussion that happened almost
half a decade ago but didn't lead to any useful conclusions (but did
help me find answers to some of my questions):

http://www.mail-archive.com/linux-usb-devel@xxxxxxxxxxxxxxxxxxxxx/msg20380.html

I am running Wireshark with USB support on the host to see what's
going on. I've attached the traces of real keyboard and my simulation
keyboard with this email. Based on that I have the following (newbie)
questions:

1. After the response to 'GET DEVICE DESCRIPTOR' request, the trace of
simulation driver shows that the host sends a 'GET DESCRIPTOR DEVICE
QUALIFIER' request. I do not see such request in the trace for the
real keyboard. What is the meaning of this request? Was the response
to the earlier 'GET DEVICE DESCRIPTOR' request malformed (the sniffer
doesn't indicate that, however)?

Simulation keyboard trace:

--------------------------------------------------------------------------------------------------
Source     Destination    Protocol   Info
--------------------------------------------------------------------------------------------------
host         23.0              USB        GET DESCRIPTOR Request
DEVICE QUALIFIER


2. My simulation keyboard driver stops responding after the following request:

-------------------------------------------------------------------------------
Source    Destination   Protocol     Info
-------------------------------------------------------------------------------
host        3.0               USB          SET CONFIGURATION Request

What should my driver send as a response back to the host? I saw that
the real keyboard just sends a response with 0's filled in it. Is this
what it is supposed to send? Keyboard simulator creates a new thread
for 'ep-a' management and writes the endpoint descriptor into ep-a's
file  descriptor.  But the host doesn't seem to get it (can't see it
on Wireshark). What I see is a (probable) timeout after 5 sec and 0's
filled in 'SET CONFIGURATION' response. Also after this, the host
doesn't send a request for reports, like it does in case of the real
keyboard. Why does this happen?


3. The real keyboard has an IN endpoint of type interrupt. As far as I
understand, this is the endpoint that should be sending the report
descriptors to the host. However, in Wireshark I see that when the
host sends a 'GET DESCRIPTOR RPIPE' request the ep0 of the real
keyboard sends the report instead of ep1. Here is the trace (I assume
'3.0' means ep0):

-------------------------------------------------------------------------------------
Source    Destination   Protocol     Info
-------------------------------------------------------------------------------------
host         3.0              USB           GET DESCRIPTOR Request RPIPE

Since ep1 is interrupt type, shouldn't it send the report when the
host sends an 'IN' token packet to ep0 instead of ep0 sending it when
the host sends 'GET DESCRIPTOR RPIPE' to ep0?

4. Is there any other documentation available on gadgetfs and usb.c
apart from the source code itself?

Thanking you in advance.

Regards,
Aniruddha
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux