Re: always Segmentation Fault

From: abel deuring (adeuring@gmx.net)
Date: Sun Feb 25 2001 - 05:57:43 PST

  • Next message: Peter Kirchgessner: "Re: HP 5100C and SANE"

    "Christoph H." wrote:
    >
    > Hi!
    >
    > A few month ago I changed my system from Slackware 7 to Debian 2.2.
    > Under Slackware I used my Mustek ScanExpress 12000 SP without problems, but
    > now (under Debian) I always get a Segmentation Fault error with any of the programs included
    > in the sane-package, if they try to access the scanner device /dev/sg2.
    > Nothing was changed of the hardware configuration!
    >
    > My configuration:
    > - SCSI-adapter: AHA-2940U PCI
    > - Scanner: Mustek 12000-SP
    > - Linux: Debian 2.2 Potato
    > - Kernel: 2.2.17 (self-compiled with support for generic SCSI devices (32k buffer))
    >
    > I tried it with:
    > - Sane 1.0.1 (included in Debian 2.2)
    > - Sane 1.0.3 (self-compiled)
    > - Sane 1.0.4 (self-compiled)
    > --> always the same: Segmentation fault
    >
    > I don't know what to do, please help me.
    >
    > Perhaps the strace-output of scanimage can help you to give me a hint how to solve the problem:
    > (I think it has something to do with the "inappropriate ioctl for device"-error at the end of the output)

    Christoph,

    This is probably caused by sanei_scsi_open_extended. This function uses
    some ioctl calls to detect the version of the SG driver. If the "get
    version" ioctl fails, Sane assumes that the oldest SG driver is
    installed.

    >
    > ------------------------------
    > # strace /usr/local/bin/scanimage
    [...]
    > open("/dev/sg2", O_RDWR) = 6
    > close(6) = 0
    > open("/proc/sys/kernel/sg-big-buff", O_RDONLY) = 6
    > read(6, "32768\n", 31) = 6
    > close(6) = 0
    > open("/dev/sg2", O_RDWR|O_EXCL) = 6
    > ioctl(6, TIOCSCCINI, 0xbfffca88) = -1 ENOTTY (Inappropriate ioctl for device)
    > ioctl(6, TIOCGKISS, 0x40169c60) = -1 ENOTTY (Inappropriate ioctl for device)
    > brk(0x8054000) = 0x8054000
    > rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
    > rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
    > rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
    > write(6, "*\0\0\0\204\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 42) = 42
    > rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
    > select(7, [6], NULL, NULL, NULL) = 1 (in [6])
    > rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
    > read(6, "", 132) = 0

    The return value 0 for the read call is weird. A read call to the SG
    driver should return at least sizeof(sg_header) bytes.

    > rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
    > --- SIGSEGV (Segmentation fault) ---
    > +++ killed by SIGSEGV +++

    The segfault below is probably caused by:

            nread = read (req->fd, &req->sgdata.cdb,
    req->sgdata.cdb.hdr.reply_len);
            [...]
            nread -= sizeof (req->sgdata.cdb.hdr);
            [...]
            memcpy (req->dst, req->sgdata.cdb.data, nread);

    in sanei_scsi_req_wait.

    I'd recommend to install a more recent version of the SG driver.

    Abel

    --
    Source code, list archive, and docs: http://www.mostang.com/sane/
    To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com
    



    This archive was generated by hypermail 2b29 : Sun Feb 25 2001 - 05:39:25 PST