/dev/usb/ven

From WiiBrew
< /dev‎ | usb
Jump to: navigation, search

/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 Parameters Function Notes
0 0 / 0x20 (ioctl) ven_open
1 0 / 0x180 (ioctl) ven_attach_complete_callback
2 0 / 0 (ioctl) ven_close
3 0x20 / 0xC0 (ioctl) ? calls /dev/usb/usb ioctl 2
4 0x20 / 0 (ioctl) ?
5 0x20 / 0 (ioctl) ? indirectly calls /dev/usb/usb ioctl 1
6 0 / 0 (ioctl) ? calls /dev/usb/usb ioctl 1
7 0x20 / 0 (ioctl) ven_set_alt_setting calls /dev/usb/usb ioctl 5 and/or 0x11
8 0x20 / ? (ioctl) ? calls /dev/usb/usb ioctl 3
0x10 0x20 / 0 (ioctl) ven_suspend_resume, ven_attach_suspend_callback, ven_attach_get_device_params_callback calls /dev/usb/usb ioctl 4
0x11 0x20 / 0 (ioctl) ven_cancel_endpoint calls /dev/usb/usb ioctl 0x10
0x12 1 in / 1 io, or 2 in / 0 io? (ioctlv) ven_ctrl calls /dev/usb/usb ioctl 0x11
0x13 1/1 or 2/0? (ioctlv) ven_intr calls /dev/usb/usb ioctl 0x12
0x14 2/2 or 3/1 (ioctlv) ven_isoc calls /dev/usb/usb ioctl 0x13
0x15 ? (ioctlv) ven_? calls /dev/usb/usb ioctl 0x14