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


Groups > comp.os.linux.misc > #14735

Re: How do you access the printer in Linux/C?

From Joe Beanfish <joebeanfish@nospam.duh>
Newsgroups comp.os.linux.misc
Subject Re: How do you access the printer in Linux/C?
Date 2015-05-08 13:51 +0000
Organization A noiseless patient Spider
Message-ID <miif0g$dgd$1@dont-email.me> (permalink)
References (1 earlier) <b6vbvb-itu.ln1@squidward.dionic.net> <87lhi4b5uv.fld@barrow.com> <pan.2015.05.06.08.52.03@gmail.com> <mid5dd$bs$1@dont-email.me> <pan.2015.05.08.10.46.08@gmail.com>

Show all headers | View raw


On Fri, 08 May 2015 10:44:55 +0000, Unknown wrote:

> On Wed, 06 May 2015 13:36:45 +0000, Joe Beanfish wrote:
> 
>> On Wed, 06 May 2015 08:50:56 +0000, Unknown wrote:
>>> If the office M$ system was closed for 2 weeks, and you needed to
>>> desperately print some files from your portable *nix computer via the
>>> office-HP-3055-Laser-Jet, how would you drive the printer via an eth0
>>> cable from your portable?
>>> 
>>> What's a simple script to probe the printer to find its IP? Can nc do
>>> that?
>>> 
>>> You've previously always just given your text-files to the M$-user on
>>>  a USBstik, so you've never setup `cups` etc. on a computer, and you
>>>  want to be able to just plug in your ethO cable and call a single
>>>  script, and not need to work at the inconveniently located printer.
>>> 
>>> How to simplify even further, so that the portable device, that brings
>>> the files to the eth0 connected printer, has no display/kybrd, and is
>>> just programmed to <print when it's powered up>. No that's not fantacy
>>> : it's been playing <the next *.wav> flawlessly, when powered-up 1000
>>> times.
>> 
>> Well, playing a local sound file through the known/built-in audio
>> device is not at all the same as probing the entire network for any/all
>> printers, determining their make/model,
> 
> Perhaps a picture will help? Disconnect existing eth0 cable from printer
> 
> [rPi in shoe-box with 6V acco]--eth0Cable-->[HP-3055-Laser-Jet]

You still need to know/find the IP of the printer. And if it's dhcp
it my try to renew it's lease while you're connected. If that fails
I don't know if it will keep the same ip or drop off the network.

> 
>> and pumping the source document through the right conversion and driver
>> to send to the printer. You'll be lucky to find a command-line only
>> solution, much less a blind one. And you're certainly not going to be
>> develop a solution in isolation and have it just work when you're at
>> said office. You'll need to develop the procedure at the office. A
>> couple useful tools might be nmap for discovery and smbspool for
>> sending data to the printer.
>> 
> nmap - Network exploration tool and security / port scannersmbspool -
> smbspool - send a print file to an SMB printer
> 
> That looks interesting. Thanks.
> 
> I've read that a common printer:IP = 192.168.0.9100 [or something]
> Does it mess their network if I just unplug their eth0->printer,
> and plug rPi to do: ping common Printer IP/s and save results ?

That IP is wrong. The "9100" you've seen before is a port number used
by hp printers' "jetdirect" protocol (possibly others?). It looks like
you can send a byte stream directly to that to printer using nc.

http://danieru.com/2013/06/06/what-is-port-9100-how-to-print-to-it/

I just tried it. Seems to work for plain text files. But be sure your
files have CR+LF not just LF as most *nix files will have.

sed 's/$/\x0d/' <YOUR_TEXT_FILE|nc 192.168.x.y 9100

Also, it looks like you'll have to insert form feeds, \x0c or ^L, as
needed. My test dropped everything that didn't fit on the page. So add
a form feed after 60 lines, or whatever fits on whatever size paper
you have (I have US letter size). 

> 
>> Perhaps a call to the office to at least find out the make and model of
>> printer would be helpful.
> 
> That was listed in OP. Think from 1st principles; not ito *YOUR* office.

Oops, my bad. My office uses "dvihp" to convert latex dvi files for
a laserjet 4050. I think that still relies on lpr to actually send
the data to the printer.

Back to comp.os.linux.misc | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How do you access the printer in Linux/C? pureheart@pacbell.net - 2015-04-06 17:07 -0700
  Re: How do you access the printer in Linux/C? Tim Watts <tw_usenet@dionic.net> - 2015-04-07 04:23 +0100
    Re: How do you access the printer in Linux/C? The Natural Philosopher <tnp@invalid.invalid> - 2015-04-07 05:46 +0100
    Re: How do you access the printer in Linux/C? floyd@apaflo.com (Floyd L. Davidson) - 2015-04-07 02:16 -0800
      Re: How do you access the printer in Linux/C? Tim Watts <tw_usenet@dionic.net> - 2015-04-07 11:30 +0100
        Re: How do you access the printer in Linux/C? The Natural Philosopher <tnp@invalid.invalid> - 2015-04-07 11:51 +0100
          Re: How do you access the printer in Linux/C? floyd@apaflo.com (Floyd L. Davidson) - 2015-04-07 03:11 -0800
            Re: How do you access the printer in Linux/C? The Natural Philosopher <tnp@invalid.invalid> - 2015-04-07 12:37 +0100
              Re: How do you access the printer in Linux/C? pureheart@pacbell.net - 2015-04-07 08:31 -0700
          Re: How do you access the printer in Linux/C? Tim Watts <tw_usenet@dionic.net> - 2015-04-07 12:24 +0100
        Re: How do you access the printer in Linux/C? Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2015-04-07 16:26 +0000
      Re: How do you access the printer in Linux/C? The Natural Philosopher <tnp@invalid.invalid> - 2015-04-07 11:46 +0100
      Re: How do you access the printer in Linux/C? Unknown <dog@gmail.com> - 2015-05-06 08:50 +0000
        Re: How do you access the printer in Linux/C? Joe Beanfish <joebeanfish@nospam.duh> - 2015-05-06 13:36 +0000
          Re: How do you access the printer in Linux/C? Unknown <dog@gmail.com> - 2015-05-08 10:44 +0000
            Re: How do you access the printer in Linux/C? Joe Beanfish <joebeanfish@nospam.duh> - 2015-05-08 13:51 +0000
              Re: How do you access the printer in Linux/C? William Unruh <unruh@invalid.ca> - 2015-05-08 14:58 +0000
                Re: How do you access the printer in Linux/C? Joe Beanfish <joebeanfish@nospam.duh> - 2015-05-11 13:24 +0000
                Re: How do you access the printer in Linux/C? Robert Heller <heller@deepsoft.com> - 2015-05-11 14:40 -0500
            Re: How do you access the printer in Linux/C? William Unruh <unruh@invalid.ca> - 2015-05-08 14:55 +0000
  Re: How do you access the printer in Linux/C? The Natural Philosopher <tnp@invalid.invalid> - 2015-04-07 05:43 +0100
  Re: How do you access the printer in Linux/C? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-04-07 12:15 -0400
    Re: How do you access the printer in Linux/C? pureheart@pacbell.net - 2015-04-09 15:39 -0700

csiph-web