Anatomy of a Packet - owaink/libfprint GitHub Wiki
Goodix devices communicate with a packet based protocol, so let's dissect a packet to understand how it works
How USB Works
Since most of our devices communicate over USB, it's best to have a background on how USB actually works. When a device is plugged into USB, it reports information about itself to the computer, including Vendor ID (VID) and Product ID (PID) in the format VID:PID. You can see the information reported by the device by using lsusb -v. The Goodix VID is 27C6 and an example PID is 532D, becoming 27C6:532D. Each driver running on the system will have a list of USB IDs it supports and the driver that supports that device will claim it.
USB Addressing
VID and PID are useful for identifying what a USB devices is, but not which one it is if there are multiple of the same device plugged in. The computer addresses each USB device in the format [BUS]-[PORT].(PORT). In my case, my Goodix device is plugged into bus 3, port 5 for an address of 3-5. If a devices is plugged into a USB hub, the hub's port number is inserted in the address, such as 3-5.1 for a hub plugged into bus 3, port 5, with a device plugged into port 1 of the hub. Then, the USB device exposes it's configurations. The configuration is added after the USB address and a colon, so configuration 1 of a device plugged into the 5th port of bus 3 would be addressed as 3-5:1. Most devices have only one configuration as they are essentially different modes the USB device can run in. Each configuration will expose different interfaces. Interfaces are addressed after the configuration, with interface 0 being the default, so interface 0 of configuration 1 on the 5th port of bus 3 would become 3-5:1.0. Each interface will have endpoints where actual communication takes place and are addressed in sysfs as subdirectories and are named ep_ENDPOINTNUMBER. In my case, endpoint 1 and endpoint 83 are exposed. You can see the endpoints on your device under lsusb -v or in /sys/bus/usb/devices/[BUS_NUMBER]-[PORT_NUMBER]:[CONFIGURATION_NUMBER].[INTERFACE_NUMBER]/. For me, this is /sys/bus/usb/devices/3-5:1.0/
Endpoints
The endpoints are where the actual communication with the USB device happens. Endpoints have to be one of the following types: Control, Interrupt, Bulk, and Isochronous.