Handles a message from the userspace IOHIDDeviceInterface122::setReport function
| 82 | |
| 83 | // Handles a message from the userspace IOHIDDeviceInterface122::setReport function |
| 84 | IOReturn Xbox360ControllerClass::setReport(IOMemoryDescriptor *report,IOHIDReportType reportType,IOOptionBits options) |
| 85 | { |
| 86 | char data[2]; |
| 87 | |
| 88 | report->readBytes(0, data, 2); |
| 89 | if (GetOwner(this)->rumbleType == 1) // Don't Rumble |
| 90 | return kIOReturnSuccess; |
| 91 | switch(data[0]) { |
| 92 | case 0x00: // Set force feedback |
| 93 | if((data[1]!=report->getLength()) || (data[1]!=0x04)) return kIOReturnUnsupported; |
| 94 | { |
| 95 | XBOX360_OUT_RUMBLE rumble; |
| 96 | |
| 97 | Xbox360_Prepare(rumble,outRumble); |
| 98 | report->readBytes(2,data,2); |
| 99 | rumble.big=data[0]; |
| 100 | rumble.little=data[1]; |
| 101 | GetOwner(this)->QueueWrite(&rumble,sizeof(rumble)); |
| 102 | // IOLog("Set rumble: big(%d) little(%d)\n", rumble.big, rumble.little); |
| 103 | } |
| 104 | return kIOReturnSuccess; |
| 105 | case 0x01: // Set LEDs |
| 106 | if((data[1]!=report->getLength())||(data[1]!=0x03)) return kIOReturnUnsupported; |
| 107 | { |
| 108 | XBOX360_OUT_LED led; |
| 109 | |
| 110 | report->readBytes(2,data,1); |
| 111 | Xbox360_Prepare(led,outLed); |
| 112 | led.pattern=data[0]; |
| 113 | GetOwner(this)->QueueWrite(&led,sizeof(led)); |
| 114 | // IOLog("Set LED: %d\n", led.pattern); |
| 115 | } |
| 116 | return kIOReturnSuccess; |
| 117 | default: |
| 118 | IOLog("Unknown escape %d\n", data[0]); |
| 119 | return kIOReturnUnsupported; |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | // Get report |
| 124 | IOReturn Xbox360ControllerClass::getReport(IOMemoryDescriptor *report,IOHIDReportType reportType,IOOptionBits options) |
nothing calls this directly
no test coverage detected