Hi again, short update: I just managed to make it work. For reasons I don't understand it was sufficient to add a read request directly after the write. So now my methods are like this:
def sendCommand(self, cmd): buffer = ([0,] * 2) buffer[0] = cmd buffer[1] = 0 self.write(buffer) return self.read(64) def write(self, buffer, timeout = 100): return self.handle.interruptWrite(self.ep_out.address, buffer, timeout) The device is reacting and I can finally go home ;-) But if you have any recommendations or critic on the way I do it, it would interest me anyway! best regards, Ralf Am 10.12.2008 um 17:50 schrieb Ralf Baumbach: > 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 ------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ _______________________________________________ Pyusb-users mailing list Pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users