[sane-devel] [ANNOUNCE] Support for Mustek Paragon 600 II EP
added to Mustek backend
Julien BLACHE
jb@jblache.org
Thu, 25 Dec 2003 22:58:15 +0100
--=-=-=
Henning Meier-Geinitz <henning@meier-geinitz.de> wrote:
Hi,
> It currently only works with direct hardware access. libiee1284 is not
> supported. If it's detected during configure stage, that scanner will
> not work. So for testing, disable libieee1284 (e.g. remove the header
> files) and run configure --enable-parport-directio. If anyone has
> experience with libieee1284, could you try to add support to the three
> new functions in sanei_pa4s2.c? They all start like this
> sanei_pa4s2_scsi_pp.
Here's a first patch for libieee1284. It's quite easy to do as it's
very similar to the other functions in that file.
I have doubt about this line, in sanei_pa4s2_scsi_pp_get_status (end
of the function) :
stat = inbyte1 (fd)^0x80;
inbyte1() is a macro, and when libieee1284 is in use, the value is
already XORed with 0x80. I don't know whether this is OK or not, so
someone should _really_ test that before it goes into CVS.
JB.
--
Julien BLACHE <http://www.jblache.org>
<jb@jblache.org> GPG KeyID 0xF5D65169
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=sanei_pa4s2.c-ieee1284.patch
Content-Description: sanei_pa4s2.c libieee1284 patch
Index: sanei_pa4s2.c
===================================================================
RCS file: /cvsroot/sane/sane-backends/sanei/sanei_pa4s2.c,v
retrieving revision 1.10
diff -u -r1.10 sanei_pa4s2.c
--- sanei_pa4s2.c 25 Dec 2003 20:27:49 -0000 1.10
+++ sanei_pa4s2.c 25 Dec 2003 21:53:57 -0000
@@ -971,12 +971,11 @@
DBG (6, "sanei_pa4s2_scsi_pp_get_status: called for fd %d\n",
fd);
-#if defined (HAVE_LIBIEEE1284)
- DBG (3, "sanei_pa4s2_scsi_pp_get_status: not implemented yet for libieee1284\n");
- return SANE_STATUS_UNSUPPORTED;
+#if defined(HAVE_LIBIEEE1284)
+ if ((fd < 0) || (fd >= pplist.portc))
#else
-
if ((fd < 0) || (fd >= NELEMS (port)))
+#endif
{
DBG (2, "sanei_pa4s2_scsi_pp_get_status: invalid fd %d\n", fd);
@@ -990,8 +989,13 @@
{
DBG (2, "sanei_pa4s2_scsi_pp_get_status: port is not in use\n");
+#if defined(HAVE_LIBIEEE1284)
+ DBG (4, "sanei_pa4s2_scsi_pp_get_status: port is '%s'\n",
+ pplist.portv[fd]->name);
+#else
DBG (6, "sanei_pa4s2_scsi_pp_get_status: port is 0x%03lx\n",
port[fd].base);
+#endif
DBG (5, "sanei_pa4s2_scsi_pp_get_status: returning SANE_STATUS_INVAL\n");
return SANE_STATUS_INVAL;
@@ -1002,20 +1006,24 @@
{
DBG (2, "sanei_pa4s2_scsi_pp_get_status: port is not enabled\n");
+#if defined(HAVE_LIBIEEE1284)
+ DBG (4, "sanei_pa4s2_scsi_pp_get_status: port is '%s'\n",
+ pplist.portv[fd]->name);
+#else
DBG (6, "sanei_pa4s2_scsi_pp_get_status: port is 0x%03lx\n",
port[fd].base);
+#endif
DBG (5, "sanei_pa4s2_scsi_pp_get_status: returning SANE_STATUS_INVAL\n");
return SANE_STATUS_INVAL;
}
- outb(0x4, port[fd].base+2);
- stat=inb(port[fd].base+1)^0x80;
- *status=(stat&0x2f)|((stat&0x10)<<2)|((stat&0x40)<<1)|((stat&0x80)>>3);
+ outbyte2 (fd, 0x4);
+ stat = inbyte1 (fd)^0x80;
+ *status = (stat&0x2f)|((stat&0x10)<<2)|((stat&0x40)<<1)|((stat&0x80)>>3);
DBG (5, "sanei_pa4s2_scsi_pp_get_status: status=0x%02X\n", *status);
DBG (6, "sanei_pa4s2_scsi_pp_get_status: returning SANE_STATUS_GOOD\n");
-#endif
return SANE_STATUS_GOOD;
}
@@ -1027,15 +1035,13 @@
SANE_Status
sanei_pa4s2_scsi_pp_reg_select (int fd, int reg)
{
- int base;
-
TEST_DBG_INIT ();
-#if defined (HAVE_LIBIEEE1284)
- DBG (3, "sanei_pa4s2_scsi_pp_reg_select: not implemented yet for libieee1284\n");
- return SANE_STATUS_UNSUPPORTED;
+#if defined(HAVE_LIBIEEE1284)
+ if ((fd < 0) || (fd >= pplist.portc))
#else
if ((fd < 0) || (fd >= NELEMS (port)))
+#endif
{
DBG (2, "sanei_pa4s2_scsi_pp_reg_select: invalid fd %d\n", fd);
@@ -1049,8 +1055,13 @@
{
DBG (2, "sanei_pa4s2_scsi_pp_reg_select: port is not in use\n");
- DBG (6, "sanei_pa4s2_scsi_pp_reg_select: port is 0x%03lx\n",
+#if defined(HAVE_LIBIEEE1284)
+ DBG (4, "sanei_pa4s2_scsi_pp_get_status: port is '%s'\n",
+ pplist.portv[fd]->name);
+#else
+ DBG (6, "sanei_pa4s2_scsi_pp_get_status: port is 0x%03lx\n",
port[fd].base);
+#endif
DBG (5, "sanei_pa4s2_scsi_pp_reg_select: returning SANE_STATUS_INVAL\n");
return SANE_STATUS_INVAL;
@@ -1061,27 +1072,34 @@
{
DBG (2, "sanei_pa4s2_scsi_pp_reg_select: port is not enabled\n");
- DBG (6, "sanei_pa4s2_scsi_pp_reg_select: port is 0x%03lx\n",
+#if defined(HAVE_LIBIEEE1284)
+ DBG (4, "sanei_pa4s2_scsi_pp_get_status: port is '%s'\n",
+ pplist.portv[fd]->name);
+#else
+ DBG (6, "sanei_pa4s2_scsi_pp_get_status: port is 0x%03lx\n",
port[fd].base);
+#endif
DBG (5, "sanei_pa4s2_scsi_pp_reg_select: returning SANE_STATUS_INVAL\n");
return SANE_STATUS_INVAL;
}
- base=port[fd].base;
-
+#if defined(HAVE_LIBIEEE1284)
+ DBG (6, "sanei_pa4s2_scsi_pp_reg_select: selecting register %u at port '%s'\n",
+ (int) reg, pplist.portv[fd]->name);
+#else
DBG (6, "sanei_pa4s2_scsi_pp_reg_select: selecting register %u at 0x%03x\n",
- (int) reg, base);
+ (int) reg, port[fd].base);
+#endif
- outb (reg | 0x58, base + 0);
- outb (0x04, base + 2);
- outb (0x06, base + 2);
- outb (0x04, base + 2);
- outb (0x04, base + 2);
+ outbyte0 (fd, reg | 0x58);
+ outbyte2 (fd, 0x04);
+ outbyte2 (fd, 0x06);
+ outbyte2 (fd, 0x04);
+ outbyte2 (fd, 0x04);
return SANE_STATUS_GOOD;
-#endif
}
/*
@@ -1101,10 +1119,6 @@
DBG(4, "sanei_pa4s2_scsi_pp_open: called for device '%s'\n", dev);
DBG(5, "sanei_pa4s2_scsi_pp_open: trying to connect to port\n");
-#if defined (HAVE_LIBIEEE1284)
- DBG (3, "sanei_pa4s2_scsi_pp_open: not implemented yet for libieee1284\n");
- return SANE_STATUS_UNSUPPORTED;
-#else
if ((*fd = pa4s2_open (dev, &status)) == -1)
{
@@ -1154,7 +1168,6 @@
DBG (4, "sanei_pa4s2_scsi_pp_open: returning SANE_STATUS_GOOD\n");
return SANE_STATUS_GOOD;
-#endif
}
SANE_Status
--=-=-=--