/dev/usb/oh0: Difference between revisions
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
/dev/usb/oh0 is used to interact with the Wii's external USB bus. | /dev/usb/oh0 is used to interact with the Wii's external USB bus. This interface is very similar to [[/dev/usb/oh1]] and has two parts: the "root" or host device, and individual devices on which USB requests can be submitted. | ||
== /dev/usb/oh0 (IOS57 and newer) == | |||
In recent versions of IOS (after IOS 57), the OHCI0 module appears to implement a different interface and seems to only register this new interface of /dev/usb/oh0. | |||
Only IOS_OPEN, IOS_CLOSE and IOS_IOCTL are valid commands. The other commands immediately return IPC_EINVAL (-4). | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
| Line 10: | Line 13: | ||
|- | |- | ||
| 0 || USBV2_IOCTL_GET_VERSION || - || 0x20 bytes | | 0 || USBV2_IOCTL_GET_VERSION || - || 0x20 bytes | ||
| Writes the version 0x20001 to the output buffer. This is very similar to the IOS58 version of /dev/usb/hid, which writes 0x50001 to the output buffer instead. | | Writes the version 0x20001 to the output buffer. This is very similar to the IOS58 version of /dev/usb/hid, which writes 0x50001 to the output buffer instead. It is also reminiscent of [[/dev/usb/ehc]] which does the same thing (but with an ioctlv). | ||
|- | |- | ||
| 1 || ? || ? || ? | | 1 || ? || ? || ? | ||
| Line 46: | Line 49: | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! | ! Request !! Name !! Input !! Output | ||
! Notes | ! Notes | ||
|- | |- | ||
| 12 (ioctlv) || | | 12 (ioctlv) || USBV0_IOCTL_GETDEVLIST || 2 || 2 | ||
| | | | ||
* in 0: u8 - number of descriptors to return | * in 0: u8 - number of descriptors to return | ||
| Line 55: | Line 59: | ||
* io 0: u8 - number of devices | * io 0: u8 - number of devices | ||
* io 1: u32* of size num_descriptors * 8 - device list | * io 1: u32* of size num_descriptors * 8 - device list | ||
|- | |||
| 15 (ioctl) || ? || ? || ? | |||
| Mentioned by comex in #dolphin-dev. | |||
|- | |- | ||
| Line 64: | Line 72: | ||
|- | |- | ||
| 30 (ioctlv) || | | 30 (ioctlv) || USBV0_IOCTL_DEVINSERTHOOKID (RegisterInsertionNotifyWithId) || 3 || 1 | ||
| | | | ||
Returns when a device with the requested VID/PID is plugged in, or immediately if the device is already inserted. | Returns when a device with the requested VID/PID is plugged in, or immediately if the device is already inserted. | ||
Its purpose is unknown | It is similar to USBV0_IOCTL_DEVINSERTHOOK, but it has an additional in vector + io vector, possibly used for passing an "ID" (according the official name). Its purpose is unknown. | ||
* in 0: u16 - VID | * in 0: u16 - VID | ||
* in 1: u16 - PID | * in 1: u16 - PID | ||
* in 2: u8 - Unknown (00) | * in 2: u8 - Unknown (00); some sort of ID? | ||
* io 0: u8* of size 4 - Unknown ( | * io 0: u8* of size 4 - Unknown; some sort of ID? | ||
|- | |||
| 31 (?) || ? (IUSB_CancelInsertionNotify) || ? || ? | |||
| ? | |||
|} | |} | ||
== /dev/usb/oh0/%x/%x == | == /dev/usb/oh0/%x/%x == | ||
These devices represent an individual USB device, based on its vendor ID and product ID (in hexadecimal format without leading zeroes). It is unclear how devices with the same VID/PID can be used at the same time. | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! | ! Request !! Name !! Input !! Output | ||
! Notes | ! Notes | ||
| Line 136: | Line 150: | ||
|- | |- | ||
| 29 (ioctl) || ? || | | 29 (ioctl) || ? || - || - | ||
| | | | ||
Unknown. Used by Wheel of Fortune on shutdown. | Unknown. Used by Wheel of Fortune on shutdown. | ||
Revision as of 22:17, 18 December 2016
/dev/usb/oh0 is used to interact with the Wii's external USB bus. This interface is very similar to /dev/usb/oh1 and has two parts: the "root" or host device, and individual devices on which USB requests can be submitted.
/dev/usb/oh0 (IOS57 and newer)
In recent versions of IOS (after IOS 57), the OHCI0 module appears to implement a different interface and seems to only register this new interface of /dev/usb/oh0.
Only IOS_OPEN, IOS_CLOSE and IOS_IOCTL are valid commands. The other commands immediately return IPC_EINVAL (-4).
| Ioctl | Name | Input | Output | Notes |
|---|---|---|---|---|
| 0 | USBV2_IOCTL_GET_VERSION | - | 0x20 bytes | Writes the version 0x20001 to the output buffer. This is very similar to the IOS58 version of /dev/usb/hid, which writes 0x50001 to the output buffer instead. It is also reminiscent of /dev/usb/ehc which does the same thing (but with an ioctlv). |
| 1 | ? | ? | ? | ? |
| 2 | ? | ? | ? | ? |
| 3 | ? | 0x20 bytes | ? | ? |
| 4 | ? | 0x20 bytes | ? | ? |
| 5 | ? | 0x20 bytes | ? | ? |
| 16 | ? | 0x20 bytes | ? | ? |
| 17 | ? | 0x20 bytes | ? | ? |
| 18 | ? | 0x20 bytes | ? | Handled by the same function as for ioctl 20. |
| 19 | ? | 0x20 bytes | ? | ? |
| 20 | ? | 0x20 bytes | ? | Handled by the same function as for ioctl 18. |
/dev/usb/oh0
| Request | Name | Input | Output | Notes |
|---|---|---|---|---|
| 12 (ioctlv) | USBV0_IOCTL_GETDEVLIST | 2 | 2 |
|
| 15 (ioctl) | ? | ? | ? | Mentioned by comex in #dolphin-dev. |
| 27 (ioctlv) | USBV0_IOCTL_DEVINSERTHOOK | 2 | 0 |
Returns when a device with the requested VID/PID is plugged in, or immediately if the device is already inserted.
|
| 30 (ioctlv) | USBV0_IOCTL_DEVINSERTHOOKID (RegisterInsertionNotifyWithId) | 3 | 1 |
Returns when a device with the requested VID/PID is plugged in, or immediately if the device is already inserted. It is similar to USBV0_IOCTL_DEVINSERTHOOK, but it has an additional in vector + io vector, possibly used for passing an "ID" (according the official name). Its purpose is unknown.
|
| 31 (?) | ? (IUSB_CancelInsertionNotify) | ? | ? | ? |
/dev/usb/oh0/%x/%x
These devices represent an individual USB device, based on its vendor ID and product ID (in hexadecimal format without leading zeroes). It is unclear how devices with the same VID/PID can be used at the same time.
| Request | Name | Input | Output | Notes |
|---|---|---|---|---|
| 0 (ioctlv) | USBV0_IOCTL_CTRLMSG | 5 | 1 |
Submits a control transfer.
|
| 1 (ioctlv) | USBV0_IOCTL_BLKMSG | 2 | 1 |
Submits a bulk transfer.
|
| 2 (ioctlv) | USBV0_IOCTL_INTRMSG | 2 | 1 |
Submits an interrupt transfer.
|
| 5 (ioctl) | USBV0_IOCTL_SUSPENDDEV | ? | ? |
Unknown. According to libogc, this is used for suspending a device. |
| 6 (ioctl) | USBV0_IOCTL_RESUMEDEV | ? | ? |
Unknown. According to libogc, this is used for resuming a device. |
| 9 (ioctlv) | USBV0_IOCTL_ISOMSG | 3 | 2 |
Submits an isochronous transfer.
|
| 26 (ioctlv) | USBV0_IOCTL_DEVREMOVALHOOK | 0 | 0 |
Returns when the device is unplugged. |
| 29 (ioctl) | ? | - | - |
Unknown. Used by Wheel of Fortune on shutdown. |
Known Devices
- /dev/usb/oh0/0b95/7720: ASIX AX88772 USB2.0 to Fast Ethernet Adapter (referenced in IOS eth driver)
- /dev/usb/oh0/57e/308: Nintendo Wii Speak (microphone)
- /dev/usb/oh0/46d/a03: Logitech microphone
Errors
-4 (IPC_EINVAL): might be caused by an invalid device fd
-7003: STALL (according to gc-linux)
-7004: STALL (according to gc-linux)
-7005: NAK (according to gc-linux)
-7008
-7022