ts-7000
[Top] [All Lists]

Re: [ts-7000] Re: Support for USB Printer - Is it really that complicate

To:
Subject: Re: [ts-7000] Re: Support for USB Printer - Is it really that complicated?
From: "Martin Guy" <>
Date: Fri, 9 Nov 2007 21:13:44 +0000
2007/11/9, Ed K <>:
> My solution (although it's not pretty) is that I now do this:
>
> #define LPGETSTATUS  0x060b  (from ioctl.h I think)
>
>    fd = open("/dev/usb/lp0", O_RDWR);
>    ioctl(fd, LPGETSTATUS, &status);
>
> I check "status" to see if the printer is on-line.  It seems to work.
>  I don't know if it is a bad practice to be mucking about with ioctl
> from within a user-space program or not but it's the only thing I've
> found that will work for me.

No, that's fine. That is how you find out whether a printer is online
right now or not.
The only "cleaner" solution would be to use some printing library or
subsystem like cups but it's likely that most likely keep you so far
away from the printer that you;d end up with even less control. There
may be some library or part of some printing system you could rip out
if you want to hide that behind a nice function interface.

Actually, the grottiest thing your program is doing is to use
system(), which is more heavyweight and unreliable than necessary and
means you can't do anything about the printer running out of paper or
jamming during a print job.

    M


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU