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


Groups > comp.lang.python > #28071

Re: Sending USB commands with Python

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'interpreter': 0.04; 'subject:Python': 0.05; '"""': 0.05; 'method.': 0.05; 'granted,': 0.07; 'none):': 0.07; 'parameter': 0.07; 'indicates': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'timeout': 0.09; 'timeout)': 0.09; 'def': 0.10; 'aug': 0.13; '"2"': 0.16; 'did:': 0.16; 'endpoint.': 0.16; 'operation.': 0.16; 'otoh,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'status.': 0.16; 'written.': 0.16; 'wed,': 0.16; 'bytes': 0.17; '>>>': 0.18; '(or': 0.18; 'translate': 0.20; 'sort': 0.21; 'trying': 0.21; 'header:X-Complaints-To:1': 0.28; 'implies': 0.29; 'subject:Sending': 0.29; 'manual': 0.29; 'source': 0.29; 'returned': 0.30; 'error': 0.30; 'up.': 0.31; 'code': 0.31; 'says': 0.33; 'url:home': 0.33; 'to:addr:python-list': 0.33; 'data,': 0.35; 'something': 0.35; 'received:org': 0.36; 'method': 0.36; 'subject:with': 0.36; 'charset:us-ascii': 0.36; 'data': 0.37; 'subject:: ': 0.38; 'behind': 0.38; 'some': 0.38; 'page': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'address': 0.60; 'mentioned': 0.63; 'show': 0.63; 'details,': 0.65; 'limit': 0.65; 'issued': 0.65; 'transfer': 0.76; 'printer': 0.84; 'subject:commands': 0.84; 'dennis': 0.91; 'received:108': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: Sending USB commands with Python
Date Wed, 29 Aug 2012 16:09:33 -0400
Organization > Bestiaria Support Staff <
References <ff6f931d-e5ad-40ee-aa4d-f2bbd1303046@googlegroups.com> <d8er38h4ns0obmhevo4v12u0qk2rhufeu8@4ax.com> <09ec368e-9079-46dc-a70a-3ae345d7996c@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host adsl-108-79-223-94.dsl.klmzmi.sbcglobal.net
X-Newsreader Forte Agent 3.3/32.846
X-No-Archive YES
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>
Newsgroups comp.lang.python
Message-ID <mailman.3942.1346270988.4697.python-list@python.org> (permalink)
Lines 53
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1346270988 news.xs4all.nl 6876 [2001:888:2000:d::a6]:43934
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:28071

Show key headers only | View raw


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

> 
> Trying to do the status thing mentioned before, in the interpreter I did:
> 
> >>> ep.write('A')
> 2
> 

	Don't the commands require an <esc> character? "\x1BA" (or
"\x1B\x41")

	OTOH, if the <esc> is issued behind the scenes,

> And the manual says 2 is not a valid option... So something isn't adding up.

 ... and you do not need to issue some sort of read(), page 17 of the
printer manual you linked would translate to 

not ready, top of form, not out of paper, not jammed, not in error

	Granted, page 10 implies that the printer will never show "not
ready"

	However -- reading the pyUSB source code

-=-=-=-=-
 def write(self, data, timeout = None):
        r"""Write data to the endpoint.
        
        The parameter data contains the data to be sent to the endpoint
and
        timeout is the time limit of the operation. The transfer type
and
        endpoint address are automatically inferred.

        The method returns the number of bytes written.

        For details, see the Device.write() method.
        """
        return self.device.write(self.bEndpointAddress, data,
self.interface, timeout)
-=-=-=-=-

indicates that the "2" you are seeing is the "number of bytes written";
you need to issue a read request to retrieve the returned printer
status.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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