Understanding the USB Comlex - where does the HostController store data from Interrupt In Endpoints?

Hey there.

I am new with Tegra an Co.
I am working on a Tegra K1 Board using ubuntu 14.04.4 tls.

I unterstood the plugged in usb devices have internal endpoints. I know that the host controller polls these interrupt in endpoints (usb 2.0 touch screen - Hid Device) …

I know that ehci-hcd host controller interface is connected to the PIC (IRQ 129).

So what happens to the data (coordinates, touch event) when the hcd polls the data. where is it stored?
Is it memory mapped? Uses the HCD internal Buffer for this data?

When the Host Controller gives the interrupt to /proc/interrupts / PIC … where can I find the Handling Routine for this interrupt. Where can I find this stored data?

I hope anybody can help me. I tried with the TK1 Manual, the USB2.0 Reference and so on, I tried to find more informations by looking into the usb-touch driver (and ehci_hcd) … but no success.

Thanks in advance!

I can’t answer most of that, but it may help to understand that there are two drivers involved in using any USB end point. The first driver is the USB controller and its operations…but this just deals with the device as a data pipe. Aside from transferring data the pipe is also used for announcing changes to the hot plug layer…the hot plug layer may recognize the device, and a driver will take ownership if you want to know about where the data goes.

Some drivers which might take ownership are standardized classes which use standardized commands for interacting…these are the classes like HID (keyboard, mouse, joystick), USB Video Class (UVC cameras and similar with standard functionality), USB Mass storage (hard drives or bulk transfer), so on. The drivers which service standardized classes are not actually dealing with the USB controller…they’re separate drivers which happen to have knowledge of certain devices as a convenience so every device doesn’t need a custom driver.

If a device is not a standardized class, then it has to have its own custom driver. When the USB subsystem announces a device plugging in to and enumerating on USB, then a custom device driver might take ownership in the same way as a standard class. The drivers which take ownership of the specific device store and deal with most of the information you are interested in. Aside from possibly buffering the data pipe, you need to investigate the driver which specifically takes ownership.

If it’s a standardized class like HID or UVC, then you are in luck because the code and information is available in many places. If the driver is a custom driver, then perhaps it is open source, or perhaps not…if not open source, then you’re going to do some guessing.

The TRM describes the controller, but you’d have to go somewhere like usb.org to understand what the software must accomplish.

The end software which consumes the data tells you more about behavior, e.g., if you are in the GUI, then the XInput extension to the Xorg server decides what to do with a mouse, joystick, keyboard, so on. There is a different Xorg extension for talking to the video driver…an ABI (Application Binary Interface) defines what the server expects, and a video driver fulfills that ABI’s requirements…this could be over PCIe, but it could be over USB. If video is over USB or PCIe the Xorg server does not care…the driver handling the video is separate from the data pipe of PCIe or USB.

Thanks for your fast answer.

In fact when plugged in, the device is listet as USB-Hid device

  • bInterfaceClass 3 Human Interface Device
    bInterfaceSubClass 1 Boot Interface Subclass
    bInterfaceProtocol 2 Mouse
    So I am dealing with the Egalax Touch EXC3000 recogniced as USB-Hid-Device. (Of course there is a driver TKUSB available but not necessary and not installed because we have an inbuilt hid module for HID touch device).

I checked the HID-drivers (e.g. http://lxr.free-electrons.com/source/drivers/hid/usbhid/usbmouse.c).
But to be honest I am not in .C so it is very difficult to understand the proper function of this driver.

So maybe s.bd. can tell me if it is stored to ? or forwarded to dma …

mouse->data = usb_alloc_coherent(dev, 8, GFP_ATOMIC, &mouse->data_dma);
if (!mouse->data)
goto fail1;

bInterfaceClass is from the USB query of the USB part of the device. This is still purely USB and does not touch the actual device…it tells hotplug software about how to talk to the device and what to announce the device as.

Keep in mind that there is often more than one device on a cable. For example, a programmable mouse will show up as a separate mouse and keyboard…when programmed to produce a keystroke then mouse produces a key down/up event as a keyboard…the mouse moves, the sensor appears as a mouse. The USB connected device which does the actual programming of the programmable mouse will have its own custom driver. So that case would be standard HID driver for mouse, standard HID driver for keyboard, and custom driver for programming…three device drivers for one mouse, three separate USB descriptions for hotplug to describe for drivers to take ownership.

I don’t know if the HID drivers use DMA or not. Keep in mind that somewhere this is also a user space application communicating with the driver…probably only minimal information is stored within a driver and the user space application listing to the mouse would pay more attention to saving details. What’s using the mouse…the X11 graphical interface? In that case look at the XInput extension.