Difference between revisions of "/dev/usb/oh1"

From WiiBrew
< /dev‎ | usb
Jump to navigation Jump to search
(removed reference to external USB ports - oh0 handles that)
Line 1: Line 1:
/dev/usb/oh1 is the device tree that handles requests to the internal USB bus (and possibly the external ports - need to check). This bus is connected to the Bluetooth dongle. This service exports a high-level interface similar to that of other userspace USB interfaces like libusb.
+
/dev/usb/oh1 is the device tree that handles requests to the internal USB bus. This bus is connected to the Bluetooth dongle. This service exports a high-level interface similar to that of other userspace USB interfaces like libusb.
  
 
== Opening ==
 
== Opening ==

Revision as of 07:35, 22 February 2008

/dev/usb/oh1 is the device tree that handles requests to the internal USB bus. This bus is connected to the Bluetooth dongle. This service exports a high-level interface similar to that of other userspace USB interfaces like libusb.

Opening

The device name is of the form /dev/usb/oh1/VID/PID, where VID and PID are the Vendor ID and Product ID of the device that is to be opened, in hexadecimal, with no leading zeroes. There is no known method of addressing individual identical device with the same VID/PID.

The VID/PID of the internal dongle is 57e/305.

ios_open("/dev/usb/oh1/57e/305"); //open the internal bluetooth dongle

Requests

Send Control Request

ioctlv(fd, 0, 6, 1, vectors);

Vectors:

I/IO Number Type Length Description
I 0 u8 1 bmRequestType
I 1 u8 1 bmRequest
I 2 u16 2 wValue (little-endian)
I 3 u16 2 wIndex (little-endian)
I 4 u16 2 wLength (same as length of vector 6, but little-endian)
I 5 u8 1 unknown; set to zero.
IO 6 array wLength request data payload

For example, to reset the Bluetooth HCI (and therefore break the connection with the Wiimote), send a message with the parameters (0x20,0,0,0,0x0300,0) and data 03 0C 00. (0x0300 is the length, 3, in little-endian format). The operation returns the number of bytes read or written.

Send Or Receive Bulk/Interrupt Message

ioctlv(fd, 1, 2, 1, vectors); //Bulk
ioctlv(fd, 2, 2, 1, vectors); //Interrupt

Vectors:

I/IO Number Type Length Description
I 0 u8 1 bEndpoint
I 1 u16 w wLength
IO 2 array wLength request data payload

The same request is used for both sending and receiving data. Which operation is used depends on the endpoint number (>=0x80 are input endpoints, <0x80 are output). The operation returns the number of bytes read or written.