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 ;-)

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. Hundred Palms EC

This is very informatics,

This is very informatics, fresh and clear. I feel that everything has been portrayed in methodical way with the goal that peruser could get greatest data and realize numerous things. cheap55printing

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. Monster Legends Cheats

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. carpet protector

I truly welcome the sort of

I truly welcome the sort of points you post here. A debt of gratitude is in order for sharing us an awesome data that is really useful. Great day! cheapest postcard printing

I have this printer and use

I have this printer and use it. In my opinion, this printer has good quality. capsa susun online

idc phuket

Printer and scanner in my house is Canon. idc phuket

There are different printers

There are different printers and scanners implemented by different companies. There are some steps that should be followed in order to enable the working of these devices. Follow the steps provided here in order to connect the device to the system. android tablet wholesale

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. alarm systems johannesburg

This is extremely fascinating

This is extremely fascinating substance! I have completely delighted in perusing your focuses and have arrive at the conclusion that you are right about a number of them. You are incredible. delhi to jaipur cab

I havent any word to value

I havent any word to value this post.....Really i am inspired from this post....the individual who make this post it was an extraordinary human..thanks for imparted this to us. kit tattoo

i cherish perusing this

i cherish perusing this article so beautiful!!great work! packers and movers in pune

A debt of gratitude is in

A debt of gratitude is in order for the significant data and experiences you have so given here... places to visit in ajmer

Thank you very much for keep

Thank you very much for keep this information. http://aperfecttan.blogspot.com

"Boredom is a killer—which is

"Boredom is a killer—which is why a cure for boredom can be a lifesaver. The truth is, portable Bluetooth speakers have been the handheld solution to elevate the moment, whether at the beach, the middle of a party, or a lazy afternoon at home for years now—and your brand can get in on that excitement. Right now—with C2BPromo.com, you can put you logo on a wide array of Promotional Bluetooth Speakers, in all different shapes and sizes, from waterproof to resilient wood—with models coming in at 6-7 dollars all the way up to high-end luxury designs. Multiple surfaces on almost every customized Bluetooth speaker can showcase your logo—so no matter which way it’s turned, your name is always center staged." Bluetooth Speaker Promotional Item

I wish more writers of this

I wish more writers of this sort of substance would take the time you did to look into and compose so well. I am exceptionally inspired with your vision and understanding. cab service jaipur to delhi

this is truly decent to

this is truly decent to read..informative post is great to read..thanks a considerable measure! tattoo supply

I like this post,And I figure

I like this post,And I figure that they having a great time to peruse this post,they might take a decent site to make an information,thanks for sharing it to me. packers and movers hadapsar pune

The site is looking piece

The site is looking piece garish and it gets the guests eyes. Outline is really basic and a decent easy to use interface. delhi to ajmer taxi

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. 7 mile bridge miami to key west

You as a buyer would want as

You as a buyer would want as many of the bells and whistles that the original purchaser received, minus the price and the storefront. The better the condition of the piece, with normal wear, is certainly the commanding issue of the secondary market’s price. However, you might be surprised that the added value of the original packaging (inside box, outside box, paperwork with folder, appraisal from the brand, original receipt) will bump the price upwards. court reporter classes

informative Blog! Your online

informative Blog! Your online journal furnished us with profitable data to work with. Each and every tips of your post are great. Much obliged for sharing. Continue blogging, Smith & Nephew Hip Replacement Lawsuits

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. Cheap fifty fiveprint Discount

Keep doing awesome read few

Keep doing awesome read few posts on this site and I consider that your web journal is exceptionally fascinating and has sets of fabulous data. http://mirlasabinoblog81.suomiblog.com/effective-mirla-sabino-advice-simplified-2603371

The Ideal Dream Laser Clinic

The Ideal Dream Laser Clinic is a cosmetic-medical center offering only certified, result-oriented hair removal, Skin rejuvenating, body countering and weight loss services for both men and women. Our team includes certified technicians, Registered Dietitian and specialized skin and laser consultants. We offer the highest level of safety and service in an environment where the main priority is your safety, health and privacy. Our clinic located in heart of north York , Yonge and Steeles area close to public transit. 5 min walk to center of Yonge and Steeles, 88 Steeles Ave. East Toronto. laser clinic toronto

This is very informatics,

This is very informatics, fresh and clear. I feel that everything has been portrayed in methodical way with the goal that peruser could get greatest data and realize numerous things. fifty five print Discount Code

Much obliged for each other

Much obliged for each other educational site. The spot else might just I understand that sort of data written in such a perfect means? I have an endeavor that I'm a few seconds ago working on, and I have been watchful for such data. home equity line of credit vs cash out refinance

Thank you very much for

Thank you very much for writing such an interesting article on this topic. This has really made me think and I hope to read more. limo service from NYC to CT

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. macchinette tatuaggi

imranuddin

My friend mentioned to me your blog, so I thought I’d read it for myself. Very interesting insights, will be back for more! arabic news

Its me Brayden Ben a

Its me Brayden Ben a professional and well experienced Designer.There are many designer more experienced then me , but now i am here to provide you the real design service I will design your name with real stones and give you high quality image , Unique and professional and no one will copy your design because its all Hand Made. awesome name design

I think you can follow the

I think you can follow the instructions from the manual book. If not, just try to share your problem. judi bola

Wrought iron lighting

That's the IT engineering works, I am just a staff and don't know about it. Wrought iron lighting

moonstone jewelry

This stuff reminds me to the place where I was an internship there. moonstone jewelry

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 clearly going to impart this URL to my companions. video submission

imranuddin

Hi there, I found your blog via Google while searching for such kinda informative post and your post looks very interesting for me. sleep surface made from a flexible product

Mebel Furniture Jepara

Berbagai macam pilihan model dan desain untuk mengisi perabot furniture rumah anda. Furniture Jepara Furniture Jepara Minimalis Indoor Furniture Outdoor Furniture

imranuddin

wow this good but ,I like your post and good pics may be any peoples not like because defrent mind all poeple , sleep surface made from a flexible product

imranuddin

Hi I found your site by mistake when i was searching yahoo for this acne issue, I must say your site is really helpful I also love the design, its amazing!. I don’t have the time at the moment to fully read your site but I have bookmarked it and also add your RSS feeds. I will be back in a day or two. thanks for a great site. different sort of whatsthebestbed design

devidmiller5060

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”. ESR wheels

台北當鋪

How much the cost if I want to buy this printer? 台北當鋪

Wait till you see KRW Personal Injury Lawyers

Those are long code. I am a beginner in coding so those look so confusing. http://www.krwlawyers.com/start_San-Antonio-Personal-Injury-Attorney.php

good

This looks quite useful for the installation of the HP printer or scanner in a linux system I have been searching for a tutorial for the same since a while. I have bought one scanner last week and was not able to install it correctly. free womens clinic

micropigmentação fio a fio

This will help the staffs and the officer to finish their work faster. micropigmentação fio a fio

This Amazing

very amazing post, I like It, Thank you for presenting a wide variety of information that is very interesting to see in this artikle, good job adnd succes For you
Artikle yang sangat keren, semoga sukses selalu
Ingin Liburan dan Wisata Karimunjawa dengan aman dan nyaman di karimunjawa ? Ingin Paket Wisata Karimunjawa dan gak murahan? Hubungi Kami "Raja Karimunjawa" biro lokal asli paket wisata Karimunjawa . Untuk Book Paket Karimunjawa dan Tour Karimunjawa. Kepuasan Wisata Karimunjawa anda di pulau Karimunjawa adalah kebahagia'an dan tujuan kami. Terimakasih telah mempercayakan paket karimunjawa bersama kami. Kami juga menjual produk tenun troso dan kain tenun ikat khas jepara. untuk harga paket wisata karimunjawa sangat terjangkau, silahkan Untuk booking paket tahun baru karimunjawa dan paket honeymoon karimunjawa dan paket backpacker karimunjawa. juga untuk paket lebaran silahkan klik paket lebaran karimunjawa Kami Juga Punya Paket Bulan Mei Karimunjawa dan ada pula Paket karimunjawa 3 hari 2 malam maupun paket karmunjawa 2 hari 1 malam dan paket karimunjawa 4 hari 3 malam. ada juga paket hotel karimunjawa dan jadwal kapal karimunjawa.
Di jepara juga terkenal Produk Furniture Jepara yang sudah mendunia. dari segi kualitas mebel jepara juga sangat bagus.di jepara banyak sekali toko furniture jepara maupun toko jual mebel minimalis. adapun produknya yaitu toko sangkar burung, mebel minimalis, mebel jati, Lemari pakaian kayu jati, kursi tamu jati jepara, tempat tidur kayu jati, meja makan kayu jati murah, mimbar podium minimalis,

The article has actually

The article has actually peaks my interest. I am going to bookmark your web site and maintain checking for brand new information. Berlin attractions

shiprabrock

his is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the excellent work. ESR wheels

wilwilson

Hey there! Someone in my Facebook group shared this site with us so I came to look it over. I’m definitely enjoying the information. I’m book-marking and will be tweeting this to my followers! Outstanding blog and amazing style and design. Check This Website

steve smith

Yes, great US Military force. Also, in his post you have given a chance to listen about US Military. I really appreciate your work. Thanks for sharing it. sistema di gestione sicurezza alimentare roma

smith

I really like your article. It’s evident that you have a lot knowledge on this topic. Your points are well made and relatable. Thanks for writing engaging and interesting material. www.Everydaylocksmith.org