USB services: Difference between revisions

No edit summary
No edit summary
Line 120: Line 120:


Returns an error when [[#BindDevice]] wasn't used.
Returns an error when [[#BindDevice]] wasn't used.
Up to 4 interfaces can be used+[[#EnableInterface|enabled]].


Structure of the first buffer(this is similar to [http://libusb.sourceforge.net/api-1.0/structlibusb__interface__descriptor.html libusb__interface__descriptor]):
Structure of the first buffer(this is similar to [http://libusb.sourceforge.net/api-1.0/structlibusb__interface__descriptor.html libusb__interface__descriptor]):
Line 130: Line 132:
| 0x1 || 0x1 || bDescriptorType. Must match 0x4.
| 0x1 || 0x1 || bDescriptorType. Must match 0x4.
|-
|-
| 0x2 || 0x1 || When 0x4, an error will be thrown if certain state checks don't pass. Otherwise, this must be <=3.
| 0x2 || 0x1 || bInterfaceNumber. When 0x4, the bInterfaceNumber is automatically allocated(error will be thrown if no space). Otherwise, it's used directly and must be <=3.
|-
|-
| 0x3 || 0x1 || Must match 0x0.
| 0x3 || 0x1 || Must match 0x0.
Line 221: Line 223:
Takes no arguments. Enables the current interface.
Takes no arguments. Enables the current interface.


Only one interface can be enabled at time, this indicates which interface is actually used for USB.
Only one interface can be enabled at a time per bInterfaceNumber. When bInterfaceNumber is auto-allocate(0x4) for [[#GetDsEndpoint]] this isn't an issue since the final bInterfaceNumber will be unique.
 
Once enabled, the device/interface can then actually be used over USB.


=== DisableInterface ===
=== DisableInterface ===