?

Log in

No account? Create an account

Previous Entry | Next Entry

More on scanner drivers

So far I've found a lot of really good info on writing a scanner driver. I think that I should have everything that I need to accomplish the task, given the time and patience (and perhaps some caffeine)

I first want to point out what great resources Apple gives away to developers. XCode is a sweet IDE, and totally free with Panther. Apple also has available free for download all sorts of useful SDK's relating to various aspects of OS X. The one that I found right off was the Image Capture Architecture SDK, complete with a short overview of how to write a scanner plugin, and a compilable project to get you started with a complete plugin framework. All I have to do is add the code to access the device. Along with that there is also a great tutorial on doing all the rest of that under OS X. All of this info is at http://developer.apple.com. Right now I'm basically reading through all the info that Apple has on accessing USB devices, and how the ICA framework works.

Once I have all of the above figured out, I'll need to know how to work the scanner in question. I was very lucky in that respect. I took a look at SANE, the scanner framework for Linux. The latest version of SANE claims complete support for the N1240U and the LIDE 30. So I grabbed the latest snapshot, and started looking around to see what info might be in there. Reading someone else's code is never fun, but it does seem to be fairly well laid out, and I should be able to refer to it to find out more. Fortunately for me, the developer of the plugin (plustek) that I looked at also posted links to a good bit of technical info on the chipset of the printer. Included in that is what is basically an SDK from National Semiconductor on how to talk to the chip. The reason that this scanner can be so small is that it's all done in one piece of silicon (plus a DRAM module, ok, so 2 chips) the single chip does all of the work, from talking to the host via USB to controlling the lamp and stepper motor. It's quite amazing.

At this point I discovered something quite startling. I never knew before how incredibly stupid a scanner is, at least this one. I must tell it to do everything, and I mean everything. I have to tell the scanner when to turn on the lamp. I even have to do the color calibration myself. All of the work is done by the driver. The scanner does nothing. Amazing stuff.

So now I'm busy learning OS X's IOKit framework. After that, I plan to write a demo app that can find and access the scanner, turn the light on, move the carriage, etc. Then I'll need to get bulk data transfer down. Perhaps at that point I'll try to graft my code into the Apple supplied framework and see if I can't get an image out of it.