Start up the driver
| 102 | |
| 103 | // Start up the driver |
| 104 | bool WirelessHIDDevice::handleStart(IOService *provider) |
| 105 | { |
| 106 | WirelessDevice *device; |
| 107 | IOWorkLoop *workloop; |
| 108 | |
| 109 | if (!super::handleStart(provider)) |
| 110 | goto fail; |
| 111 | |
| 112 | device = OSDynamicCast(WirelessDevice, provider); |
| 113 | if (device == NULL) |
| 114 | goto fail; |
| 115 | |
| 116 | serialTimerCount = 0; |
| 117 | |
| 118 | serialTimer = IOTimerEventSource::timerEventSource(this, ChatPadTimerActionWrapper); |
| 119 | if (serialTimer == NULL) |
| 120 | { |
| 121 | IOLog("start - failed to create timer for chatpad\n"); |
| 122 | goto fail; |
| 123 | } |
| 124 | workloop = getWorkLoop(); |
| 125 | if ((workloop == NULL) || (workloop->addEventSource(serialTimer) != kIOReturnSuccess)) |
| 126 | { |
| 127 | IOLog("start - failed to connect timer for chatpad\n"); |
| 128 | goto fail; |
| 129 | } |
| 130 | |
| 131 | device->RegisterWatcher(this, _receivedData, NULL); |
| 132 | |
| 133 | device->SendPacket(weirdStart, sizeof(weirdStart)); |
| 134 | |
| 135 | serialTimer->setTimeoutMS(1000); |
| 136 | |
| 137 | return true; |
| 138 | |
| 139 | fail: |
| 140 | return false; |
| 141 | } |
| 142 | |
| 143 | // Shut down the driver |
| 144 | void WirelessHIDDevice::handleStop(IOService *provider) |
nothing calls this directly
no test coverage detected