Difference between revisions of "IOUSBDeviceFamily"

From iPhone Development Wiki
Jump to: navigation, search
(Created page with ''''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 i…')
 
 
(2 intermediate revisions by the same user not shown)
Line 19: Line 19:
 
| 5 || setProtocolForAlternateSetting || uint8_t ''protocol'', uint8_t ''_unused'' || -
 
| 5 || setProtocolForAlternateSetting || uint8_t ''protocol'', uint8_t ''_unused'' || -
 
|-
 
|-
| 6 || appendStandardClassOrVendorDescriptor || ? || -
+
| 6 || appendStandardClassOrVendorDescriptor || unsigned long ''?'', unsigned long ''flags''; uint8_t ''descriptor''[*] || -
 
|-
 
|-
| 7 || appendNonStandardClassOrVendorDescriptor || ? || -
+
| 7 || appendNonStandardClassOrVendorDescriptor || unsigned long ''?'', unsigned long ''flags''; uint8_t ''descriptor''[*] || -
 
|-
 
|-
| 8 || setClassCommandCallbacks || ? || -
+
| 8 || setClassCommandCallbacks (async) || bool ''wakeOnRequest'', bool ''hasCallback2'' || -
 
|-
 
|-
| 9 || classCommandCallbacksHandler || ? || -
+
| 9 || ? || bool ''handledRequest'', size_t ''dataLength'', uint64_t ''mapToken'', IOReturn ''status'' || -
 
|-
 
|-
| 10 || createPipe || int ''?'', int ''?'', int ''?'', int ''?'', int ''?'', int ''?'' || void* ''pipe''
+
| 10 || createPipe || int ''type'', int ''direction'', int ''maxPacketSize'', int ''interval'', int ''?'', int ''configIndex'' || void* ''pipe''
 
|-
 
|-
 
| 11 || commitConfiguration || - || -
 
| 11 || commitConfiguration || - || -
Line 33: Line 33:
 
| 12 || setAlternateSetting || uint8_t ''configIndex'' || -
 
| 12 || setAlternateSetting || uint8_t ''configIndex'' || -
 
|-
 
|-
| 13 || readPipe || ? || ?
+
| 13 || readPipe (may be async) || void* ''pipe'', uint64_t ''mapToken'', long ''capacity'' || long ''length''
 
|-
 
|-
| 14 || writePipe || ? || ?
+
| 14 || writePipe (may be async) || ? || ?
 
|-
 
|-
 
| 15 || stallPipe || void* ''pipe'' || -
 
| 15 || stallPipe || void* ''pipe'' || -
Line 43: Line 43:
 
| 17 || getPipeCurrentMaxPacketSize || void* ''pipe'' || int ''packetSize''
 
| 17 || getPipeCurrentMaxPacketSize || void* ''pipe'' || int ''packetSize''
 
|-
 
|-
| 18 || createData || ? || ?
+
| 18 || createData || int64_t ''length'' || uint8_t* ''dataPtr'', int ''capacity'', uint64_t ''mapToken''
 
|-
 
|-
 
| 19 || releaseDataCallback || ? || -
 
| 19 || releaseDataCallback || ? || -
 
|-
 
|-
| 20 || isActivated || - || bool ''?'' , bool ''?''
+
| 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.
 +
 +
<source lang="c">
 +
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, ...);
 +
</source>
 +
 +
The same applies to calling readPipe asynchronously, but the 3rd argument becomes "size_t ''dataLength''".
  
 
== IOUSBDeviceLib ==
 
== IOUSBDeviceLib ==
  
'''IOUSBDeviceLib''' is a userland COM plug-in for accessing the IOUSBDeviceInterface.
+
'''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}.
 +
 
  
  
 
{{occlass|library=IOKit.framework|navbox=1}}
 
{{occlass|library=IOKit.framework|navbox=1}}

Latest revision as of 09:22, 26 December 2010

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}.