To Github!updated on Thursday, June 12th, 2014 by Triften
I've commited my current (I think) code to a github repo: https://github.com/Triften/hp4600.
Downloadsupdated on Saturday, Apr 11th, 2009 by Triften
Latest version: hp4600-scanfullpage11.c Compile with
gcc hp4600-scanfullpage11.c -o hp4600scanfullfile -lusbYou will need libusb and probably libusb-devel installed to compile this. To use, just run
hp4600scanfullfile (output filename)Image fixer: fixhp4600output02.c Compile with
gcc -o fixhp4600output fixhp4600output.cRun
./fixhp4600output (input filename) > (output filename)One step glue script (you must have the other two executables made): hp4600onestep
Just make executable (chmod 770 hp4600onestep), then run
./hp4600onestep (output filename)It will scan to a temp file, run the fixer, then delete the temp file for you. This is a stopgap until I take the time to incorporate the banding/color correction into the executable.
Fixed colorposted on Monday, Feb 16th, 2009 by Triften
I went to scan a primarily red document and it came out blue. At first I thought "That is some amazing copy protection!", then I tried another document and the red in that came up blue as well. Turns out that the scanner puts out RGB bytes while the bmp format is BGR. The new fixer, "fixhp4600output02.c", takes care of it. Whee! (Tested and confirmed on a rainbow sock.)
Trimmed some things downposted on Monday, Feb 16th, 2009 by Triften
I pulled some commands out into functions and named some routines based on the SQ113 code. The source file is roughly half the size of what it was before and makes some of the functionality a little more apparent. It's still a black magic incantation that results in a completed scan (with a confirmed test from another user!! Yay! Thanks, Stego!) Also, I hardcoded the vendor and device IDs and it now accepts a filename as input so the usage is
hp4600scanfullfile (output filename)You may or may not need an "sudo" in there.
For instructions on compiling, head farther down the page to here.
I also wrote code to fix the output postscan. It fixes the 4 pixel offset between the bands. I'll eventually incorporate this into the scanning and fix it as it scans. fixhp4600output.c
This uses no libraries or anything so it can compile straight away with
gcc -o fixhp4600output fixhp4600output.cthen to use it run
./fixhp4600output (filename) > (output filename)Current TODO is:
Detects as SQ113? Mustek_usb2?posted on Monday, Dec 8th, 2008 by Triften
The controller chip in the HP Scanjet 4600 detects as an SQ113 according to its page on the SANE website. This is the same chip that the mustek_usb2 backend works on. I don't know how to force sane to use a backend on an unsupported scanner, but I'm just about willing to try it out at least.
I've been looking through the code and comparing it to the log from SniffUSB. A lot of the commands look the same and match up with about when I'd expect the commands to be issued, though I think that HP or SQ expanded a little bit on this one. A register/command labeled GPIO in the mustek_usb2 code gets used by the Windows driver for the HP 4600.
I'm not sure if I should spend time looking at the log to pick it apart, or just get an executable to do a full page scan and consider that good enough. One could always edit it as needed with GIMP.
A basic executable!posted on Saturday, Dec 6th, 2008 by Triften
I used SniffUSB to capture a log of a full page scan, then ran the log through usbsnoop2libusb.pl to get some basic functioning code. I added file output for the image data as well as consolidating the actual scan itself into a nice loop (it was the same 8 commands about 207 times.) Some existing issues are that the image will come in upside-down and it will appear to be cut into 334 pixel wide strips which are offset from their neighbors by about 4 pixels, making horizontal lines jagged.
Also, very light areas (primarily the bed of the scanner) appear to be different shades of white, but this is apparent when scanning under Windows so I'm not sure what is causing that.
Current TODO is:
Please send any feedback to triften at g mail dot com (no space between g and mail and add the proper symbols, of course.)