Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28072
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2012-08-29 14:21 -0700 |
| 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> |
| Subject | Re: Sending USB commands with Python |
| From | "Adam W." <AWasilenko@gmail.com> |
| Message-ID | <mailman.3943.1346275293.4697.python-list@python.org> (permalink) |
On Wednesday, August 29, 2012 4:09:49 PM UTC-4, Dennis Lee Bieber wrote:
>
> Don't the commands require an <esc> character? "\x1BA" (or
> "\x1B\x41")
>
> OTOH, if the <esc> is issued behind the scenes,
I'm not sure which esc char it is asking for, I don't think libusb is providing its own, and it seems like the one you suggested isn't what it wants either..
> ... and you do not need to issue some sort of read()
> the "2" you are seeing is the "number of bytes written";
>
> you need to issue a read request to retrieve the returned printer
>
> status.
>
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
>>> 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).
Thanks for all your help!
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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