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

From WiiBrew
< /dev‎ | usb
Jump to: navigation, search
(Ioctls)
m (Ioctls)
Line 13: Line 13:
  
 
== Ioctls ==
 
== Ioctls ==
{| class="wikitable"
+
{| class="wikitable" style="width: 100%"
 
|-
 
|-
 
! Ioctl !! Name !! Input !! Output
 
! Ioctl !! Name !! Input !! Output

Revision as of 15:25, 27 October 2017

/dev/usb/ven is an IOS resource manager that is used to interact with USB devices. This device is implemented only in IOS57, 58 and 59 by the USB_VEN module, which is a thin wrapper around /dev/usb/usb. It replaces /dev/usb/oh0, which is repurposed as an internal USB backend in these versions.

VEN is often used by official games to communicate with USB cameras (such as Your Shape) and microphones (in the newer singing games). It is also used by libogc for USB2 support.

All buffers must be in MEM2 (addr > 0x10000000) and aligned to a 32-byte boundary. For all of the ioctlvs, the first buffer must be 64 bytes long.

Only IOS_OPEN, IOS_CLOSE, IOS_IOCTL and IOS_IOCTLV are valid commands. The other commands immediately return IPC_EINVAL (-4).

Handles

Up to 16 handles can be opened, each with their own device change hook. The handle ID is specified in the open request as the "mode". IPC_EINVAL will be returned if an ID that is in use is passed.

Ioctls

Ioctl Name Input Output Notes
0 GetVersion None

32 bytes

0-4: version (0x50001)

1 GetDeviceChange None

Entry[32] (0x180 bytes)

For each entry:

0-1: IPC request address >> 8
1-2: Device index (0 to 31)
2-4: Device number
4-6: VID
6-8: PID
8-10: Device number
10-11: Interface number
11-12: Number of alternate settings

Set up a device insertion/removal callback. Returns the number of entries.

Note that this ioctl immediately returns on the first call.

2 Shutdown None None Releases the device change callback with 0 as return code.
3 GetDeviceInfo 0x20 0xc0 calls /dev/usb/usb ioctl 2
4 ? 0x20 None
5 ? 0x20 None indirectly calls /dev/usb/usb ioctl 1
6 AttachFinish None None calls /dev/usb/usb ioctl 1
7 SetAlternateSetting 0x20 None calls /dev/usb/usb ioctl 5 and/or 0x11
8 ? 0x20 None calls /dev/usb/usb ioctl 3
0x10 SuspendResume 0x20 None calls /dev/usb/usb ioctl 4
0x11 CancelEndpoint 0x20 None calls /dev/usb/usb ioctl 0x10
0x12 (ioctlv) CtrlTransfer 1 in / 1 io or 2 in / 0 io calls /dev/usb/usb ioctl 0x11
0x13 (ioctlv) IntrTransfer 1 in / 1 io or 2 in / 0 io calls /dev/usb/usb ioctl 0x12
0x14 (ioctlv) IsoTransfer 2 in / 2 io or 3 in / 1 io calls /dev/usb/usb ioctl 0x13
0x15 (ioctlv) BulkTransfer ? calls /dev/usb/usb ioctl 0x14