From: Ralf B. <ral...@gm...> - 2008-12-10 16:49:31
|
Hi, I'm trying to talk with an eMagin Z800 HMD (HID device) via usb on OS X 10.4 (later also on linux). The necessary information comes directly from the eMagin SDK, so that I know what commands the device is expecting. I also created an empty kext a while ago that keeps OS X of opening the device exclusively (though I don't know if it's important). My problem is that there is no reaction from the device. For a start I try to put it in sleep and to wake it up, but obviously it doesn't work. I checked with another example that I wrote a while ago in C++ (though I don't know C++, but I copied a lot of example code from Apples IOKit documentation) that is capable of doing what I want to do. So I checked and it's working, but it's not working when I have claimed the interface with PyUSB. I take this as a prove that the connection (via PyUSB) to the device is successfully established (I can also read from the device). In the python script that I wrote I did basically the same as what happened in the C++ code. It's the same device, configuration, interface, endpoints ... everything should be the same. But I cannot make it do what I want, so I think it will be just a lack of knowledge on my side. But it surprised me, that it doesn't work as I expected, given the fact that I even managed to make it work in C++ ;-) Here is what I try to write to the interrupt endpoint: buffer = ([0,] * 64) buffer[0] = cmd buffer[1] = 0 result = self.write(buffer) cmd is on of: cmdSleep = 0x85 cmdWake = 0x8A cmdBrightness = 0x88 (eMagin SDK) The write method is taken from the usbprint.py sample of PyUSB, just a little bit adapted: def write(self, buffer, timeout = 100): return self.handle.interruptWrite(self.ep_out.address, buffer, timeout) ep_out is an endpoint object. When I print out the result I see that 64 Bytes have been written. But there is no reaction from the device. No errors neither. I'm not a great expert on python, usb or data types, so I hope there's something obvious that I'm missing. If you need more information to be able to understand the problem, I will give it gladly on demand of course. thanks for reading, Ralf |