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 <[EMAIL PROTECTED]> wrote:

> From: Christopher Moore <[EMAIL PROTECTED]>
> Subject: [Pyusb-users] Newbie Question
> To: pyusb-users@lists.sourceforge.net
> 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
> Pyusb-users@lists.sourceforge.net
> 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
Pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to