LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 07-14-2006, 04:34 PM   #1
trigggl
Member
 
Registered: Dec 2004
Location: Jacksonville, AR
Distribution: Debian Etch, AIX, Slackware
Posts: 117

Rep: Reputation: 15
trying to install LEXUSB-SCANNER


After using Linux for a few years and using Debian Sarge since it came out, I'm starting to gain confidence that I can get my Lexmark All-in-one to actually scan. Lexmark has actually put together some drivers, but they are for Red Hat and Suse. Also, they are for the 2.4 kernel. The major holdup at this point is getting the USB scanner driver installed. Unfortunately, it comes with a makefile that is very incompatible with Debian. Let me list the Makefile and then I'll proceed.

Code:
#Makefile for lxkscanner USB scanner device driver

INCLUDEDIR = /usr/src/kernel-headers-`uname -r`/include
ifneq ($(INCLUDE),)
INCLUDEDIR = $(INCLUDE)
endif

CC = gcc
MODVERSION = $(INCLUDEDIR)/linux/modversions.h
MODULEDIR = /lib/modules/`uname -r`/kernel/drivers/usb
#ETCDIR = /etc/init.d
CFLAGS = -DMODULE -D__KERNEL__ -I$(INCLUDEDIR) -include $(MODVERSION)

lxkscanner.o:lxkscanner.c
        $(CC) $(CFLAGS) -c lxkscanner.c
install:
        cp -f lxkscanner.o $(MODULEDIR)
        sh lxkscanner_load
#       cp -f lxkscanner_load $(ETCDIR)
uninstall:
        /sbin/modprobe -r lxkscanner
        rm -rf $(MODULEDIR)/lxkscanner.o
#       rm -rf $(ETCDIR)/lxkscanner_load
clean:
        rm -rf lxkscanner.o
I've already made some edits to this file. I corrected the path to the kernel headers. Apparently, Red Hat uses "linux" instead of "kernel-headers" on the third line. My biggest problem is line 8.

Code:
MODVERSION = $(INCLUDEDIR)/linux/modversions.h
the Debian 2.6 headers don't have this file. Another line I had to edit was
Code:
#ETCDIR = /etc/init.d
I think we all know why I needed to change this one. Maybe I should set up a symbolic link from rc.d.

The rest I'm not even going to get into until I figure the modversion.h problem out. Does anyone know how better to edit this file? I'm thinking it needs a some help. I can list lxkscanner.o and lxkscanner.c if necessary.
 
Old 07-14-2006, 11:21 PM   #2
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 58
go to /usr/src/kernel-headers-`uname -r`/ and run 'make dep'.. does that create the necessary file? ive read thats what you can do to make it.
 
Old 07-14-2006, 11:57 PM   #3
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 3,513

Rep: Reputation: 63
If you install the kernel-headers or linux-headers package for your running kernel it should get you the proper modversion.h for your kernel. You will most likely need to install the module-assistant package and run m-a prepare this will make sure that the headers are correctly setup for building kernel modules. Just read the man m-a again and apparently it should download/install the proper headers for you when using prepare.
 
Old 07-15-2006, 08:23 AM   #4
trigggl
Member
 
Registered: Dec 2004
Location: Jacksonville, AR
Distribution: Debian Etch, AIX, Slackware
Posts: 117

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by nadroj
go to /usr/src/kernel-headers-`uname -r`/ and run 'make dep'.. does that create the necessary file? ive read thats what you can do to make it.
Code:
fangorn:/usr/src/kernel-headers-2.6.8-3-686# make dep
*** Warning: make dep is unnecessary now.
fangorn:/usr/src/kernel-headers-2.6.8-3-686#
Apparently either Debian Sarge or 2.6.8 don't do modversions. So, back to what I really need help with.

How do I edit this Makefile to my needs? I guess I can post some of the beginning errors from the make command.

Code:
fangorn:/home/greg/lexmark/LEXUSB-SCANNER-1.0-1# make
gcc -DMODULE -D__KERNEL__ -I/usr/src/kernel-headers-`uname -r`/include -include /usr/src/kernel-headers-`uname -r`/include/linux/modversions.h -c lxkscanner.c
<command line>:138477835:336: /usr/src/kernel-headers-2.6.8-3-686/include/linux/modversions.h: No such file or directory
In file included from /usr/src/kernel-headers-2.6.8-3-686/include/linux/irq.h:20,
                 from /usr/src/kernel-headers-2.6.8-3-686/include/asm/hardirq.h:6,
                 from /usr/src/kernel-headers-2.6.8-3-686/include/linux/interrupt.h:12,
                 from /usr/src/kernel-headers-2.6.8-3-686/include/linux/usb.h:15,
                 from lxkscanner.h:54,
                 from lxkscanner.c:358:
/usr/src/kernel-headers-2.6.8-3-686/include/asm/irq.h:16:25: irq_vectors.h: No such file or directory
In file included from /usr/src/kernel-headers-2.6.8-3-686/include/asm/hardirq.h:6,
                 from /usr/src/kernel-headers-2.6.8-3-686/include/linux/interrupt.h:12,
                 from /usr/src/kernel-headers-2.6.8-3-686/include/linux/usb.h:15,
                 from lxkscanner.h:54,
                 from lxkscanner.c:358:
/usr/src/kernel-headers-2.6.8-3-686/include/linux/irq.h:70: error: `NR_IRQS' undeclared here (not in a function)
In file included from /usr/src/kernel-headers-2.6.8-3-686/include/linux/irq.h:72,
                 from /usr/src/kernel-headers-2.6.8-3-686/include/asm/hardirq.h:6,
                 from /usr/src/kernel-headers-2.6.8-3-686/include/linux/interrupt.h:12,
                 from /usr/src/kernel-headers-2.6.8-3-686/include/linux/usb.h:15,
                 from lxkscanner.h:54,
                 from lxkscanner.c:358:
/usr/src/kernel-headers-2.6.8-3-686/include/asm/hw_irq.h:28: error: `NR_IRQ_VECTORS' undeclared here (not in a function)
Just for grins, I'll go ahead and include the other files(no pun intended).
lxkscanner.h
Code:
/*
 * Driver for USB Scanners (linux-2.4.18)
 *
 * Copyright (C) 2004, Lexmark International, Inc.
 * Copyright (C) 1999, 2000, 2001, 2002 David E. Nelson
 *
 * Brian Beattie <beattie@beattie-home.net>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * History
 *
 *   0.1  5/22/2004
 *      - Added a new structure to solve inconsistency in declaration
 *      among some Linux distributions
 *      - Added vendor and product ID's of Lexmark devices
 */

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <asm/uaccess.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/ioctl.h>
#include <linux/sched.h>
#include <linux/smp_lock.h>
#include <linux/devfs_fs_kernel.h>

// #define DEBUG

/* Enable this to support the older ioctl interfaces scanners that
 * a PV8630 Scanner-On-Chip.  The prefered method is the
 * SCANNER_IOCTL_CTRLMSG ioctl.
 */
// #define PV8630

#define DRIVER_VERSION "0.4.6"
#define DRIVER_DESC "USB Scanner Driver"

#include <linux/usb.h>

static __s32 vendor=-1, product=-1, read_timeout=0;

MODULE_AUTHOR("Brian Beattie, beattie@beattie-home.net");
MODULE_DESCRIPTION(DRIVER_DESC" "DRIVER_VERSION);
MODULE_LICENSE("GPL");

MODULE_PARM(vendor, "i");
MODULE_PARM_DESC(vendor, "User specified USB idVendor");
MODULE_PARM(product, "i");
MODULE_PARM_DESC(product, "User specified USB idProduct");

MODULE_PARM(read_timeout, "i");
MODULE_PARM_DESC(read_timeout, "User specified read timeout in seconds");


/* WARNING: These DATA_DUMP's can produce a lot of data. Caveat Emptor. */
// #define RD_DATA_DUMP /* Enable to dump data - limited to 24 bytes */
// #define WR_DATA_DUMP /* DEBUG does not have to be defined. */

static struct usb_device_id scanner_device_ids [] = {
        /* Lexmark */
        { USB_DEVICE(0x043d, 0x0093) }, /* X5250 */
        { USB_DEVICE(0x043d, 0x0065) }, /* X5100 */
        { USB_DEVICE(0x043d, 0x0098) },
        { USB_DEVICE(0x043d, 0x0097) },
        { }                             /* Terminating entry */
};

MODULE_DEVICE_TABLE (usb, scanner_device_ids);

#define IS_EP_BULK(ep)  ((ep).bmAttributes == USB_ENDPOINT_XFER_BULK ? 1 : 0)
#define IS_EP_BULK_IN(ep) (IS_EP_BULK(ep) && ((ep).bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN)
#define IS_EP_BULK_OUT(ep) (IS_EP_BULK(ep) && ((ep).bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT)
#define IS_EP_INTR(ep) ((ep).bmAttributes == USB_ENDPOINT_XFER_INT ? 1 : 0)

#define USB_SCN_MINOR(X) MINOR((X)->i_rdev) - SCN_BASE_MNR

#ifdef DEBUG
#define SCN_DEBUG(X) X
#else
#define SCN_DEBUG(X)
#endif

#define IBUF_SIZE 32768
#define OBUF_SIZE 4096

/* read_scanner timeouts -- RD_NAK_TIMEOUT * RD_EXPIRE = Number of seconds */
#define RD_NAK_TIMEOUT (10*HZ)  /* Default number of X seconds to wait */
#define RD_EXPIRE 12            /* Number of attempts to wait X seconds */


/* FIXME: These are NOT registered ioctls()'s */
#ifdef PV8630
#define PV8630_IOCTL_INREQUEST 69
#define PV8630_IOCTL_OUTREQUEST 70
#endif /* PV8630 */


/* read vendor and product IDs from the scanner */
#define SCANNER_IOCTL_VENDOR _IOR('U', 0x20, int)
#define SCANNER_IOCTL_PRODUCT _IOR('U', 0x21, int)
/* send/recv a control message to the scanner */
#define SCANNER_IOCTL_CTRLMSG _IOWR('U', 0x22, devrequest_lxk)


#define SCN_MAX_MNR 16          /* We're allocated 16 minors */
#define SCN_BASE_MNR 48         /* USB Scanners start at minor 48 */

static DECLARE_MUTEX (scn_mutex); /* Initializes to unlocked */

struct scn_usb_data {
        struct usb_device *scn_dev;
        devfs_handle_t devfs;   /* devfs device */
        struct urb scn_irq;
        unsigned int ifnum;     /* Interface number of the USB device */
        kdev_t scn_minor;       /* Scanner minor - used in disconnect() */
        unsigned char button;   /* Front panel buffer */
        char isopen;            /* Not zero if the device is open */
        char present;           /* Not zero if device is present */
        char *obuf, *ibuf;      /* transfer buffers */
        char bulk_in_ep, bulk_out_ep, intr_ep; /* Endpoint assignments */
        wait_queue_head_t rd_wait_q; /* read timeouts */
        struct semaphore sem; /* lock to prevent concurrent reads or writes */
        unsigned int rd_nak_timeout; /* Seconds to wait before read() timeout. */
};

extern devfs_handle_t usb_devfs_handle;

static struct scn_usb_data *p_scn_table[SCN_MAX_MNR] = { NULL, /* ... */};

static struct usb_driver scanner_driver;

typedef struct {
        __u8 requesttype;
        __u8 request;
        __u16 value;
        __u16 index;
        __u16 length;
} devrequest_lxk __attribute__ ((packed));
I'll post lxkscanner.c and lxkscanner_load after doing finances.
 
Old 07-15-2006, 11:14 AM   #5
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 3,513

Rep: Reputation: 63
Looks like you have the wrong path to the modversion.h.

Code:
 apt-file search modversions.h | grep headers
linux-headers-2.6.15-1: usr/src/linux-headers-2.6.15-1/include/config/modversions.h
linux-headers-2.6.15-1-amd64-generic: usr/src/linux-headers-2.6.15-1-amd64-generic/include/config/modversions.h
linux-headers-2.6.15-1-amd64-k8: usr/src/linux-headers-2.6.15-1-amd64-k8/include/config/modversions.h
linux-headers-2.6.15-1-amd64-k8-smp: usr/src/linux-headers-2.6.15-1-amd64-k8-smp/include/config/modversions.h
linux-headers-2.6.15-1-em64t-p4: usr/src/linux-headers-2.6.15-1-em64t-p4/include/config/modversions.h
linux-headers-2.6.15-1-em64t-p4-smp: usr/src/linux-headers-2.6.15-1-em64t-p4-smp/include/config/modversions.h
You need /include/config and for the irq_vectors.h file not found you need the linux-kernel-headers package installed.
Code:
apt-file search irq_vectors.h
linux-kernel-headers: usr/include/asm-i386/mach-default/irq_vectors.h
linux-kernel-headers: usr/include/asm-i386/mach-visws/irq_vectors.h
linux-kernel-headers: usr/include/asm-i386/mach-voyager/irq_vectors.h
linux-kernel-headers: usr/include/asm/mach-default/irq_vectors.h
linux-kernel-headers: usr/include/asm/mach-visws/irq_vectors.h
linux-kernel-headers: usr/include/asm/mach-voyager/irq_vectors.h
 
Old 07-15-2006, 05:10 PM   #6
trigggl
Member
 
Registered: Dec 2004
Location: Jacksonville, AR
Distribution: Debian Etch, AIX, Slackware
Posts: 117

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by HappyTux
Looks like you have the wrong path to the modversion.h.

Code:
 apt-file search modversions.h | grep headers
linux-headers-2.6.15-1: usr/src/linux-headers-2.6.15-1/include/config/modversions.h
linux-headers-2.6.15-1-amd64-generic: usr/src/linux-headers-2.6.15-1-amd64-generic/include/config/modversions.h
linux-headers-2.6.15-1-amd64-k8: usr/src/linux-headers-2.6.15-1-amd64-k8/include/config/modversions.h
linux-headers-2.6.15-1-amd64-k8-smp: usr/src/linux-headers-2.6.15-1-amd64-k8-smp/include/config/modversions.h
linux-headers-2.6.15-1-em64t-p4: usr/src/linux-headers-2.6.15-1-em64t-p4/include/config/modversions.h
linux-headers-2.6.15-1-em64t-p4-smp: usr/src/linux-headers-2.6.15-1-em64t-p4-smp/include/config/modversions.h
You need /include/config and for the irq_vectors.h file not found you need the linux-kernel-headers package installed.
Code:
apt-file search irq_vectors.h
linux-kernel-headers: usr/include/asm-i386/mach-default/irq_vectors.h
linux-kernel-headers: usr/include/asm-i386/mach-visws/irq_vectors.h
linux-kernel-headers: usr/include/asm-i386/mach-voyager/irq_vectors.h
linux-kernel-headers: usr/include/asm/mach-default/irq_vectors.h
linux-kernel-headers: usr/include/asm/mach-visws/irq_vectors.h
linux-kernel-headers: usr/include/asm/mach-voyager/irq_vectors.h
I don't know why this is but I have the headers installed and they aren't in the same path.
Code:
fangorn:/home/greg/lexmark# ls /usr/src/
alsa-driver.tar.bz2         kernel-kbuild-2.6-3
kernel-headers-2.6.8-2      kernel-patches
kernel-headers-2.6.8-2-686  kernel-source-2.6.8
kernel-headers-2.6.8-3      kernel-source-2.6.8.tar.bz2
kernel-headers-2.6.8-3-686  rpm
fangorn:/home/greg/lexmark#
 
Old 07-15-2006, 05:39 PM   #7
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 3,513

Rep: Reputation: 63
The second package I mention is a different header package the kernel-headers you have in /usr/src are the correct location for them. Do you have a URL where the package is so I can try to compile it myself and what is the model number of the all-in-one you have?
 
Old 07-17-2006, 05:47 AM   #8
trigggl
Member
 
Registered: Dec 2004
Location: Jacksonville, AR
Distribution: Debian Etch, AIX, Slackware
Posts: 117

Original Poster
Rep: Reputation: 15
Here's the needle-in-a-haystack page for the USB driver.
USBLEX
The actual AIO drivers are on this page.
My AIO is an X1150 which actually uses the z600 driver to print. I have successfully printed before, just not scanned. The z600 driver isn't installing for me either at the moment.
 
Old 07-17-2006, 06:38 AM   #9
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 1,748

Rep: Reputation: 159Reputation: 159
Quote:
Originally Posted by trigggl
Sometimes it does take a Brain Surgeon.
What's the deal there??

Looks like it was some pretty serious surgery.
 
Old 07-17-2006, 01:20 PM   #10
trigggl
Member
 
Registered: Dec 2004
Location: Jacksonville, AR
Distribution: Debian Etch, AIX, Slackware
Posts: 117

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by rkelsen
What's the deal there??

Looks like it was some pretty serious surgery.
It left a nice scar, too. Good thing I never lost my hair. I just got a short haircut, so it's visible, but usually my hair is too long to see it.

I woke up in the hospital one day and my wife told me I had a tumor and needed surgery. The surgeon took out as much as he dared and used some of it for a biopsy. I'll take that over what followed, a year of chemo. I've been in remission for about 8 months.
 
Old 07-17-2006, 09:16 PM   #11
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 3,513

Rep: Reputation: 63
Quote:
Originally Posted by trigggl
Here's the needle-in-a-haystack page for the USB driver.
USBLEX
The actual AIO drivers are on this page.
My AIO is an X1150 which actually uses the z600 driver to print. I have successfully printed before, just not scanned. The z600 driver isn't installing for me either at the moment.
Now I know the model I did a search and found this page which suggest you do not need the lexmark driver that you can use sane.
 
Old 07-18-2006, 01:34 PM   #12
trigggl
Member
 
Registered: Dec 2004
Location: Jacksonville, AR
Distribution: Debian Etch, AIX, Slackware
Posts: 117

Original Poster
Rep: Reputation: 15
I installed it. Now, I just need to get xsane to use it. Maybe I should use some options to force it to install in the /usr dir instead of /usr/local. I wonder if those directions are in the README files?
 
Old 07-18-2006, 01:59 PM   #13
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 3,513

Rep: Reputation: 63
Quote:
Originally Posted by trigggl
I installed it. Now, I just need to get xsane to use it. Maybe I should use some options to force it to install in the /usr dir instead of /usr/local. I wonder if those directions are in the README files?
It may not really necessary if it does not find the libraries put /usr /local/lib is in the /etc/ld.so.conf file and run ldconfig.
 
Old 07-19-2006, 05:04 AM   #14
trigggl
Member
 
Registered: Dec 2004
Location: Jacksonville, AR
Distribution: Debian Etch, AIX, Slackware
Posts: 117

Original Poster
Rep: Reputation: 15
Another road block. I get this error window when I run 'xsane'.
Quote:
Failed to open device 'lexmark:/dev/usb/scanner0':
Invalid argument.
I looked in /dev/usb and the only thing there is lp0. I don't know if this error message is telling me it wasn't there or that it couldn't create it.
 
Old 07-19-2006, 12:04 PM   #15
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 3,513

Rep: Reputation: 63
Quote:
Originally Posted by trigggl
Another road block. I get this error window when I run 'xsane'.
I looked in /dev/usb and the only thing there is lp0. I don't know if this error message is telling me it wasn't there or that it couldn't create it.
OK as root in the /dev directory use MAKEDEV usb that should create all the usb device nodes if you want to see what will be created be doing it use MAKEDEV -n usb for a dry run.
 
  


Reply

Tags
lexmark, usb


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot install scanner payasam Mandriva 4 08-04-2006 07:01 PM
How do you install a scanner in redhat? dmcorda Linux - Newbie 2 08-22-2004 08:56 PM
Install a Scanner in Slackware simeandrews Linux - Hardware 2 06-07-2004 02:03 PM
Help to Install SCSI controler for Scanner kayeway Linux - Hardware 1 09-25-2003 07:23 AM
Install scanner in SuSE Mark_Grieveson Linux - Distributions 10 08-03-2003 02:11 AM


All times are GMT -5. The time now is 07:10 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration