Fixed segfault when opening device again after closing and possible segfault

when name="". Type for option 0 must be set to SANE_TYPE_INT
explicitely. Updated GPL/SANE headers.
Henning Meier-Geinitz <henning@meier-geinitz.de>
DEVEL_2_0_BRANCH-1
Henning Geinitz 2002-03-17 20:20:46 +00:00
rodzic 6ed9bcc2fa
commit ad701cc3de
9 zmienionych plików z 51 dodań i 25 usunięć

Wyświetl plik

@ -1,9 +1,9 @@
/* sane - Scanner Access Now Easy. /* sane - Scanner Access Now Easy.
Copyright (C) 2000 Mustek. Copyright (C) 2000 Mustek.
Maintained by Tom Wang <tom.wang@mustek.com.tw> Originally maintained by Tom Wang <tom.wang@mustek.com.tw>
Updates (C) 2001 by Henning Meier-Geinitz. Copyright (C) 2001, 2002 by Henning Meier-Geinitz.
This file is part of the SANE package. This file is part of the SANE package.
@ -44,9 +44,9 @@
If you do not wish that, delete this exception notice. If you do not wish that, delete this exception notice.
This file implements a SANE backend for Mustek 1200UB and similar This file implements a SANE backend for Mustek 1200UB and similar
flatbed scanners. */ USB flatbed scanners. */
#define BUILD 10 #define BUILD 11
#include "../include/sane/config.h" #include "../include/sane/config.h"
@ -254,6 +254,7 @@ init_options (Mustek_Usb_Scanner * s)
s->opt[OPT_NUM_OPTS].title = SANE_TITLE_NUM_OPTIONS; s->opt[OPT_NUM_OPTS].title = SANE_TITLE_NUM_OPTIONS;
s->opt[OPT_NUM_OPTS].desc = SANE_DESC_NUM_OPTIONS; s->opt[OPT_NUM_OPTS].desc = SANE_DESC_NUM_OPTIONS;
s->opt[OPT_NUM_OPTS].type = SANE_TYPE_INT;
s->opt[OPT_NUM_OPTS].cap = SANE_CAP_SOFT_DETECT; s->opt[OPT_NUM_OPTS].cap = SANE_CAP_SOFT_DETECT;
s->val[OPT_NUM_OPTS].w = NUM_OPTIONS; s->val[OPT_NUM_OPTS].w = NUM_OPTIONS;
@ -917,6 +918,17 @@ sane_exit (void)
for (dev = first_dev; dev; dev = next) for (dev = first_dev; dev; dev = next)
{ {
next = dev->next; next = dev->next;
if (dev->is_prepared)
{
status = usb_high_scan_clearup (dev);
if (status != SANE_STATUS_GOOD)
DBG (3, "sane_close: usb_high_scan_clearup returned %s\n",
sane_strstatus (status));
}
status = usb_high_scan_exit (dev);
if (status != SANE_STATUS_GOOD)
DBG (3, "sane_close: usb_high_scan_exit returned %s\n",
sane_strstatus (status));
if (dev->chip) if (dev->chip)
{ {
status = usb_high_scan_exit (dev); status = usb_high_scan_exit (dev);
@ -988,6 +1000,7 @@ sane_open (SANE_String_Const devicename, SANE_Handle * handle)
{ {
/* empty devicname -> use first device */ /* empty devicname -> use first device */
dev = first_dev; dev = first_dev;
if (dev)
DBG (5, "sane_open: empty devicename, trying `%s'\n", dev->name); DBG (5, "sane_open: empty devicename, trying `%s'\n", dev->name);
} }
@ -1091,6 +1104,7 @@ sane_close (SANE_Handle handle)
DBG (3, "sane_close: usb_high_scan_turn_power returned %s\n", DBG (3, "sane_close: usb_high_scan_turn_power returned %s\n",
sane_strstatus (status)); sane_strstatus (status));
} }
#if 0
if (s->hw->is_prepared) if (s->hw->is_prepared)
{ {
status = usb_high_scan_clearup (s->hw); status = usb_high_scan_clearup (s->hw);
@ -1102,7 +1116,7 @@ sane_close (SANE_Handle handle)
if (status != SANE_STATUS_GOOD) if (status != SANE_STATUS_GOOD)
DBG (3, "sane_close: usb_high_scan_exit returned %s\n", DBG (3, "sane_close: usb_high_scan_exit returned %s\n",
sane_strstatus (status)); sane_strstatus (status));
#endif
if (s->hw->scan_buffer) if (s->hw->scan_buffer)
{ {
free (s->hw->scan_buffer); free (s->hw->scan_buffer);

Wyświetl plik

@ -1,6 +1,6 @@
:backend "mustek_usb" :backend "mustek_usb"
:status :beta :status :beta
:version "1.0-10" :version "1.0-11"
:manpage "sane-mustek_usb" :manpage "sane-mustek_usb"
:url "http://www.meier-geinitz.de/sane/" :url "http://www.meier-geinitz.de/sane/"

Wyświetl plik

@ -1,7 +1,10 @@
/* sane - Scanner Access Now Easy. /* sane - Scanner Access Now Easy.
Copyright (C) 2000 Mustek. Copyright (C) 2000 Mustek.
Maintained by Tom Wang <tom.wang@mustek.com.tw> Originally maintained by Tom Wang <tom.wang@mustek.com.tw>
Copyright (C) 2001, 2002 by Henning Meier-Geinitz.
This file is part of the SANE package. This file is part of the SANE package.
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
@ -41,7 +44,7 @@
If you do not wish that, delete this exception notice. If you do not wish that, delete this exception notice.
This file implements a SANE backend for Mustek 1200UB and similar This file implements a SANE backend for Mustek 1200UB and similar
flatbed scanners. */ USB flatbed scanners. */
#ifndef mustek_usb_h #ifndef mustek_usb_h
#define mustek_usb_h #define mustek_usb_h

Wyświetl plik

@ -1,9 +1,9 @@
/* sane - Scanner Access Now Easy. /* sane - Scanner Access Now Easy.
Copyright (C) 2000 Mustek. Copyright (C) 2000 Mustek.
Maintained by Tom Wang <tom.wang@mustek.com.tw> Originally maintained by Tom Wang <tom.wang@mustek.com.tw>
Updates (C) 2001 by Henning Meier-Geinitz. Copyright (C) 2001, 2002 by Henning Meier-Geinitz.
This file is part of the SANE package. This file is part of the SANE package.
@ -44,7 +44,7 @@
If you do not wish that, delete this exception notice. If you do not wish that, delete this exception notice.
This file implements a SANE backend for Mustek 1200UB and similar This file implements a SANE backend for Mustek 1200UB and similar
flatbed scanners. */ USB flatbed scanners. */
#include "mustek_usb_high.h" #include "mustek_usb_high.h"
#include "mustek_usb_mid.c" #include "mustek_usb_mid.c"

Wyświetl plik

@ -1,9 +1,9 @@
/* sane - Scanner Access Now Easy. /* sane - Scanner Access Now Easy.
Copyright (C) 2000 Mustek. Copyright (C) 2000 Mustek.
Maintained by Tom Wang <tom.wang@mustek.com.tw> Originally maintained by Tom Wang <tom.wang@mustek.com.tw>
Updates (C) 2001 by Henning Meier-Geinitz. Copyright (C) 2001, 2002 by Henning Meier-Geinitz.
This file is part of the SANE package. This file is part of the SANE package.
@ -44,7 +44,7 @@
If you do not wish that, delete this exception notice. If you do not wish that, delete this exception notice.
This file implements a SANE backend for Mustek 1200UB and similar This file implements a SANE backend for Mustek 1200UB and similar
flatbed scanners. */ USB flatbed scanners. */
#ifndef mustek_usb_high_h #ifndef mustek_usb_high_h
#define mustek_usb_high_h #define mustek_usb_high_h

Wyświetl plik

@ -1,9 +1,9 @@
/* sane - Scanner Access Now Easy. /* sane - Scanner Access Now Easy.
Copyright (C) 2000 Mustek. Copyright (C) 2000 Mustek.
Maintained by Tom Wang <tom.wang@mustek.com.tw> Originally maintained by Tom Wang <tom.wang@mustek.com.tw>
Updates (C) 2001 by Henning Meier-Geinitz. Copyright (C) 2001, 2002 by Henning Meier-Geinitz.
This file is part of the SANE package. This file is part of the SANE package.
@ -44,7 +44,7 @@
If you do not wish that, delete this exception notice. If you do not wish that, delete this exception notice.
This file implements a SANE backend for Mustek 1200UB and similar This file implements a SANE backend for Mustek 1200UB and similar
flatbed scanners. */ USB flatbed scanners. */
#include <unistd.h> #include <unistd.h>

Wyświetl plik

@ -1,9 +1,9 @@
/* sane - Scanner Access Now Easy. /* sane - Scanner Access Now Easy.
Copyright (C) 2000 Mustek. Copyright (C) 2000 Mustek.
Maintained by Tom Wang <tom.wang@mustek.com.tw> Originally maintained by Tom Wang <tom.wang@mustek.com.tw>
Updates (C) 2001 by Henning Meier-Geinitz. Copyright (C) 2001, 2002 by Henning Meier-Geinitz.
This file is part of the SANE package. This file is part of the SANE package.
@ -44,7 +44,7 @@
If you do not wish that, delete this exception notice. If you do not wish that, delete this exception notice.
This file implements a SANE backend for Mustek 1200UB and similar This file implements a SANE backend for Mustek 1200UB and similar
flatbed scanners. */ USB flatbed scanners. */
#ifndef mustek_usb_low_h #ifndef mustek_usb_low_h
#define mustek_usb_low_h #define mustek_usb_low_h

Wyświetl plik

@ -1,9 +1,9 @@
/* sane - Scanner Access Now Easy. /* sane - Scanner Access Now Easy.
Copyright (C) 2000 Mustek. Copyright (C) 2000 Mustek.
Maintained by Tom Wang <tom.wang@mustek.com.tw> Originally maintained by Tom Wang <tom.wang@mustek.com.tw>
Updates (C) 2001 by Henning Meier-Geinitz. Copyright (C) 2001, 2002 by Henning Meier-Geinitz.
This file is part of the SANE package. This file is part of the SANE package.
@ -43,7 +43,8 @@
whether to permit this exception to apply to your modifications. whether to permit this exception to apply to your modifications.
If you do not wish that, delete this exception notice. If you do not wish that, delete this exception notice.
This file implements a SANE backend for Mustek 1200UB flatbed scanners. */ This file implements a SANE backend for Mustek 1200UB and similar
USB flatbed scanners. */
#include "mustek_usb_mid.h" #include "mustek_usb_mid.h"
#include "mustek_usb_low.c" #include "mustek_usb_low.c"

Wyświetl plik

@ -1,5 +1,13 @@
CHANGES for the SANE Mustek USB backend CHANGES for the SANE Mustek USB backend
2002-03-17:
* Release of version 1.0-11.
2002-03-16:
* mustek_usb.c: Fixed segfault when opening device again after closing.
* mustek_usb.c: Fixed possible segfault when name="".
* mustek_usb.c: Type for option 0 must be set to SANE_TYPE_INT explicitely.
2002-02-14: 2002-02-14:
* Fixed some problems with wrong formats in DBG statements. * Fixed some problems with wrong formats in DBG statements.