From 84357741a6a6e6430f199b2c3f7498e0e97da9ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 12 Feb 2023 17:35:53 +0100 Subject: New upstream version 1.2.1 --- tools/sane-find-scanner.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'tools/sane-find-scanner.c') diff --git a/tools/sane-find-scanner.c b/tools/sane-find-scanner.c index 25e5954..a949695 100644 --- a/tools/sane-find-scanner.c +++ b/tools/sane-find-scanner.c @@ -89,9 +89,12 @@ scsiblk; #define set_inquiry_return_size(icb,val) icb[0x04]=val #define IN_periph_devtype_cpu 0x03 #define IN_periph_devtype_scanner 0x06 -#define get_scsi_inquiry_vendor(in, buf) strncpy(buf, in + 0x08, 0x08) -#define get_scsi_inquiry_product(in, buf) strncpy(buf, in + 0x10, 0x010) -#define get_scsi_inquiry_version(in, buf) strncpy(buf, in + 0x20, 0x04) +#define get_scsi_inquiry_vendor(in, buf) snprintf(buf, 0x08 + 1, "%.*s", \ + 0x08, in + 0x08) +#define get_scsi_inquiry_product(in, buf) snprintf(buf, 0x10 + 1, "%.*s", \ + 0x10, in + 0x10) +#define get_scsi_inquiry_version(in, buf) snprintf(buf, 0x04 + 1, "%.*s", \ + 0x04, in + 0x20) #define get_scsi_inquiry_periph_devtype(in) (in[0] & 0x1f) #define get_scsi_inquiry_additional_length(in) in[0x04] #define set_scsi_inquiry_length(out,n) out[0x04]=n-5 @@ -384,7 +387,7 @@ check_usb_file (char *file_name) { if (verbose > 1) printf (" open ok, vendor and product ids were identified\n"); - printf ("found USB scanner (vendor=0x%04x, " + printf ("found possible USB scanner (vendor=0x%04x, " "product=0x%04x) at %s\n", vendor, product, file_name); } else @@ -392,8 +395,8 @@ check_usb_file (char *file_name) if (verbose > 1) printf (" open ok, but vendor and product could NOT be " "identified\n"); - printf ("found USB scanner (UNKNOWN vendor and product) " - "at device %s\n", file_name); + printf ("found possible USB scanner (UNKNOWN vendor and " + "product) at %s\n", file_name); unknown_found = SANE_TRUE; } device_found = SANE_TRUE; @@ -676,7 +679,8 @@ check_libusb_device (struct usb_device *dev, SANE_Bool from_file) { char * chipset = check_usb_chip (dev, verbose, from_file); - printf ("found USB scanner (vendor=0x%04x", dev->descriptor.idVendor); + printf ("found possible USB scanner (vendor=0x%04x", + dev->descriptor.idVendor); if (vendor) printf (" [%s]", vendor); printf (", product=0x%04x", dev->descriptor.idProduct); @@ -1066,7 +1070,7 @@ check_libusb_device (libusb_device *dev, SANE_Bool from_file) if(!from_file) chipset = check_usb_chip (verbose, desc, hdl, config0); - printf ("found USB scanner (vendor=0x%04x", vid); + printf ("found possible USB scanner (vendor=0x%04x", vid); if (vendor) printf (" [%s]", vendor); printf (", product=0x%04x", pid); -- cgit v1.2.3