From: Christopher M. <chr...@bn...> - 2008-09-02 23:51:09
|
Hey everyone, I'm trying to write my first program with pyUSB. I have already figured out how to identify my device, open it, add it to a handle, close it and claim it's interface. Here's my situation: The kernel recognizes my device ( a linksys cit200) as a device already and it actually shows up as a plughw device. The problem is the device is not "activated" My question is, do I have to claimInterface this device to send/receive signals to it? For now, I just want to see if I can "enable/activate" it, so the mic/speaker will work on the thing. Right now, in order for me to claim the interface, I have to detachKernelDriver each interface (there are 4 of them, 3 alsa/sound, 1 hid), then setConfiguration, then claimInterface. In doing so, I lose ... it showing up as those devices. Example Code: --------------------------------------------- import usb # linksys CIT200 Device Info vendor_id = 5041 product_id = 29 buses = usb.busses() for bus in buses : for device in bus.devices : if device.idVendor == vendor_id : if device.idProduct == product_id : # found the CIT200 linksys = device # open device handle = linksys.open() # setup interface and configs ... there are 4 interfaces for this device... config = linksys.configurations[0] interface = config.interfaces[0][0] # detach kernel drivers handle.detachKernelDriver(0) handle.detachKernelDriver(1) handle.detachKernelDriver(2) handle.detachKernelDriver(3) # set configuration and claim interface(s?) handle.setConfiguration(config) handle.claimInterface(interface) handle.setAltInterface(interface) --------------------------------------------- Any help would be appreciated. I will probably have a few more questions to follow :) Thanks |
From: Christopher M. <chr...@bn...> - 2008-09-02 23:58:36
|
Hey everyone, I'm trying to write my first program with pyUSB. I have already figured out how to identify my device, open it, add it to a handle, close it and claim it's interface. Here's my situation: The kernel recognizes my device ( a linksys cit200) as a device already and it actually shows up as a plughw device. The problem is the device is not "activated" My question is, do I have to claimInterface this device to send/receive signals to it? For now, I just want to see if I can "enable/activate" it, so the mic/speaker will work on the thing. Right now, in order for me to claim the interface, I have to detachKernelDriver each interface (there are 4 of them, 3 alsa/sound, 1 hid), then setConfiguration, then claimInterface. In doing so, I lose ... it showing up as those devices. Example Code: --------------------------------------------- import usb # linksys CIT200 Device Info vendor_id = 5041 product_id = 29 buses = usb.busses() for bus in buses : for device in bus.devices : if device.idVendor == vendor_id : if device.idProduct == product_id : # found the CIT200 linksys = device # open device handle = linksys.open() # setup interface and configs ... there are 4 interfaces for this device... config = linksys.configurations[0] interface = config.interfaces[0][0] # detach kernel drivers handle.detachKernelDriver(0) handle.detachKernelDriver(1) handle.detachKernelDriver(2) handle.detachKernelDriver(3) # set configuration and claim interface(s?) handle.setConfiguration(config) handle.claimInterface(interface) handle.setAltInterface(interface) --------------------------------------------- Any help would be appreciated. I will probably have a few more questions to follow :) Thanks |
From: Sarah M. <iku...@ya...> - 2008-09-04 00:49:51
|
ideally, you should be able to download a driver for this thing, and that'll do the read/write stuff automatically... check the manufacturer's website & tech support FIRST. If you're trying to write a driver, or otherwise want to hack into the device so that it interfaces nicely with another program, you'll need detailed spec's on how the USB interface is supposed to work. Start with the USB 2.0 specification at http://www.usb.org/developers/docs/ You should also see if the manufacturer has a "Programmer Manual" or some such available. You shouldn't need claimInterface() or Once you've got that, use the pyusb controlMsg() commands (see http://wiki.erazor-zone.de/wiki:projects:python:pyusb:pydoc ) to pull out the device's bDeviceClass, bDeviceSubClass, and bDeviceProtocol. (The table for conversion between the bDeviceClass number and the natural-language class name is on the same USB.org documentation page.) Then look up the spec's for those at the USB.org page above. Those will tell you the formats this device requires for read/write commands to do things which a user might find interesting / useful. -Sarah --- On Tue, 9/2/08, Christopher Moore <chr...@bn...> wrote: > From: Christopher Moore <chr...@bn...> > Subject: [Pyusb-users] Newbie Question > To: pyu...@li... > Date: Tuesday, September 2, 2008, 6:58 PM > Hey everyone, > > I'm trying to write my first program with pyUSB. I > have already figured > out how to identify my device, open it, add it to a handle, > close it and > claim it's interface. > > Here's my situation: > > The kernel recognizes my device ( a linksys cit200) as a > device already > and it actually shows up as a plughw device. The problem > is the device is > not "activated" My question is, do I have to > claimInterface this device > to send/receive signals to it? For now, I just want to see > if I can > "enable/activate" it, so the mic/speaker will > work on the thing. > > Right now, in order for me to claim the interface, I have > to > detachKernelDriver each interface (there are 4 of them, 3 > alsa/sound, 1 > hid), then setConfiguration, then claimInterface. In doing > so, I lose ... > it showing up as those devices. > > > Example Code: > --------------------------------------------- > import usb > > # linksys CIT200 Device Info > vendor_id = 5041 > product_id = 29 > > buses = usb.busses() > > for bus in buses : > for device in bus.devices : > if device.idVendor == vendor_id : > if device.idProduct == product_id : > # found the CIT200 > linksys = device > > # open device > handle = linksys.open() > > > # setup interface and configs ... there are 4 interfaces > for this device... > config = linksys.configurations[0] > interface = config.interfaces[0][0] > > # detach kernel drivers > handle.detachKernelDriver(0) > handle.detachKernelDriver(1) > handle.detachKernelDriver(2) > handle.detachKernelDriver(3) > > # set configuration and claim interface(s?) > handle.setConfiguration(config) > handle.claimInterface(interface) > handle.setAltInterface(interface) > --------------------------------------------- > > > Any help would be appreciated. I will probably have a few > more questions > to follow :) > > Thanks > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge > Build the coolest Linux based applications with Moblin SDK > & win great prizes > Grand prize is a trip for two to an Open Source event > anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Pyusb-users mailing list > Pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users |
From: Christopher M. <chr...@bn...> - 2008-09-04 02:44:03
|
> ideally, you should be able to download a driver for this thing, and > that'll do the read/write stuff automatically... check the manufacturer's > website & tech support FIRST. Unfortunately this device only has windows drivers. I can successfully use it through a vmware window (I'm in linux). Unfortunately the manufacturer has nothing on their page at all about USB specs for this thing and from what I've been reading around on the internet, haven't been replying with the information either. > > If you're trying to write a driver, or otherwise want to hack into the > device so that it interfaces nicely with another program, you'll need > detailed spec's on how the USB interface is supposed to work. Start with > the USB 2.0 specification at http://www.usb.org/developers/docs/ > > You should also see if the manufacturer has a "Programmer Manual" or some > such available. You shouldn't need claimInterface() or I wish they did, I have gone through and run usbsnoop (in windows). I just figured out what it's doing now. Now I have to figure out how to get the data into a controlMsg command. > > Once you've got that, use the pyusb controlMsg() commands (see > http://wiki.erazor-zone.de/wiki:projects:python:pyusb:pydoc > ) > to pull out the device's bDeviceClass, bDeviceSubClass, and > bDeviceProtocol. (The table for conversion between the bDeviceClass > number and the natural-language class name is on the same USB.org > documentation page.) cool. I'll check that out. > Then look up the spec's for those at the USB.org page above. Those will > tell you the formats this device requires for read/write commands to do > things which a user might find interesting / useful. > > -Sarah > Thanks Sarah, I'm getting there with everyone's help (this forum and libusb have been great so far - and I've only posted 1 day ago). Just a general update. This is what I've been able to figure out so far: I now know that interface #3 is the HID device on this phone. >From what I gather from my "initialization log": 1) After 2 sets of information are sent?(it says - USBD_TRANSFER_DIRECTION_OUT ), setup packets are sent. 2) Some more data is sent received by the device (USBD_TRANSFER_DIRECTION_IN) via the endpoint (83) of the HID interface, the 2 audio interfaces have their configurations loaded. 3) #1 is repeated again 4) #2 is repeated, except the TransferMDL values are different. Now I just have to figure out exactly what this means (I'll look at those usb docs) and then piece that together into some controlMsg strings. Will I have to read back the interrupts after I send a control message? I've seen this in an example I came across from somewhere. Is the purpose of this to get a return on the status of the controlMsg command? Thanks. > > --- On Tue, 9/2/08, Christopher Moore <chr...@bn...> wrote: > >> From: Christopher Moore <chr...@bn...> >> Subject: [Pyusb-users] Newbie Question >> To: pyu...@li... >> Date: Tuesday, September 2, 2008, 6:58 PM >> Hey everyone, >> >> I'm trying to write my first program with pyUSB. I >> have already figured >> out how to identify my device, open it, add it to a handle, >> close it and >> claim it's interface. >> >> Here's my situation: >> >> The kernel recognizes my device ( a linksys cit200) as a >> device already >> and it actually shows up as a plughw device. The problem >> is the device is >> not "activated" My question is, do I have to >> claimInterface this device >> to send/receive signals to it? For now, I just want to see >> if I can >> "enable/activate" it, so the mic/speaker will >> work on the thing. >> >> Right now, in order for me to claim the interface, I have >> to >> detachKernelDriver each interface (there are 4 of them, 3 >> alsa/sound, 1 >> hid), then setConfiguration, then claimInterface. In doing >> so, I lose ... >> it showing up as those devices. >> >> >> Example Code: >> --------------------------------------------- >> import usb >> >> # linksys CIT200 Device Info >> vendor_id = 5041 >> product_id = 29 >> >> buses = usb.busses() >> >> for bus in buses : >> for device in bus.devices : >> if device.idVendor == vendor_id : >> if device.idProduct == product_id : >> # found the CIT200 >> linksys = device >> >> # open device >> handle = linksys.open() >> >> >> # setup interface and configs ... there are 4 interfaces >> for this device... >> config = linksys.configurations[0] >> interface = config.interfaces[0][0] >> >> # detach kernel drivers >> handle.detachKernelDriver(0) >> handle.detachKernelDriver(1) >> handle.detachKernelDriver(2) >> handle.detachKernelDriver(3) >> >> # set configuration and claim interface(s?) >> handle.setConfiguration(config) >> handle.claimInterface(interface) >> handle.setAltInterface(interface) >> --------------------------------------------- >> >> >> Any help would be appreciated. I will probably have a few >> more questions >> to follow :) >> >> Thanks >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move >> Developer's challenge >> Build the coolest Linux based applications with Moblin SDK >> & win great prizes >> Grand prize is a trip for two to an Open Source event >> anywhere in the world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> Pyusb-users mailing list >> Pyu...@li... >> https://lists.sourceforge.net/lists/listinfo/pyusb-users > > > > > |
From: Wander L. <wan...@gm...> - 2008-09-03 18:51:45
|
What do you mean by "not activated", does any write or read operation raise an exception? Wander 2008/9/2 Christopher Moore <chr...@bn...>: > Hey everyone, > > I'm trying to write my first program with pyUSB. I have already figured > out how to identify my device, open it, add it to a handle, close it and > claim it's interface. > > Here's my situation: > > The kernel recognizes my device ( a linksys cit200) as a device already > and it actually shows up as a plughw device. The problem is the device is > not "activated" My question is, do I have to claimInterface this device > to send/receive signals to it? For now, I just want to see if I can > "enable/activate" it, so the mic/speaker will work on the thing. > > Right now, in order for me to claim the interface, I have to > detachKernelDriver each interface (there are 4 of them, 3 alsa/sound, 1 > hid), then setConfiguration, then claimInterface. In doing so, I lose ... > it showing up as those devices. > > > Example Code: > --------------------------------------------- > import usb > > # linksys CIT200 Device Info > vendor_id = 5041 > product_id = 29 > > buses = usb.busses() > > for bus in buses : > for device in bus.devices : > if device.idVendor == vendor_id : > if device.idProduct == product_id : > # found the CIT200 > linksys = device > > # open device > handle = linksys.open() > > > # setup interface and configs ... there are 4 interfaces for this device... > config = linksys.configurations[0] > interface = config.interfaces[0][0] > > # detach kernel drivers > handle.detachKernelDriver(0) > handle.detachKernelDriver(1) > handle.detachKernelDriver(2) > handle.detachKernelDriver(3) > > # set configuration and claim interface(s?) > handle.setConfiguration(config) > handle.claimInterface(interface) > handle.setAltInterface(interface) > --------------------------------------------- > > > Any help would be appreciated. I will probably have a few more questions > to follow :) > > Thanks > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Pyusb-users mailing list > Pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users > |
From: Christopher M. <chr...@bn...> - 2008-09-03 19:03:59
|
I mean, if I do aplay -D plughw:CIT200,0 somewav.wav, nothing plays ... nor does arecord. I sent an email to libusb as well. It seems that there's an HID interface on this device that I need to talk to. Once I figure that out (I'm reading the hid docs as we speak), I would just "claim" that interface and send/recieve commands there. *** fingers crossed ... that should make it work. Because the kernel already detects the devices properly (as sound and hid ), I suppose they're already "active". I just need to figure out how to talk to them. > What do you mean by "not activated", does any write or read operation > raise an exception? > > Wander > > 2008/9/2 Christopher Moore <chr...@bn...>: >> Hey everyone, >> >> I'm trying to write my first program with pyUSB. I have already figured >> out how to identify my device, open it, add it to a handle, close it and >> claim it's interface. >> >> Here's my situation: >> >> The kernel recognizes my device ( a linksys cit200) as a device already >> and it actually shows up as a plughw device. The problem is the device >> is >> not "activated" My question is, do I have to claimInterface this device >> to send/receive signals to it? For now, I just want to see if I can >> "enable/activate" it, so the mic/speaker will work on the thing. >> >> Right now, in order for me to claim the interface, I have to >> detachKernelDriver each interface (there are 4 of them, 3 alsa/sound, 1 >> hid), then setConfiguration, then claimInterface. In doing so, I lose >> ... >> it showing up as those devices. >> >> >> Example Code: >> --------------------------------------------- >> import usb >> >> # linksys CIT200 Device Info >> vendor_id = 5041 >> product_id = 29 >> >> buses = usb.busses() >> >> for bus in buses : >> for device in bus.devices : >> if device.idVendor == vendor_id : >> if device.idProduct == product_id : >> # found the CIT200 >> linksys = device >> >> # open device >> handle = linksys.open() >> >> >> # setup interface and configs ... there are 4 interfaces for this >> device... >> config = linksys.configurations[0] >> interface = config.interfaces[0][0] >> >> # detach kernel drivers >> handle.detachKernelDriver(0) >> handle.detachKernelDriver(1) >> handle.detachKernelDriver(2) >> handle.detachKernelDriver(3) >> >> # set configuration and claim interface(s?) >> handle.setConfiguration(config) >> handle.claimInterface(interface) >> handle.setAltInterface(interface) >> --------------------------------------------- >> >> >> Any help would be appreciated. I will probably have a few more >> questions >> to follow :) >> >> Thanks >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's >> challenge >> Build the coolest Linux based applications with Moblin SDK & win great >> prizes >> Grand prize is a trip for two to an Open Source event anywhere in the >> world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> Pyusb-users mailing list >> Pyu...@li... >> https://lists.sourceforge.net/lists/listinfo/pyusb-users >> > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the > world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Pyusb-users mailing list > Pyu...@li... > https://lists.sourceforge.net/lists/listinfo/pyusb-users > > |