summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/openbsd/attach15
-rwxr-xr-xtools/openbsd/detach17
-rw-r--r--tools/sane-desc.c52
3 files changed, 33 insertions, 51 deletions
diff --git a/tools/openbsd/attach b/tools/openbsd/attach
index b6c98c8..16ce31f 100755
--- a/tools/openbsd/attach
+++ b/tools/openbsd/attach
@@ -5,16 +5,15 @@ DEVNAME=$2
case $DEVCLASS in
0)
- # generic devices
case "$DEVNAME" in
ugen*)
- BUSNAME=`usbdevs -v -d | egrep "Controller|$DEVNAME\$" | grep -B 1 ugen0$ | head -n 1 | sed -e 's,Controller ,,' -e 's,:$,,' `
- echo $BUSNAME > /var/run/${DEVNAME}.bus
- # probably our scanner
- chgrp usb /dev/"$DEVNAME".*
- chgrp usb /dev/"$BUSNAME"
+ BUSNAME=$(usbdevs -vv | egrep "Controller|$DEVNAME\$" | grep -B 1 "$DEVNAME\$" | awk -F'[ :]' '/^Controller/ { print $2 }')
+ echo $BUSNAME > /var/run/${DEVNAME}.bus
+ chown _cups:_saned /dev/${DEVNAME}.* &&
+ chmod 660 /dev/${DEVNAME}.*
+ chown _cups:_saned $BUSNAME &&
+ chmod 660 $BUSNAME
;;
esac
-
- ;;
+ ;;
esac
diff --git a/tools/openbsd/detach b/tools/openbsd/detach
index a5c209c..8566e51 100755
--- a/tools/openbsd/detach
+++ b/tools/openbsd/detach
@@ -5,18 +5,17 @@ DEVNAME=$2
case $DEVCLASS in
0)
- # generic devices
case "$DEVNAME" in
ugen*)
- BUSNAME=`cat /var/run/${DEVNAME}.bus`
+ BUSNAME=$(cat /var/run/${DEVNAME}.bus)
rm -f /var/run/${DEVNAME}.bus
- # probably our scanner
- chgrp wheel /dev/"$DEVNAME".*
- if [ x$BUSNAME != x ] ; then
- chgrp wheel /dev/"$BUSNAME"
- fi
+ chown root:wheel /dev/${DEVNAME}.* &&
+ chmod 600 /dev/${DEVNAME}.*
+ test -n "$BUSNAME" && {
+ chown root:wheel $BUSNAME &&
+ chmod 600 $BUSNAME
+ }
;;
esac
-
- ;;
+ ;;
esac
diff --git a/tools/sane-desc.c b/tools/sane-desc.c
index 890e754..191c6e5 100644
--- a/tools/sane-desc.c
+++ b/tools/sane-desc.c
@@ -45,7 +45,7 @@
#include "../include/sane/sanei.h"
#include "../include/sane/sanei_config.h"
-#define SANE_DESC_VERSION "3.5"
+#define SANE_DESC_VERSION "3.6"
#define MAN_PAGE_LINK "man/%s.5.html"
#define COLOR_MINIMAL "\"#B00000\""
@@ -2808,16 +2808,14 @@ html_print_header (void)
static void
html_print_footer (void)
{
- time_t current_time = time (0);
-
printf
("<hr>\n"
"<a href=\"./\">SANE homepage</a>\n"
"<address>\n"
"<a href=\"imprint.html\"\n"
">Contact</a>\n" "</address>\n" "<font size=-1>\n");
- printf ("This page was last updated on %s by sane-desc %s from %s\n",
- asctime (localtime (&current_time)), SANE_DESC_VERSION, PACKAGE_STRING);
+ printf ("This page was created by sane-desc %s from %s\n",
+ SANE_DESC_VERSION, PACKAGE_STRING);
printf ("</font>\n");
printf ("</body> </html>\n");
}
@@ -3318,21 +3316,22 @@ create_scsiids_table (void)
return first_scsiid;
}
+static void
+print_header_comment (void)
+{
+ printf ("# This file was generated from description files (*.desc)\n"
+ "# by sane-desc %s from %s\n",
+ SANE_DESC_VERSION, PACKAGE_STRING);
+}
+
/* print USB usermap file to be used by the hotplug tools */
static void
print_usermap_header (void)
{
- time_t current_time = time (0);
-
+ print_header_comment ();
printf
- ("# This file was automatically created based on description files (*.desc)\n"
- "# by sane-desc %s from %s on %s"
- "#\n"
- ,
- SANE_DESC_VERSION, PACKAGE_STRING, asctime (localtime (&current_time)));
-
- printf
- ("# The entries below are used to detect a USB device and change owner\n"
+ ("#\n"
+ "# The entries below are used to detect a USB device and change owner\n"
"# and permissions on the \"device node\" used by libusb.\n"
"#\n"
"# The 0x0003 match flag means the device is matched by its vendor and\n"
@@ -3396,10 +3395,7 @@ print_usermap (void)
static void
print_db_header (void)
{
- time_t current_time = time (0);
- printf ("# This file was automatically created based on description files (*.desc)\n"
- "# by sane-desc %s from %s on %s",
- SANE_DESC_VERSION, PACKAGE_STRING, asctime (localtime (&current_time)));
+ print_header_comment ();
printf
("#\n"
"# The entries below are used to detect a USB device when it's plugged in\n"
@@ -3461,11 +3457,7 @@ print_db (void)
static void
print_udev_header (void)
{
- time_t current_time = time (0);
- printf ("# This file was automatically created based on description files (*.desc)\n"
- "# by sane-desc %s from %s on %s",
- SANE_DESC_VERSION, PACKAGE_STRING, asctime (localtime (&current_time)));
-
+ print_header_comment ();
printf
("#\n"
"# udev rules file for supported USB and SCSI devices\n"
@@ -3654,11 +3646,7 @@ print_udev (void)
static void
print_udevhwdb_header (void)
{
- time_t current_time = time (0);
- printf ("# This file was automatically created based on description files (*.desc)\n"
- "# by sane-desc %s from %s on %s",
- SANE_DESC_VERSION, PACKAGE_STRING, asctime (localtime (&current_time)));
-
+ print_header_comment ();
printf
("#\n"
"# udev rules file for supported USB and SCSI devices\n"
@@ -3764,11 +3752,7 @@ print_udevhwdb (void)
static void
print_hwdb_header (void)
{
- time_t current_time = time (0);
- printf ("# This file was automatically created based on description files (*.desc)\n"
- "# by sane-desc %s from %s on %s",
- SANE_DESC_VERSION, PACKAGE_STRING, asctime (localtime (&current_time)));
-
+ print_header_comment ();
printf
("#\n"
"# hwdb file for supported USB devices\n"