On Wednesday, August 29, 2012 10:07:54 PM UTC-4, Dennis Lee Bieber wrote: > On Wed, 29 Aug 2012 16:45:10 -0700 (PDT), "Adam W." > > I'm a tad curious if using the notation > > > > b'\x1bA' > > > > without the .encode() would work. > > > > My concern is that you may encounter some "string" of data for > > printing which the .encode() ends up /changing/ (don't UTF-8 strings use > > a high-bit to signal a multi-byte encoding of what had been a single > > character?). A pure byte string shouldn't have that problem. >
Your notation does work, and I was just coming around to reevaluating the use of the encode because I am getting really odd results when trying to print lines. For example I set the byte length to 10 and sent this 500 times or so expecting to get a solid black bar: ep.write('\x16FFFFFFFFFF'.encode('utf-8')) But what I got was a weird stripped pattern... I feel like a lot of my commands are working by chance, I can't explain to myself why the A in \x1bA isn't being treated as part of the hex. This stuff always confuses me. > > > >>> ep = usb.util.find_descriptor( > > > intf, > > > custom_match = \ > > > lambda e: \ > > > usb.util.endpoint_direction(e.bEndpointAddress) == \ > > > usb.util.ENDPOINT_IN > > > ) > > > > Seems tedious to keep swapping -- does USB support bidirectional > > connections? > I assigned the input to ep2 to resolve the switching issue. -- http://mail.python.org/mailman/listinfo/python-list