IOUSBDeviceFamily

From iPhone Development Wiki
Jump to: navigation, search

IOUSBDeviceFamily is a kernel-extension for communication of device to the host via the USB cable. This is only an abstract extension. The actual driver implementation is in AppleSynopsysOTG2.

Methods

Selector Action Input Output
0 open void* _arg -
1 close - -
2 setDescription char description[*] -
3 setClassForAlternateSetting uint8_t class_, uint8_t _unused -
4 setSubClassForAlternateSetting uint8_t subclass, uint8_t _unused -
5 setProtocolForAlternateSetting uint8_t protocol, uint8_t _unused -
6 appendStandardClassOrVendorDescriptor unsigned long ?, unsigned long flags; uint8_t descriptor[*] -
7 appendNonStandardClassOrVendorDescriptor unsigned long ?, unsigned long flags; uint8_t descriptor[*] -
8 setClassCommandCallbacks (async) bool wakeOnRequest, bool hasCallback2 -
9  ? bool handledRequest, size_t dataLength, uint64_t mapToken, IOReturn status -
10 createPipe int type, int direction, int maxPacketSize, int interval, int ?, int configIndex void* pipe
11 commitConfiguration - -
12 setAlternateSetting uint8_t configIndex -
13 readPipe (may be async) void* pipe, uint64_t mapToken, long capacity long length
14 writePipe (may be async)  ?  ?
15 stallPipe void* pipe -
16 abortPipe void* pipe -
17 getPipeCurrentMaxPacketSize void* pipe int packetSize
18 createData int64_t length uint8_t* dataPtr, int capacity, uint64_t mapToken
19 releaseDataCallback  ? -
20 isActivated - bool activated , bool isHighSpeed

To use setClassCommandCallbacks, you must issue the call asynchronously, and put the callback function in its reference argument, e.g.

void callback(void* refcon, IOReturn result, size_t* arguments) {
    ...
}

uint64_t refs[3];
refs[1] = (uint64_t) callback;
refs[2] = (uint64_t) refcon;
IOConnectCallAsyncMethod(connection, 8, wakePort, refs, 3, ...);

The same applies to calling readPipe asynchronously, but the 3rd argument becomes "size_t dataLength".

IOUSBDeviceLib

IOUSBDeviceLib is a userland COM plug-in for accessing the IOUSBDeviceInterface. The plug-in's UUID is {9E72217E-8A60-11DB-BF57-000D936D06D2}, and its interface's UUID is {EA33BA4F-8A60-11DB-84DB-000D936D06D2}.