2011/1/30 Benno Meier <meier.be...@googlemail.com>:
> Hi there,
>
> I just started to use PyUSB and want to talk to an AVR.
>
> I ran into a problem with the ctrl_transfer method, here is my listing:
>
> import usb.core
> import usb.util
>
>
> vendorID = 0x16c0
> productID = 0x05dc
> dev = usb.core.find(idVendor=vendorID, idProduct=productID)
>
> if dev is None:
>    raise ValueError('Device not found')
> else:
>    print('Device found')
>
> dev.set_configuration()
>
> #try to get the Firmware
> bmRequestType = usb.util.CTRL_TYPE_VENDOR |
> usb.util.CTRL_RECIPIENT_DEVICE | usb.util.CTRL_IN
>
> firmware = dev.ctrl_transfer(bmRequestType, 0x00, 0x0e00, 0,
> data_or_wLength = 2, timeout = 500)
>
>> In [61]: firmware
>> Out[61]: array('B', [0])
>
> The code runs fine, but the firmware contains only one byte, although it 
> should contain two. Is the code buggy?
>
It doesn't look like your code is buggy. Probably, for some reason,
the fw has only one byte to send, despite the fact you are requesing
2.

>
>
>
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> pyusb-users mailing list
> pyusb-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyusb-users
>



-- 
Best Regards,
Wander Lairson Costa
LCoN - Laboratório de Computação Natural - Natural Computing Laboratory
(http://www.mackenzie.com.br/lcon.html)
Programa de Pós-Graduação em Engenharia Elétrica (PPGEE)
Faculdade de Computação e Informática (FCI)
Universidade Presbiteriana Mackenzie - SP - Brazil

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to