syncs manual page and code (usage() incomplete) also use EARGF(usage()) instead of just ARGF() use /dev/*-files instead of kernel files directly (or are hard-coded kernel devices a good idea?) /sys/src/cmd/usb/misc/usbprint can be removed (there is a /386/bin/usb/usbprinter on sources), usbprint in usb/misc is not installed. to usbstart could be added: usb/usbprinter (as the manual page suggests). mjl, mechiel@xs4all.nl Reference: /n/sources/patch/applied/doc-man-4-usb-usage Date: Sat Mar 26 18:29:59 CET 2005 --- /sys/man/4/usb Sat Mar 26 18:26:39 2005 +++ /sys/man/4/usb Sat Mar 26 18:26:36 2005 @@ -2,12 +2,15 @@ .SH NAME usbmouse, usbaudio, -usbprint +usbprinter \- Universal Serial Bus user level device drivers .SH SYNOPSIS .B usb/usbmouse [ -.B -f +.B -fsv +] [ +.B -a +.I accel ] [ .I ctrlno .I n @@ -30,7 +33,7 @@ .I n ] .PP -.B usb/usbprint +.B usb/usbprinter .SH DESCRIPTION These programs implement support for specific USB device classes. They should be run after @@ -41,18 +44,24 @@ .SS Mice .B Usbmouse sends mouse events from a USB mouse to -.B #m/mousein +.B /dev/mousein where the Plan 9 kernel processes them like other mice. .PP Without arguments, it scans the USB status files to find a mouse and uses the first one it finds. A pair of numeric arguments overrides this search -with a specific USB controller and device. -.PP -The -.B -f -flag runs -.B usbmouse -in the foreground. +with a specific USB controller and device. The options are +.TP +.BI -f +Run usbmouse in foreground. +.TP +.BI -s +Use the scrollwheel. +.TP +.BI -v +Verbose mode. +.TP +.BI -a " accel" +Accelerate mouse movements. .SS Audio devices .B Usbaudio configures and manages a usb audio device. It implements a file system, @@ -139,7 +148,7 @@ secondarily by channel. Samples occupy the minimum integral number of bytes. Read and write operations of arbitrary size are allowed. .SS Printers -.B Usbprint +.B Usbprinter is a script that mounts a usb printer on .BR /dev/lp . .SH EXAMPLE --- /sys/src/cmd/usb/misc/usbmouse.c Sat Mar 26 18:26:58 2005 +++ /sys/src/cmd/usb/misc/usbmouse.c Sat Mar 26 18:26:55 2005 @@ -6,10 +6,10 @@ int mousefd, ctlfd, mousein; char hbm[] = "Enabled 0x020103\n"; -char *mouseinfile = "#m/mousein"; -char *statfmt = "#U/usb%d/%d/status"; -char *ctlfmt = "#U/usb%d/%d/ctl"; -char *msefmt = "#U/usb%d/%d/ep1data"; +char *mouseinfile = "/dev/mousein"; +char *statfmt = "/dev/usb%d/%d/status"; +char *ctlfmt = "/dev/usb%d/%d/ctl"; +char *msefmt = "/dev/usb%d/%d/ep1data"; char *ctl3str = "ep 1 bulk r 3 32"; char *ctl5str = "ep 1 bulk r 5 32"; char ctlfile[32]; @@ -80,7 +80,7 @@ void usage(void) { - fprint(2, "usage: %s [-vf] [-a accel] [ctlrno usbport]\n", argv0); + fprint(2, "usage: %s [-fsv] [-a accel] [ctlrno usbport]\n", argv0); threadexitsall("usage"); } @@ -102,7 +102,7 @@ nofork=1; break; case 'a': - accel=strtol(ARGF(), nil, 0); + accel=strtol(EARGF(usage()), nil, 0); break; default: usage(); --- /sys/src/cmd/usb/audio/usbaudio.c Sat Mar 26 18:27:17 2005 +++ /sys/src/cmd/usb/audio/usbaudio.c Sat Mar 26 18:27:12 2005 @@ -240,7 +240,7 @@ void usage(void) { - fprint(2, "usage: usbaudio [-V] [-v volume[%%]] [-m mountpoint] [-s srvname] [ctrlno id]\n"); + fprint(2, "usage: usbaudio [-V] [-v volume] [-m mountpoint] [-s srvname] [ctrlno n]\n"); threadexitsall("usage"); } @@ -266,20 +266,20 @@ verbose++; break; case 'd': - debug = strtol(ARGF(), nil, 0); + debug = strtol(EARGF(usage()), nil, 0); if (debug == -1) debugdebug++; verbose++; break; case 'v': - volume[0] = strtol(ARGF(), &p, 0); + volume[0] = strtol(EARGF(usage()), &p, 0); for(i = 1; i < 8; i++) volume[i] = volume[0]; break; case 'm': - mntpt = ARGF(); + mntpt = EARGF(usage()); break; case 's': - srvpost = ARGF(); + srvpost = EARGF(usage()); break; default: usage();