[sane-devel] HP ScanJet 4200 backend ("hp4200") and SANE 1.0.13

Henning Meier-Geinitz henning at meier-geinitz.de
Tue Dec 16 18:14:44 GMT 2003


Hi,

On Mon, Dec 15, 2003 at 12:33:45AM +0000, adrianpj at users.sourceforge.net wrote:
>   I have tested latest patch and solving the bug that make the hp4200 backed to
> detect the scanner if any usb scanner was plugged in even if it was not a
> hp4200.  Maybe that one is not really solved but I need somebody's help (Till?)
> to try out a patched SANE and to tell me if the problem is now solved (if not, a
> debug trace will be welcomed; I don't own any other usb scanner to test).
> 
>   BTW, can anybody or has anybody tested the backend?  You can download it
> before public release from (this is the latest and updated patch):

Ok, I'll take a look at it. I don't have such a scanner so I can't
comment on if it really works. I'm rather looking for formal problems
concerning inclusion in sane-backends.

I guess this patch should be included in the sane-backends
distribution? Would you be able to be the maintainer of that backend
in this case?

backend/hp4200.c:

* The license is GPL only. There is no SANE clause. While this doesn't
  stop the backend from beeing included into SANE it may give vendors
  who provide non-GPL frontends together with SANE some headaches.
  Would you consider using the SANE license so we have the same
  license for all (?) backends?

* #include "lm9830.h"
  This file should be called something like "hp4200-lm9830.h" to make
  clear that it's part of the hp4200 backend. If it's intended to be
  used by other backends it should go to the sanei directory.

* int
  pv8630_reset_buttons (int fd)
  Should be static as everything but the sane_ API functions. If a
  symbol needs to be visible for others, please use sanei_hp4200_* as
  a name.
  
  To find out about "illegal" symbols: 
  ./configure --enable-static
  make
  make libcheck

-->
| Libraries exporting 'illegal' symbols:
| *** backend/.libs/libsane-gt68xx.a:
| 000075c0 T gt6801_u16b_download_firmware

Ooops. This nasty author of the gt68xx backend, I'll kick him! :-)

*** backend/.libs/libsane-hp4200.a:
00001e30 T do_coarse_calibration
00002950 T do_fine_calibration
00000100 T hp4200c_what_button
00003ec0 T hp4200_init_scanner
00003850 T prepare_for_a_scan
00000090 T pv8630_read_buttons
00000040 T pv8630_reset_buttons
00000ce0 T read_available_data
00001b90 T read_required_bytes
000013a0 T write_gamma
000000d0 T lm9830_dump_registers
000002a0 T lm9830_ini_scanner
00000160 T lm9830_lamp_off
00000200 T lm9830_lamp_on
00000000 T lm9830_read_register
000003f0 T lm9830_reset
00000070 T lm9830_write_register

* open/close on USB devices

| static SANE_Status
| add_device (SANE_String_Const name, HP4200_Device **argpd)
[...]
|   fd = open (name, O_RDONLY);
|   if (fd == -1)  
[...]

This won't work with libusb devices. You can't just use open() for
them. Use the sanei_usb functions intead. The same is true for every
read(), write(), open(), close() etc.

E.g. you should not close() a "fd" opened with sanei_usb. In fact,
that's not a file descriptor but some random number.

lm9830.c:

* see comment about name above
  
* see comment about name of symbols above

tools/Makefile.in:
* update DISTFILES

  
Compilation:
I'm getting the following warnings:

hp4200.c:164: warning: no previous prototype for `pv8630_reset_buttons'
hp4200.c:172: warning: no previous prototype for `pv8630_read_buttons'
hp4200.c: In function `hp4200_goto_home':
hp4200.c:545: warning: implicit declaration of function `usleep'
hp4200.c: At top level:
hp4200.c:595: warning: no previous prototype for `read_available_data'
hp4200.c: In function `read_available_data':
hp4200.c:625: warning: pointer targets in passing arg 2 of `sanei_usb_read_bulk' differ in signedness
hp4200.c:625: warning: pointer targets in passing arg 3 of `sanei_usb_read_bulk' differ in signedness
hp4200.c: At top level:
hp4200.c:825: warning: no previous prototype for `write_gamma'
hp4200.c: In function `write_default_offset_gain':
hp4200.c:901: warning: pointer targets in passing arg 2 of `sanei_usb_write_bulk' differ in signedness
hp4200.c:916: warning: pointer targets in passing arg 2 of `sanei_usb_read_bulk' differ in signedness
hp4200.c: At top level:
hp4200.c:1098: warning: no previous prototype for `read_required_bytes'
hp4200.c: In function `read_required_bytes':
hp4200.c:1131: warning: pointer targets in passing arg 2 of `sanei_usb_read_bulk' differ in signedness
hp4200.c:1131: warning: pointer targets in passing arg 3 of `sanei_usb_read_bulk' differ in signedness
hp4200.c: In function `scanner_buffer_read':
hp4200.c:1182: warning: pointer targets in passing arg 2 of `read_available_data' differ in signedness
hp4200.c: At top level:
hp4200.c:1193: warning: no previous prototype for `do_coarse_calibration'
hp4200.c: In function `do_coarse_calibration':
hp4200.c:1339: warning: pointer targets in passing arg 3 of `read_required_bytes' differ in signedness
hp4200.c: At top level:
hp4200.c:1521: warning: no previous prototype for `do_fine_calibration'
hp4200.c: In function `do_fine_calibration':
hp4200.c:1674: warning: pointer targets in passing arg 3 of `read_required_bytes' differ in signedness
hp4200.c: At top level:
hp4200.c:1986: warning: no previous prototype for `prepare_for_a_scan'
hp4200.c:2167: warning: no previous prototype for `hp4200_init_scanner'
hp4200.c: In function `add_device':
hp4200.c:2445: warning: implicit declaration of function `strdup'
hp4200.c:2445: warning: assignment makes pointer from integer without a cast
hp4200.c:2446: warning: assignment makes pointer from integer without a cast
hp4200.c:2447: warning: assignment makes pointer from integer without a cast
hp4200.c:2448: warning: assignment makes pointer from integer without a cast
hp4200.c: In function `sane_hp4200_init':
hp4200.c:2477: warning: unused parameter `authorize'
hp4200.c: In function `sane_hp4200_set_io_mode':
hp4200.c:3037: warning: unused parameter `h'
hp4200.c: In function `sane_hp4200_get_select_fd':
hp4200.c:3047: warning: unused parameter `h'
hp4200.c:3047: warning: unused parameter `fd'
hp4200.c: At top level:
hp4200.c:497: warning: `dump_register_cache' defined but not used
hp4200.c:653: warning: `compute_datalink_bandwidth' defined but not used
lm9830.c:53: warning: no previous prototype for `lm9830_read_register'
lm9830.c:66: warning: no previous prototype for `lm9830_write_register'
lm9830.c:78: warning: no previous prototype for `lm9830_dump_registers'
lm9830.c:97: warning: no previous prototype for `lm9830_lamp_off'
lm9830.c:108: warning: no previous prototype for `lm9830_lamp_on'
lm9830.c:119: warning: no previous prototype for `lm9830_ini_scanner'
lm9830.c: In function `lm9830_ini_scanner':
lm9830.c:120: warning: unused variable `inittable'
lm9830.c: At top level:
lm9830.c:170: warning: no previous prototype for `lm9830_reset'
lm9830.c: In function `lm9830_reset':
lm9830.c:172: warning: implicit declaration of function `usleep'

A manual page is missing.

Otherwise I don't see any major problems. It compiles at least on
Linux and doesn't seem to cause any harm to my non-HP scanners :-)

Good work!

Bye,
  Henning





More information about the sane-devel mailing list