Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28081
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <AWasilenko@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'explicitly': 0.04; 'string.': 0.04; 'subject:Python': 0.05; 'that?': 0.05; 'python': 0.09; 'input,': 0.09; 'observation': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'modification': 0.15; "'b'": 0.16; 'guys,': 0.16; 'lambda': 0.16; 'spit': 0.16; 'there?': 0.16; 'wrote:': 0.17; 'byte': 0.17; 'unicode': 0.17; '>>>': 0.18; '3.x': 0.22; 'interpret': 0.22; 'progress.': 0.22; 'wednesday,': 0.22; 'cc:2**0': 0.23; 'seems': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'coding': 0.27; 'guess': 0.27; 'skip:e 30': 0.27; 'received:209.85.212': 0.28; 'declared': 0.29; 'subject:Sending': 0.29; 'manual': 0.29; 'venture': 0.33; 'anyone': 0.33; 'received:google.com': 0.34; 'text': 0.34; 'thanks': 0.34; 'received:209.85': 0.35; 'there': 0.35; 'skip:u 20': 0.36; 'but': 0.36; 'subject:with': 0.36; 'should': 0.36; 'possible': 0.37; 'why': 0.37; 'rather': 0.37; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'where': 0.40; 'help': 0.40; 'your': 0.60; 'needing': 0.62; 'fun': 0.64; 'talking': 0.66; 'august': 0.66; 'paper': 0.78; 'about,': 0.84; 'me!': 0.84; 'printer': 0.84; 'subject:commands': 0.84; 'dennis': 0.91; 'received:209.85.212.56': 0.91 |
| Newsgroups | comp.lang.python |
| Date | Wed, 29 Aug 2012 16:45:10 -0700 (PDT) |
| In-Reply-To | <mailman.3947.1346280975.4697.python-list@python.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=69.80.107.197; posting-account=hEeMqAoAAAAN2L2NtWcUUUG7LStm2lEM |
| References | <eq3t38542luf3dmula4k92islpa9lh0opk@invalid.netcom.com> <20120829222932.GA18700@cskk.homeip.net> <mailman.3947.1346280975.4697.python-list@python.org> |
| 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." <AWasilenko@gmail.com> |
| To | comp.lang.python@googlegroups.com |
| Content-Type | text/plain; charset=ISO-8859-1 |
| 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 <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Message-ID | <mailman.3950.1346283912.4697.python-list@python.org> (permalink) |
| Lines | 29 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1346283912 news.xs4all.nl 6849 [2001:888:2000:d::a6]:41419 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:28081 |
Show key headers only | View raw
On Wednesday, August 29, 2012 6:56:16 PM UTC-4, Dennis Lee Bieber wrote:
>
> BUT you do give a possible clue. Is the OP using a 3.x Python where
>
> strings are Unicode -- in which case the above may need to be explicitly
>
> declared as a "byte string" rather than text (unicode) string.
>
Huzzah! I am indeed using 3.x, and slapping on an .encode('utf-8') made my printer try to spit paper at me! Progress.
Also, astute observation about the endpoint needing to be an input, with the following modification I get:
>>> ep.write('\x1BA'.encode('utf-8'))
2
>>> ep = usb.util.find_descriptor(
intf,
custom_match = \
lambda e: \
usb.util.endpoint_direction(e.bEndpointAddress) == \
usb.util.ENDPOINT_IN
)
>>> ep.read(1)
array('B', [163])
>>>
Anyone want to venture a guess on how I should interpret that? It seems the [163] is the byte data the manual is talking about, but why is there a 'B' there? If I put paper in it and try again I get: array('B', [3])
Thanks for all your help guys, just about ready to stared coding the fun part!
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Sending USB commands with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-29 18:56 -0400
Re: Sending USB commands with Python "Adam W." <AWasilenko@gmail.com> - 2012-08-29 16:45 -0700
Re: Sending USB commands with Python MRAB <python@mrabarnett.plus.com> - 2012-08-30 01:53 +0100
Re: Sending USB commands with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-29 22:07 -0400
Re: Sending USB commands with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-30 00:55 -0400
Re: Sending USB commands with Python "Adam W." <AWasilenko@gmail.com> - 2012-08-30 05:51 -0700
Re: Sending USB commands with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-30 14:24 -0400
Re: Sending USB commands with Python Cameron Simpson <cs@zip.com.au> - 2012-08-31 08:47 +1000
csiph-web