Out of the box, the Uno should enumerate as a USB-serial / CDC device.
You'll need to make sure the kernel doesn't have control over the device
before trying to talk to it.
Call device.detach_kernel_driver() before device.set_configuration().
Also, I might recommend pySerial over pyUSB for talking to the Arduino.
Best,
--
Ian
On Sat, Nov 5, 2011 at 21:13, George Wright <georg...@bigpond.net.au> wrote:
> Hi
> My first try at beginning a dialogue with an Arduino Uno board via pyusb.
> I can find it but can't set_configuration()
> Has anyone had success with this?
>
>
> Last login: Sun Nov 6 08:49:19 on ttys000
> geomacbk:~ georgewr$ python
> Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
> [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import usb.core
> >>> import usb.util
> >>> #These vendor & product ids are for the arduino UNO. Location ID:
> 0x1d100000 / 2
> ... device = usb.core.find(idVendor=0x2341, idProduct=0x0001)
> >>> device
> <usb.core.Device object at 0x100637dd0>
> >>> device.set_configuration()
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/Library/Python/2.6/site-packages/usb/core.py", line 530, in
> set_configuration
> self._ctx.managed_set_configuration(self, configuration)
> File "/Library/Python/2.6/site-packages/usb/core.py", line 92, in
> managed_set_configuration
> self.backend.set_configuration(self.handle, cfg.bConfigurationValue)
> File "/Library/Python/2.6/site-packages/usb/_debug.py", line 52, in
> do_trace
> return f(*args, **named_args)
> File "/Library/Python/2.6/site-packages/usb/backend/libusb10.py", line
> 455, in set_configuration
> _check(_lib.libusb_set_configuration(dev_handle, config_value))
> File "/Library/Python/2.6/site-packages/usb/backend/libusb10.py", line
> 357, in _check
> raise USBError(_str_error[retval.value])
> usb.core.USBError: No such device (it may have been disconnected)
> >>>
>
>
> George Wright
> georg...@bigpond.net.au
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
> _______________________________________________
> pyusb-users mailing list
> pyusb-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyusb-users
>
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users