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

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?

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. more information

Awesome post, and incredible

Awesome post, and incredible site. A debt of gratitude is in order for the data! The Author Incubator

I as of late ran over your

I as of late ran over your online journal and have been perusing along. I thought I would leave my first remark. I don't realize what to say with the exception of that I have delighted in perusing. Pleasant website. I will continue going by this web journal all the time. The Author Incubator

Magnificent site you have

Magnificent site you have here, so much cool data!.. http://delcam.aedsoftware.info/featurecam.html

This is an extraordinary

This is an extraordinary post. I like this topic.This site has loads of advantage.I discovered numerous fascinating things from this site. It helps me in numerous ways.Thanks for posting this once more. More Info

Love what you're doing here

Love what you're doing here folks, keep it up!.. Webhosting

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