geefr / stepmania-linux-goodies

Linux kernel patches and other goodies for use with stepmania
GNU General Public License v2.0
10 stars 0 forks source link

Gettio/Barrio #5

Closed kategray closed 3 years ago

kategray commented 4 years ago

If you are using these on Linux I'd love to see your EVHZ output/know why these work out of the box :)

What would you like to know?

geefr commented 4 years ago

Well, the output from evhz and any info on how those devices manage 1Khz polling out of the box (By default Linux polls HID devices at 125Hz, so what's special here?)

Alternatively it's an open invitation to update the docs to account for those, as they're well recommended in general

kategray commented 4 years ago

They are polled at that speed because I request it.

/*********************************************************************
* Device Descriptors
*********************************************************************/
const uint8 CYCODE USBFS_DEVICE0_DESCR[18u] = {
/* Descriptor Length                       */ 0x12u,
/* DescriptorType: DEVICE                  */ 0x01u,
/* bcdUSB (ver 2.0)                        */ 0x00u, 0x02u,
/* bDeviceClass                            */ 0x00u,
/* bDeviceSubClass                         */ 0x00u,
/* bDeviceProtocol                         */ 0x00u,
/* bMaxPacketSize0                         */ 0x08u,
/* idVendor                                */ 0xD0u, 0x16u,
/* idProduct                               */ 0x02u, 0x0Du,
/* bcdDevice                               */ 0x00u, 0x03u,
/* iManufacturer                           */ 0x01u,
/* iProduct                                */ 0x02u,
/* iSerialNumber                           */ 0x80u,
/* bNumConfigurations                      */ 0x01u
};
/*********************************************************************
* Config Descriptor  
*********************************************************************/
const uint8 CYCODE USBFS_DEVICE0_CONFIGURATION0_DESCR[34u] = {
/*  Config Descriptor Length               */ 0x09u,
/*  DescriptorType: CONFIG                 */ 0x02u,
/*  wTotalLength                           */ 0x22u, 0x00u,
/*  bNumInterfaces                         */ 0x01u,
/*  bConfigurationValue                    */ 0x01u,
/*  iConfiguration                         */ 0x03u,
/*  bmAttributes                           */ 0x80u,
/*  bMaxPower                              */ 0xFAu,
/*********************************************************************
* Interface Descriptor
*********************************************************************/
/*  Interface Descriptor Length            */ 0x09u,
/*  DescriptorType: INTERFACE              */ 0x04u,
/*  bInterfaceNumber                       */ 0x00u,
/*  bAlternateSetting                      */ 0x00u,
/*  bNumEndpoints                          */ 0x01u,
/*  bInterfaceClass                        */ 0x03u,
/*  bInterfaceSubClass                     */ 0x00u,
/*  bInterfaceProtocol                     */ 0x00u,
/*  iInterface                             */ 0x00u,
/*********************************************************************
* HID Class Descriptor
*********************************************************************/
/*  HID Class Descriptor Length            */ 0x09u,
/*  DescriptorType: HID_CLASS              */ 0x21u,
/*  bcdHID                                 */ 0x11u, 0x01u,
/*  bCountryCode                           */ 0x21u,
/*  bNumDescriptors                        */ 0x01u,
/*  bDescriptorType                        */ 0x22u,
/*  wDescriptorLength (LSB)                */ USBFS_HID_RPT_1_SIZE_LSB,
/*  wDescriptorLength (MSB)                */ USBFS_HID_RPT_1_SIZE_MSB,
/*********************************************************************
* Endpoint Descriptor
*********************************************************************/
/*  Endpoint Descriptor Length             */ 0x07u,
/*  DescriptorType: ENDPOINT               */ 0x05u,
/*  bEndpointAddress                       */ 0x81u,
/*  bmAttributes                           */ 0x03u,
/*  wMaxPacketSize                         */ 0x01u, 0x00u,
/*  bInterval                              */ 0x01u
};

The USB documentation for windows (which I'm currently using for reference) reads:

bInterval

The bInterval value contains the polling interval for interrupt and isochronous endpoints. For other types of endpoint, this value should be ignored. This value reflects the device's configuration in firmware. Drivers cannot change it.

The polling interval, together with the speed of the device and the type of host controller, determine the frequency with which the driver should initiate an interrupt or an isochronous transfer. The value in bInterval does not represent a fixed amount of time. It is a relative value, and the actual polling frequency will also depend on whether the device and the USB host controller operate at low, full or high speed.

Value of bInterval Polling Period (1-millisecond frames) Interrupt Isochronous
1 1 Supported. Supported.
kategray commented 4 years ago

The cause may be that low speed devices are polled no faster than 8ms. The Ghett-IO and Barr-IO are Full Speed devices.

kategray commented 4 years ago

For low speed devices:

Value of bInterval Polling Period (1-millisecond frames) Interrupt
0 to 15 8 Supported.
geefr commented 4 years ago

Ah cool, I don't know much about USB specifically :P

So as long as the system's drivers respect that it should all 'just work', nice.

Thanks for the info, I'll update the docs when I get a minute.

geefr commented 3 years ago

Wiki to be updated shortly