Jag lägger för närvarande in lite kod i applikationen (plugin för EventGhost) för att detektera när man kopplar ur/in en TellStick (Duo i detta fall) till USB porten. Det fungerar så tillvida att jag får in controller events via callback funtionen.
Skulle behöva hjälp med tolkningen av dessa, tycker inte att jag hittar info i header filerna...
Så här ser det ut, följande förenklade test python kod erhåller eventen via callback och utvärderar
Code: Select all
def controllerEventCallback(self, controllerId, changeEvent, changeType, p1, i3, p2):
self.controller = []
self.controller.append(controllerId)
self.controller.append(changeEvent)
self.controller.append(changeType)
self.controller.append(string_at(p1))
self.controller.append(i3)
self.controller.append(p2)
print self.controller
Code: Select all
2015-02-12 21:21:18 EVENT: System.DeviceRemoved [u'\\\\?\\USB#VID_1781&PID_0C31#8&3c70f5f&0&2#{a5dcbf10-6530-11d2-901f-00c04fb951ed}']
2015-02-12 21:21:18 [1, 4, 5, '0', 5, None]
2015-02-12 21:21:18 TellStickDuo.Communication with controller is down
.
.
.
2015-02-12 21:21:32 EVENT: System.DeviceAttached [u'\\\\?\\USB#VID_1781&PID_0C31#8&3c70f5f&0&2#{a5dcbf10-6530-11d2-901f-00c04fb951ed}']
2015-02-12 21:21:32 [1, 4, 5, '1', 5, None]
2015-02-12 21:21:34 [1, 2, 6, '12', 5, None]
2015-02-12 21:21:34 TellStickDuo.Communication with controller is up
Code: Select all
typedef void (WINAPI *TDControllerEvent)(int controllerId, int changeEvent, int changeType, const char *newValue, int callbackId, void *context);
Code: Select all
int controllerId alltid 1 i mitt fall
int changeEvent 4 urkopplad sticka, 2 inkopplad
int changeType 5 urkopplad, 6 inkopplad
const char *newValue 0 urkopplad, 1 inkoppling pågår ???, 12 inkopplad och i drift ???
int callbackId 5 i detta fall
void *context None