hansdegoede: me (Default)
Hans de Goede ([personal profile] hansdegoede) wrote2008-01-09 11:09 pm
Entry tags:

HP multi function printer cardreaders & Linux

Hi All,

Do you have a HP multi function printer? And does it have a cardreader? And does it not work when you insert an sdcard, or have you never tried? Then this blogpost is for you!

The story starts quite some time ago, I just never got around to writing about it before. After encountering this bug in RH bugzilla while doing bug triaging. I thought hey, that reminds me the reader in my PSC has troubles too, lets see if I can fix this.

So after 3 long evenings of debugging, I finally have my cardreader working "properly" (what a piece of <beep>).

At first I tried and succeeded with US_FL_FIX_CAPACITY, that worked but gave me warnings that the partition was larger then the device, and read access beyond the end of device errors. But it worked now!

Further debugging has lead me to the following conclusion: The HP PSC 1350 reader will "crash" and from that moment on no longer communicate in any sane way, if you try to read the last sector of an sdcard * in a read that is more then 1 sector, so trying to read 8 sectors starting at sector capacity-8 will crash it, as will reading 2 sectors starting at sector capacity-2, however reading the last sector in a one 1 sector read will succeed! (* xdcards seem to be fine).

With this knowledge I wrote a patch introducing a new unusual device flag, and modifying usb-storage behavior to not cause the crash condition when this flag is said. This was 6 months ago, there was some discussion about my patch on the usb-storage list, but in the form it had then it wasn't accepted and no consensus was reached on in which form it would be acceptable. A few days ago I got a mail from an HP PSC 1610 owner, who had the same problem, found my patch in the mailinglist archive, and it fixed things for him too. So now I'm trying to get some form of fix into the kernel once more.

Which brings me to the reason for writing this blog post, when a fix gets in the kernel it would be nice to have a complete list of usb id's of all HP printers needing this workaround. So if you have such a beast please try feeding it sdcards and if they don't work, try again with my patch. In order to make testing as easy as possible I've prepared an out of tree compilable version of the usb-storage driver. Here are simple testing instructions:
  • Download this tarbal
  • untar
  • make sure you have the kernel-devel package for your currently running kernel installed
  • cd usb-storage2
  • make
  • make sure you do not have any usb storage devices mounted
  • sudo rmmod usb-storage
  • sudo insmod usb-storage.ko
  • insert sdcard
  • it should work now
Note the tarbal is for a 2.6.23 kernel, your milage with other kernels may vary.

Everyone with a HP printer with cardreader, please test, your feedback is much appreciated.

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting