Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28075

Re: Sending USB commands with Python

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: Sending USB commands with Python
Date 2012-08-29 17:57 -0400
Organization > Bestiaria Support Staff <
References <ff6f931d-e5ad-40ee-aa4d-f2bbd1303046@googlegroups.com> <d8er38h4ns0obmhevo4v12u0qk2rhufeu8@4ax.com> <09ec368e-9079-46dc-a70a-3ae345d7996c@googlegroups.com> <mailman.3942.1346270988.4697.python-list@python.org> <7507d1a4-62ba-46a9-8c6f-fe0ac9dcac5c@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.3945.1346277475.4697.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, 29 Aug 2012 14:21:30 -0700 (PDT), "Adam W."
<AWasilenko@gmail.com> declaimed the following in
gmane.comp.python.general:

> You are correct about the 2 being the number of bytes written.  However when I issue a read command I get:
> 
> >>> ep.write('\x1BA')
> 4

	That's interesting -- as if each byte you send is expanding into a
pair of bytes.

> >>> ep.read(1)
> Traceback (most recent call last):
>   File "<pyshell#75>", line 1, in <module>
>     ep.read(1)
>   File "C:\Python32\lib\site-packages\usb\core.py", line 301, in read
>     return self.device.read(self.bEndpointAddress, size, self.interface, timeout)
>   File "C:\Python32\lib\site-packages\usb\core.py", line 654, in read
>     self.__get_timeout(timeout)
>   File "C:\Python32\lib\site-packages\usb\backend\libusb01.py", line 483, in bulk_read
>     timeout)
>   File "C:\Python32\lib\site-packages\usb\backend\libusb01.py", line 568, in __read
>     timeout
>   File "C:\Python32\lib\site-packages\usb\backend\libusb01.py", line 384, in _check
>     raise USBError(errmsg, ret)
> usb.core.USBError: [Errno None] b'libusb0-dll:err [_usb_setup_async] invalid endpoint 0x02\n'
> 
> Avoiding the read command all together I should be able to write "<esc> E" and have it feed some paper, which it is not doing, so obviously there is more to uncover.  That said I feel this endeavor has evolved and is no longer pertinent to the Python group so I will let you guys off the hook on this (although responses/suggestions are still welcome).
> 

	Your original code shows you matching to an "OUT" endpoint... Could
you need an "IN" to read the return values?

	Unfortunately it will be a few weeks before Amazon ships "USB
Complete" so most of the setup hassle is currently just noise to me.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Sending USB commands with Python "Adam W." <AWasilenko@gmail.com> - 2012-08-28 17:04 -0700
  Re: Sending USB commands with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-28 22:54 -0400
    Re: Sending USB commands with Python hamilton <hamilton@nothere.com> - 2012-08-28 21:03 -0600
      Re: Sending USB commands with Python alex23 <wuwei23@gmail.com> - 2012-08-28 22:04 -0700
        Re: Sending USB commands with Python hamilton <hamilton@nothere.com> - 2012-08-28 23:18 -0600
  Re: Sending USB commands with Python Tim Roberts <timr@probo.com> - 2012-08-28 23:45 -0700
    Re: Sending USB commands with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-29 16:09 -0400
      Re: Sending USB commands with Python "Adam W." <AWasilenko@gmail.com> - 2012-08-29 14:21 -0700
        Re: Sending USB commands with Python Tim Roberts <timr@probo.com> - 2012-08-30 20:55 -0700
      Re: Sending USB commands with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-29 17:57 -0400

csiph-web