Sending USB commands with Python

Tim Roberts timr at probo.com
Wed Aug 29 02:45:16 EDT 2012


"Adam W." <AWasilenko at gmail.com> wrote:
>
>So I'm trying to get as low level as I can with my Dymo label printer, 
>and this method described the PDF 
>http://sites.dymo.com/Documents/LW450_Series_Technical_Reference.pdf 
>seems to be it.
>
>I'm unfamiliar with dealing with the USB interface and would greatly
>appreciate it if someone could tell me how to send and receive these
>commands with Python.  Perhaps if you were feeling generous and 
>wanted to write a bit of sample code, sending the "Get Printer 
>Status" command and receiving the response (page 17 of the PDF) 
>would be perfect to get me on my way.

Well, it's more than "a bit of sample code".  You would essentially be
writing a device driver.

Which operating system are you using?  If you are on Windows, then the
operating system has already loaded a printer driver for this device.  You
can't talk to the USB pipes without uninstalling that driver.  It would be
just about as easy for you to learn to use GDI to write to the printer like
a normal application, and that way the code would work on the NEXT
generation of printer, too.

The libusb or libusbx libraries can be used to talk to USB devices.  There
is a Python binding.  On Windows, you still need to have a driver, but the
libusbx instructions can help you find an install one.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list