Path: csiph.com!usenet.pasdenom.info!gegeweb.org!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'python': 0.09; '(although': 0.09; 'read()': 0.09; 'timeout': 0.09; 'timeout)': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr :python-list': 0.10; 'size,': 0.13; '"2"': 0.16; 'doing,': 0.16; 'for,': 0.16; 'none]': 0.16; 'otoh,': 0.16; 'status.': 0.16; 'written.': 0.16; 'wrote:': 0.17; 'bytes': 0.17; 'char': 0.17; 'obviously': 0.18; '>>>': 0.18; '(or': 0.18; 'skip:" 40': 0.20; 'suggested': 0.20; 'sort': 0.21; '"",': 0.22; 'wednesday,': 0.22; 'cc:2**0': 0.23; 'seems': 0.23; 'raise': 0.24; 'cc:no real name:2**0': 0.24; 'command': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'skip:[ 10': 0.26; '(most': 0.27; 'skip:" 50': 0.27; 'correct': 0.28; 'pertinent': 0.29; 'subject:Sending': 0.29; "i'm": 0.29; 'returned': 0.30; 'asking': 0.32; 'file': 0.32; 'skip:s 30': 0.33; 'avoiding': 0.33; 'traceback': 0.33; 'guys': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'feed': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'subject:with': 0.36; 'should': 0.36; 'being': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'behind': 0.38; 'some': 0.38; 'sure': 0.38; 'think': 0.40; 'your': 0.60; 'skip:u 10': 0.60; 'more': 0.63; 'issued': 0.65; 'august': 0.66; '301,': 0.84; 'endeavor': 0.84; 'printer': 0.84; 'subject:commands': 0.84; 'dennis': 0.91 Newsgroups: comp.lang.python Date: Wed, 29 Aug 2012 14:21:30 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.80.107.197; posting-account=hEeMqAoAAAAN2L2NtWcUUUG7LStm2lEM References: <09ec368e-9079-46dc-a70a-3ae345d7996c@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 69.80.107.197 MIME-Version: 1.0 Subject: Re: Sending USB commands with Python From: "Adam W." To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 52 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346275293 news.xs4all.nl 6985 [2001:888:2000:d::a6]:59192 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28072 On Wednesday, August 29, 2012 4:09:49 PM UTC-4, Dennis Lee Bieber wrote: > > Don't the commands require an character? "\x1BA" (or > "\x1B\x41") >=20 > OTOH, if the is issued behind the scenes, I'm not sure which esc char it is asking for, I don't think libusb is provi= ding its own, and it seems like the one you suggested isn't what it wants e= ither.. > ... and you do not need to issue some sort of read() > the "2" you are seeing is the "number of bytes written"; >=20 > you need to issue a read request to retrieve the returned printer >=20 > status. >=20 You are correct about the 2 being the number of bytes written. However whe= n I issue a read command I get: >>> ep.write('\x1BA') 4 >>> ep.read(1) Traceback (most recent call last): File "", line 1, in 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, ti= meout) 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, i= n bulk_read timeout) File "C:\Python32\lib\site-packages\usb\backend\libusb01.py", line 568, i= n __read timeout File "C:\Python32\lib\site-packages\usb\backend\libusb01.py", line 384, i= n _check raise USBError(errmsg, ret) usb.core.USBError: [Errno None] b'libusb0-dll:err [_usb_setup_async] invali= d endpoint 0x02\n' Avoiding the read command all together I should be able to write " E" = and have it feed some paper, which it is not doing, so obviously there is m= ore to uncover. That said I feel this endeavor has evolved and is no longe= r 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!