HP printer / scanner

This is just a quick writeup of what I have done so far to get an HP LaserJet M1522nf (printer / fax / scanner) to work. Currently this device is only used as a copier at the office, but many people asked about the scan button. My main goal is that users can simply press the scan button on the device in order to scan a document and save it to a Samba share.

After connecting the USB cable, Kubuntu automatically installs the printer in Cups. You can change the settings on http://localhost:631. To change the name of the printer (how it appears on the printers list), add a new printer with the same settings, and delete the old one. So now we have a working printer.

For scanning under X Window, try xsane. In my case it failed with an I/O error. The solution was this command:

hp-plugin -i

This installs any missing driver from HP. After that xsane works and we can do some scanning. So far so good.

For scanning on the commandline, use scanimage -L to get a list of devices, and use something like the following command to actually scan:

scanimage -d 'hpaio:/usb/HP_LaserJet_M1522nf_MFP?serial=00CNDT914GWT' --mode Color --resolution 300 > test.pnm

The argument after -d specifies the device found using scanimage -L.

Great! Next thing to do is monitoring the scan button. This however seems to be a major problem, because nobody appears to have implemented it yet. Even after more than 5 years, HP appearently has serious trouble supporting this simple scan button in their HPLIP library. Fortunately, there is another way. If you press the scan button, a message appears on the LCD: "Waiting for PC",

and after a few seconds a timeout occurs because the PC is not responding, after which the printer returns to its ready state.

On some HP printers you can read out the LCD, using the SNMP protocol. So indirectly you can tell whether or not the scan button has been pressed. The only thing to do is hookup the HP device to the network and give it a static (fixed) IP address. Here are some useful commands:

snmpwalk -v 1 -c public <ip_address_of_scanner>
scli <ip_address_of_scanner> -c "show printer display"
scli <ip_address_of_scanner> -c "show printer lights"

The snmpwalk command is part of the snmp package and you can find the scli command in the scli package.

However, the M1522nf does fully support SNMP; you cannot read out the LCD using SNMP on this thing. It does not support Telnet either, and there is no PJL command you can send to the JetDirect port (9100) to query the LCD display. The only way to do that using the web interface, so we use wget to do that every 5 seconds. Here the script I have come up with:

#!/bin/sh

while [ 1 ]
do
   MSG="`wget -q -O - \
      'http://192.168.1.4/info_deviceStatus.html?tab=Status&menu=DevStatus' | \
      grep -A2 'itemLargeFont' | tail -1 | sed -r 's/(&nbsp;| |\t)+/ /g' | \
      sed 's/<[^>]*>//g'`"
   if echo "$MSG" | grep -q 'Waiting for PC'
   then
      echo "Scanning"
      scanimage -d hpaio:/usb/HP_LaserJet_M1522nf_MFP?serial=00CNDT914GWT \
         --mode Color --resolution 300 | cjpeg -optimize -quality 85 > \
         /share/Scanner/`date '+%Y-%m-%d-%H-%M-%S'`.jpg
   else
      echo "Idle"
   fi
   sleep 5
done

In this case 192.168.1.4 is the IP address of the printer and /share/Scanner is a directory on our NFS / Samba server. Now if someone presses the scan button, the scanner starts and the resulting image is converted from PNM to JPEG, and saved under a name like 2010-11-16-12:34:56.jpg.

Mission accomplished ;-)

much thanks to you for an

https://www.9597.tw/

Your web journal furnished us

Your web journal furnished us with important data to work with. Each and every tips of your post are wonderful. Much obliged for sharing. Continue blogging, cheapest 55 print

It proved to be Very helpful

It proved to be Very helpful to me and I am sure to all the commentators here! 1200g polythene

A debt of gratitude is in

A debt of gratitude is in order for offering this quality data to us. I truly delighted in perusing. Will without a doubt going to impart this URL to my companions. morocco travel advisory

I have been looking at a

I have been looking at a couple of your stories and i can state really well done. I will bookmark your online journal magnetic tape

Amazing article. Extremely

Amazing article. Extremely intriguing to peruse. I truly love to peruse such a decent article. Much obliged! continue shaking. 55printing.com/blogs/brochure-design-tips/

It was a decent post in

It was a decent post in reality. I altogether delighted in understanding it in my lunch time. Will without a doubt come and visit this blog all the more frequently. A debt of gratitude is in order for sharing. webdesign Amsterdam

Amazing article. Extremely

Amazing article. Extremely intriguing to peruse. I truly love to peruse such a decent article. Much obliged! continue shaking. Forest Row Accountants

I know your aptitude on this.

I know your aptitude on this. I should say we ought to have an online discourse on this. Composing just remarks will close the talk straight away! What's more, will confine the advantages from this data. related site

The Canadian company

The Canadian company interested in buying the Villa de Paz Golf Course property on Tuesday removed its application for the land. resources

Wow i can say this is another

Wow i can say this is another extraordinary article not surprisingly of this blog.Bookmarked this website.. Get free hotstar premium

The post is composed in

The post is composed in exceptionally a decent way and it contains numerous valuable data for me. website

Much obliged to you for the

Much obliged to you for the upgrade, exceptionally pleasant site.. more about the author

Is it alright to post a

Is it alright to post a portion of this on my site fundamentally present a hyperlink on this site page? Company Accountants

It was a decent post in

It was a decent post in reality. I altogether delighted in understanding it in my lunch time. Will without a doubt come and visit this blog all the more frequently. A debt of gratitude is in order for sharing. marketing services

I was perusing your article

I was perusing your article and thought about whether you had considered making a digital book on this subject. You"re composing would offer it quick. You have a considerable measure of composing ability. Swiss made

A debt of gratitude is in

A debt of gratitude is in order for offering this quality data to us. I truly delighted in perusing. Will without a doubt going to impart this URL to my companions. จีคลับ

Only a grinning visitant here

Only a grinning visitant here to share the adoration (:, btw remarkable style. Tax Accountant

Incredible overview, I"m

Incredible overview, I"m certain you"re getting an awesome reaction. divorce attorneys

You have a decent point

You have a decent point here!I absolutely concur with what you have said!!Thanks for sharing your views...hope more individuals will read this article!!! buy Delcam Powermill

Much obliged for another

Much obliged for another superb post. Where else would anybody be able to get that sort of information in such a perfect method for composing? Cheap Panoramic Canvas Prints

I was perusing your article

I was perusing your article and thought about whether you had considered making a digital book on this subject. You"re composing would offer it quick. You have a considerable measure of composing ability. http://nearmeprintingcompany.canariblogs.com/

Fabulous site you have here,

Fabulous site you have here, so much cool data!.. instagram hashtags

A debt of gratitude is in

A debt of gratitude is in order for the web journal stacked with such a large number of data. Halting by your web journal helped me to get what I was searching for. curso google adwords bogota

Useful information shared. I

Useful information shared. I am very happy to read this article. thanks for giving us nice info. Fantastic walk-through. I appreciate this post. Musically 2017

A debt of gratitude is in

A debt of gratitude is in order for offering this quality data to us. I truly delighted in perusing. Will without a doubt going to impart this URL to my companions. cheap canvas prints bedroom

Some really superb info

Some really superb info , Sword lily I found this. Best Generator

Hey. Cool article. There's a

Hey. Cool article. There's a problem with your site in chrome, and you may want to check this... Check This Medical Website

Discover More

printer with the same settings, and delete the old one. So now we have a working printer. Discover More

Very useful post. This is my

Very useful post. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. Really its great article. Keep it up. http://delcam.aedsoftware.info/artcam.html

Great information, better

Great information, better still to find out your blog that has a great layout. Nicely done Free Followers

A thoughtful insight and

A thoughtful insight and ideas I will use on my blog. You have obviously spent a lot of time on this. Well done! best fat burner

I truly welcome this

I truly welcome this magnificent post that you have accommodated us. I guarantee this would be helpful for the majority of the general population. http://www.purchasetramadol.co

Wow! This could be one

Wow! This could be one particular of the most helpful blogs We’ve ever arrive across on this subject. Basically Excellent. I’m also an expert in this topic therefore I can understand your effort. iPage 2018

"We provide professional and

"We provide professional and affordable services to clients in the Jacksonville area. Leave the worry out of the equation by taking advantage of our screen repair service, and letting the experts handle it. We'd love the opportunity to work with you and show why our exceptional service sets us apart from the rest of the field. We have... professional installers, free estimates, satisfaction guaranteed, Phifer sun and shade control products. We do... Screen Enclosure Repair, Pool Enclosure Repair, Screen Repair Service, Per Panel Screen Repair, Window Screen Repair, Screen Door Repair, Window Screen Replacement, Sliding Screen Door Repair, Full Re-Screen Service, Rusty Bolt Replacement, and More." Screen Repair Service

A debt of gratitude is in

A debt of gratitude is in order for offering this quality data to us. I truly delighted in perusing. Will without a doubt going to impart this URL to my companions. cursos marketing

I can't envision

I can't envision concentrating sufficiently long to research; considerably less compose this sort of article. You've beaten yourself with this material. This is incredible substance. Toronto brakes

a debt of gratitude is in

a debt of gratitude is in order for this usefull article, sitting tight for this article like this once more. Termite Control Cairns

It was a decent post in

It was a decent post in reality. I altogether delighted in understanding it in my lunch time. Will without a doubt come and visit this blog all the more frequently. A debt of gratitude is in order for sharing. buy soma 350mg online

loft conversions

Kubuntu automatically installs the printer in Cups. You can change the settings on loft conversions

Glowpink.com is a women-only beauty, health & lifestyle communit

Glowpink is a Women only 360° Health Community, wherein women can discuss their beauty, health & wellness problems. Here women can post queries and answer other's related to topics, including but not limited to, beauty, health, parenting, lifestyle, and fashion. Here we also try to connect best of the experts in related areas to the users. how to remove dandruff quickly

Additionally, silver is

Additionally, silver is relatively inexpensive. This means that a good collection of white metal gemstone jewelry can be accumulated without paying for white gold or platinum. Silver jewelry can be worn alongside white gold jewelry, since it matches in color. In fact, it can be difficult to tell the difference between the two. Like gold, silver can be alloyed with other metals to increase its strength and durability. Movies and More

Great post yet I was thinking

Great post yet I was thinking about whether you could compose a litte more on this subject? I"d be extremely grateful on the off chance that you could expound a smidgen further. Welcome it! offshore software development

I'm happy I discovered this

I'm happy I discovered this site, I couldn't discover any learning on this matter earlier to.Also work a website and in the event that you are ever keen on doing some guest composing for me if conceivable don't hesitate to tell me, im dependably search for individuals to look at my site. royal1mobiledetailing.com

Exceptionally fascinating web

Exceptionally fascinating web journal. Alot of websites I see nowadays don't generally give anything that I'm occupied with, however I'm most definately keen on this one. Recently believed that I would post and let you know. Controller Repairs

Crosswater Taps

l’originalité de l’auteur. L’événement déterminant la source de son inspiration y est relaté au regard de Crosswater Taps

A fascinating dialog is value

A fascinating dialog is value remark. I feel that it is best to compose more on this matter, it may not be a forbidden theme however generally people are insufficient to chat on such subjects. To the following. Here's to you. cheap postcard printing services

tariq

Great post full of useful tips! My site is fairly new and I am also having a hard time getting my readers to leave comments. Analytics shows they are coming to the site but I have a feeling “nobody wants to be first”. http://hilariouspastor60.amoblog.com/choosing-a-fishing-kayak-5278780

internet

Hey – great blog, just looking around some blogs, seems a really nice platform you are using. I’m currently using WordPress for a few of my blogs but looking to change one of them over to a platform similar to yours as a trial run. Anything in particular you would recommend about it?