diff options
author | cinap_lenrek <cinap_lenrek@localhost> | 2011-08-26 05:24:55 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@localhost> | 2011-08-26 05:24:55 +0200 |
commit | 1404cc50772688f05ab65a9eb2d5c8d4b85b0375 (patch) | |
tree | 010400734c4ba7998362bfdacc585842b8deca97 /sys/man | |
parent | a6e3c9fd83e72e5c911e83f763e77ab6605a17d2 (diff) |
nusb: fix documentation, cleanup, remove /sys/src/cmd/usb
Diffstat (limited to 'sys/man')
-rw-r--r-- | sys/man/2/nusb (renamed from sys/man/2/usb) | 86 | ||||
-rw-r--r-- | sys/man/2/usbfs | 341 | ||||
-rw-r--r-- | sys/man/3/audio | 2 | ||||
-rw-r--r-- | sys/man/3/usb | 13 | ||||
-rw-r--r-- | sys/man/4/usb | 516 | ||||
-rw-r--r-- | sys/man/4/usbd | 245 | ||||
-rw-r--r-- | sys/man/8/prep | 2 |
7 files changed, 14 insertions, 1191 deletions
diff --git a/sys/man/2/usb b/sys/man/2/nusb index d6f949f98..e771cb56f 100644 --- a/sys/man/2/usb +++ b/sys/man/2/nusb @@ -1,17 +1,15 @@ -.TH USB 2 +.TH NUSB 2 .SH NAME usbcmd, classname, closedev, configdev, devctl, -finddevs, +getdev, loaddevstr, -matchdevcsp, opendev, opendevdata, openep, -startdevs, unstall, class, subclass, @@ -22,7 +20,6 @@ CSP \- USB device driver library .ta 8n +8n +8n +8n +8n +8n +8n #include <u.h> #include <libc.h> -#include <thread.h> #include "../lib/usb.h" .sp 0.3v struct Dev { @@ -118,18 +115,15 @@ int configdev(Dev *d); int devctl(Dev *dev, char *fmt, ...); void* emallocz(ulong size, int zero); char* estrdup(char *s); -int finddevs(int (*matchf)(char*,void*), void *farg, char** dirs, int ndirs); char* hexstr(void *a, int n); char* loaddevstr(Dev *d, int sid); -int matchdevcsp(char *info, void *a); Dev* opendev(char *fn); int opendevdata(Dev *d, int mode); Dev* openep(Dev *d, int id); -void startdevs(char *args, char *argv[], int argc, - int (*mf)(char*,void*), void*ma, int (*df)(Dev*,int,char**)); int unstall(Dev *dev, Dev *ep, int dir); int usbcmd(Dev *d, int type, int req, int value, int index, uchar *data, int count); +Dev* getdev(int id); .sp 0.3v extern int usbdebug; /* more messages for bigger values */ .EE @@ -140,27 +134,14 @@ It is not intended for user programs using USB devices. See .IR usb (3) for a description of the interfaces provided for that purpose. -For drivers that provide a file system and may be embedded into -.IR usbd , -the library includes a file system implementation toolkit described in -.IR usbfs (2). .PP Usb drivers rely on .IR usb (3) to perform I/O through USB as well as on -.IR usbd (4) +.IR usbd to perform the initial configuration for the device's setup endpoint. The rest of the work is up to the driver and is where this library may help. .PP -In most cases, a driver locates the devices of interest and configures them -by calling -.I startdevs -and -then sets up additional endpoints as needed (by calling -.IR openep ) -to finally perform I/O by reading and writing the -data files for the endpoints. -.PP An endpoint as provided by .IR usb (3) is represented by a @@ -238,54 +219,6 @@ to the library are kept unparsed at as an aid for the driver (which should know how to parse them and what to do with the information). .SS Configuration -.I Startdevs -is a wrapper that locates devices of interest, loads their configuration -information, and starts a -.IR thread (2)'s -.I proc -for each device located so that it executes -.I f -as its main entry point. The entry point is called with a pointer to -the -.B Dev -for the device it has to process, -.BR argc , -and -.BR argv . -Devices are located either from the arguments (after options) in -.IR argv , -if any, -or by calling the helper function -.I mf -with the argument -.I ma -to determine (for each device available) if the device belongs to -the driver or not. If the function returns -1 then the device is not for us. -.PP -In many cases, -.I matchdevcsp -may be supplied as -.I mf -along with a (null terminated) vector of CSP values supplied as -.IR ma . -This function returns 0 for any device with a CSP matching one in the -vector supplied as an argument and -1 otherwise. -In other cases (eg., when a particular vendor and device ids are the -ones identifying the device) the driver must include its own function -and supply it as an argument to -.IR startdevs . -The first argument of the function corresponds to the information -known about the device (the second line in its -.B ctl -file). -.I Openep -creates the endpoint number -.I id -for the device -.I d -and returns a -.B Dev -structure to operate on it (with just the control file open). .PP .I Opendev creates a @@ -306,11 +239,6 @@ loads and parses its configuration information. After calling it, the device is ready for I/O and the USB description in .B Dev.usb is valid. -When using -.IR startdevs -it is not desirable to call this function (because -.IR startdevs -already calls it). .PP Control requests for an endpoint may be written by calling .I devctl @@ -450,11 +378,9 @@ and memory must be released by the caller. returns the string obtained by reading the device string descriptor number .IR sid . .SH SOURCE -.B /sys/src/cmd/usb/lib +.B /sys/src/cmd/nusb/lib .SH "SEE ALSO" -.IR usbfs (2), .IR usb (3), -.IR usb (4), -.IR usbd (4). +.IR nusb (4). .SH BUGS Not heavily exercised yet. diff --git a/sys/man/2/usbfs b/sys/man/2/usbfs deleted file mode 100644 index 6c76280a8..000000000 --- a/sys/man/2/usbfs +++ /dev/null @@ -1,341 +0,0 @@ -.TH USBFS 2 -.SH NAME -usbreadbuf, -usbfsadd, -usbfsdel, -usbdirread, -usbfsinit, -usbdirfs, -usbfs \- USB device driver file system library -.SH SYNOPSIS -.EX -.ta 8n +8n +8n +8n +8n +8n +8n -#include <u.h> -#include <libc.h> -#include <thread.h> -#include "../lib/usb.h" -#include "../lib/usbfs.h" -.sp 0.3v -enum { - Hdrsize = 128, /* plenty of room for headers */ - Msgsize = 8 * 1024, - Bufsize = Hdrsize + Msgsize, - Namesz = 40, - Errmax = 128, - ONONE = ~0, /* omode in Fid when not open */ -}; -.sp 0.3v -struct Fid { - int fid; - Qid qid; - int omode; - Fid* next; - void* aux; -}; -.sp 0.3v -struct Usbfs { - char name[Namesz]; - uvlong qid; - Dev* dev; - void* aux; -.sp 0.3v - int (*walk)(Usbfs *fs, Fid *f, char *name); - void (*clone)(Usbfs *fs, Fid *of, Fid *nf); - void (*clunk)(Usbfs *fs, Fid *f); - int (*open)(Usbfs *fs, Fid *f, int mode); - long (*read)(Usbfs *fs, Fid *f, - void *data, long count, vlong offset); - long (*write)(Usbfs *fs, Fid*f, - void *data, long count, vlong offset); - int (*stat)(Usbfs *fs, Qid q, Dir *d); - void (*end)(Usbfs *fs); -}; -.sp 0.3v -typedef int (*Dirgen)(Usbfs*, Qid, int, Dir*, void*); -.sp 0.3v -long usbreadbuf(void *data, long count, - vlong offset, void *buf, long n); -void usbfsadd(Usbfs *dfs); -void usbfsdel(Usbfs *dfs); -int usbdirread(Usbfs*f, Qid q, char *data, long cnt, - vlong off, Dirgen gen, void *arg); -void usbfsinit(char* srv, char *mnt, Usbfs *f, int flag); -void usbfsdirdump(void); -.sp 0.3v -extern char Enotfound[], Etoosmall[], Eio[], Eperm[], Ebadcall[], - Ebadfid[], Einuse[], Eisopen[], Ebadctl[]; -.sp 0.3v -extern Usbfs usbdirfs; -extern int usbfsdebug; -.EE -.SH DESCRIPTION -This library provides an alternative to -.IR 9p (2) -for implementing a file server within a USB driver. -Drivers using this -library may be embedded into -.IR usbd (4). -It may be also desirable to use this library when drivers are -not embedded because it is tailored to work well with the -library for handling USB devices. -.PP -A USB file system is described by a -.I Usbfs -structure. -In most cases, the driver is not responsible for the root of the -file tree. -It is customary that a driver creates a file server -for each device handled and links all of them to a root directory -implemented by the -.I usbdirfs -file system implemented by the library. -This root directory is bound to -.B /dev -in most cases. -.PP -.I Usbdirfs -implements a root directory populated by named file trees, -each one described by a -.B Usbfs -structure. -.PP -The field -.B Usbfs.name -contains the name for the root directory of the file system, usually -a directory seen at -.BI /dev/ name -when the driver is embedded. -.PP -.B Usbfs.qid -maintains a value used to decorate qids for the file tree. -This may be ignored when -.I usbdirfs -is not used. -Otherwise, -.I usbdirfs -assigns a unique value kept at the high 32 bits of -.B Qid.path -for all files on each file tree bound to it. -Each -.I Usbfs -server must bitwise OR -.B Usbfs.qid -to all -.B Qid.path -values returned by its functions. -In the same way, -functions usually clear bits in -.B Usbfs.qid -before processing -.B Qid.path -values supplied as input. -.PP -The USB device handled by a file tree is referenced from -.B Usbfs.dev -(and a reference must be counted for it). -This permits the following functions to quickly locate the device of -interest, and also permits releasing the device when -no request is outstanding. -.PP -The field -.B Usbfs.aux -is for the device to use. -The rest of the fields implement the 9P protocol for the device. -Not all the operations need be implemented. -Only -.IR walk , -.IR open , -.IR read , -.IR write , -and -.IR stat , -must be implemented (and their corresponding fields in -.B Usbfs -may never be -.BR nil ). -These functions must return -1 upon failure -and set the error string to reflect the cause of a failure. -.PP -In all the functions, a 9P fid is represented by a -.B Fid -structure. -It contains the 9P -.IR fid , -the corresponding -.IR qid , -and an auxiliary pointer for the driver to use. -Open -.IR fid s -have a valid open mode in -.I omode -while others have -.B ONONE -to indicate that the -.I fid -is not open. -The library takes care of which -fids -exist and which ones do not. -.PP -.I Walk -must walk -.I f -to -.I name -(a single name, not a file path) -in the supplied -.IR fs . -Its implementation should update the qid in -.I f -to reflect the walk. -This function must bitwise OR any returned Qid with -.B Usbfs.qid , -if -.I usbdirfs -is used. -.PP -.I Clone -must clone fid -.I of -onto -.I nf -so that, -upon successful completion, -.I nf -also refers to the file that -.I f -refers to. -An implementation must update the Qid of the cloned -fid. -If this function is not supplied, the library copies the -.I aux -field to the cloned fid. -.PP -.I Clunk -clunks -.IR f . -It usually releases data kept in the -.I aux -field, but may be -set to -.B nil -otherwise. -.PP -.I Open -prepares the fid -.I f -for I/O according to -.IR mode . -The open mode in the fid is updated by the library upon return. -The library checks trivial cases like opening already-open fids. -The implementation performs most permission checking. -.PP -.I Read -reads up to -.I count -bytes into -.I data -starting at -.I offset -in the file referenced by -.IR f . -.I Write -is the counterpart. -To read from directories, -the function -.I usbdirread -may be called. -It returns the return value of -.I read -or -1. -.I usbdirread -calls -.I gen -to iterate through files as needed. -The -.B Dirgen -function will be called with index values of 0 -and up to ask for the first file and following files. -To read from data already in buffers, the function -.I usbreadbuf -may help. -It must be given the arguments supplied -by the user, plus the buffer and buffer size. -.PP -.I Stat -must fill -.I d -with the directory entry for the file identified by -.IR q. -As an aid, -.I d -is initialized to fake access and modification times, -and user and group ids. -Also, the field -.B name -in -.I d -is initialized to point to a 40-byte buffer. -If the file name fits, -it may be copied directly into -.B d->name -without allocating memory for that purpose. -Otherwise -.B d->name -must be initialized to point to static memory. -.PP -The function -.I end -is called upon termination of the file tree to -release resources. -.PP -Calling -.I usbfsinit -starts a file server for -.I f -that mounts itself at -.I mnt -and posts -.I srv -at -.IR srv (3). -In most cases, the file system supplied is -.IR usbdirfs . -The -.I flag -is used for -.IR mount -(see -.IR bind (2)). -Once -.I usbdirfs -is started, calls to -.IR usbfsadd -add a file tree implemented by -.I dfs -to the root directory of -.I usbdirfs -and -calls to -.I usbfsdel -remove that binding (and release resources including -the reference to the USB device). -.PP -Various error strings are declared as an aid. -The global -.B usbfsdebug -may be set to trigger diagnostics and protocol tracing. -.SH EXAMPLE -See -.B /sys/src/cmd/usb/disk -for an example driver that uses this library. -Looking at an example is strongly suggested -to see how reference counts for the USB device -and the file system are handled. -.SH SOURCE -.B /sys/src/cmd/usb/lib -.SH "SEE ALSO" -.IR usb (2), -.IR usb (3), -.IR usb (4), -.IR usbd (4) diff --git a/sys/man/3/audio b/sys/man/3/audio index e95608c83..520cbcec6 100644 --- a/sys/man/3/audio +++ b/sys/man/3/audio @@ -126,4 +126,4 @@ Defaults to 44100. .SH SOURCE .B /sys/src/9/port/devaudio.c .SH SEE ALSO -.IR usb (4) +.IR nusb (4) diff --git a/sys/man/3/usb b/sys/man/3/usb index a79132ba0..c69129c1c 100644 --- a/sys/man/3/usb +++ b/sys/man/3/usb @@ -58,7 +58,7 @@ Specialization continues as subclasses and subsubclasses are explored. .PP Enumeration of the bus and initial configuration of devices is done by a user level program, -.IR usbd (4). +.IR usbd . Device drivers are implemented by separate user programs, although some of them may be statically linked into .IR usbd . @@ -115,7 +115,7 @@ After configuring a device, other endpoints may be created as dictated by the device to perform actual I/O. .SS Operation Bus enumeration and device configuration is performed by -.IR usbd (4) +.IR usbd and not by this driver. The driver provides an interface to access existing endpoints (initially those for the built-in root hubs), @@ -130,7 +130,7 @@ is a number identifying a device and is a number identifying one of its endpoints. .PP For each device attached to the bus, and configured by -.IR usbd (4), +.IR usbd , an endpoint zero (a .I setup endpoint) @@ -212,7 +212,7 @@ storage csp 0x500608 vid 0x951 did 0x1613 Kingston 'DT 101 II' .LP The first line contains status information. The rest is information supplied by -.IR usbd (4) +.IR usbd as an aid to locate devices. The status information includes: .TF "\fREndpoint mode @@ -346,7 +346,7 @@ USB class, subclass and proto codes can be found at Endpoint control files accept the following requests. In most cases the driver does not issue them, leaving the task to either -.IR usbd (4) +.IR usbd or the usb driver library documented in .IR usb (2). .TF "\fLsamplehz\fI n @@ -522,8 +522,7 @@ root of the USB interface .B /sys/src/9/pc/usb?hci.c .SH "SEE ALSO" .IR usb (2), -.IR usb (4), -.IR usbd (4), +.IR nusb (4), .IR plan9.ini (8) .SH BUGS USB controllers limit the speed of all their ports diff --git a/sys/man/4/usb b/sys/man/4/usb deleted file mode 100644 index fa20e3a5d..000000000 --- a/sys/man/4/usb +++ /dev/null @@ -1,516 +0,0 @@ -.TH USB 4 -.SH NAME -audio, -ccid, -disk, -ether, -kb, -print, -probe, -serial, -usbeject, -usbfat: -\- Universal Serial Bus device drivers -.SH SYNOPSIS -.B usb/kb -[ -.B -dkm -] [ -.B -a -.I accel -] [ -.I dev ... -] -.PP -.B usb/disk -[ -.B -Dd -] [ -.B -m -.I mnt -] [ -.B -s -.I srv -] [ -.I dev ... -] -.PP -.B usbfat: -[ -.I disk ... -] -.PP -.B usbeject -[ -.I disk ... -] -.PP -.B usb/audio -[ -.B -dpV -] [ -.B -m -.I mnt -] [ -.B -s -.I srv -] [ -.B -v -.I vol -] [ -.I dev -] -.PP -.B usb/ether -[ -.B -Dd -] [ -.B -m -.I mnt -] [ -.B -s -.I srv -] [ -.I dev ... -] -.PP -.B usb/serial -[ -.B -Dd -] [ -.B -m -.I mnt -] [ -.B -s -.I srv -] [ -.I dev ... -] -.PP -.B usb/print -[ -.B -d -] [ -.I dev ... -] -.PP -.B usb/ccid -[ -.B -d -] -.ig -.PP -.B usb/ibuddy -[ -.B -Dd -] [ -.B -m -.I mnt -] [ -.B -s -.I srv -] [ -.I dev ... -] -.. -.B usb/probe -.SH DESCRIPTION -These programs drive USB devices of specific classes via -.IR usb (3). -Usually they are started by -.IR usbd (4) -upon attachment of the device to the bus. -Less often, users start them manually, depending on -.IR usbd (4)'s -configuration. -Usually, -.I kb -and -.I disk -are started by -.I usbd -and other programs are started by hand. -.PP -Without arguments, the drivers handle all the devices (of -the appropriate USB class) found on the bus. -To make a driver handle only certain devices, supply as arguments -the paths for the directories of the devices -(actually of their zero endpoints). -.PP -Drivers that provide file systems accept options -.B -s -and -.B -m -to instruct them to post a 9P connection at -.IR srv (3) -with the given name and/or to mount themselves at -.IR mnt . -When embedded into -.IR usbd -these options may not be used. -In this case, -the file tree supplied by the device driver is -available through the file system provided by -.IR usbd , -usually mounted at -.B /dev -and reachable through the 9P connection posted at -.BR /srv/usb . -.PP -Options -.B -d -and -.B -D -present on most drivers trigger debug diagnostics and -file system debugging diagnostics. -Repeating any one of these may increase verbosity. -.PP -To help locate devices of interest, -.I probe -lists all the USB devices available, -including those with no driver started. -.SS Keyboards and mice -.I Kb -supports USB keyboards and mice either as separate USB devices -or as a single combined USB device. -Scan codes from the keyboard are sent to -.B /dev/kbin -to let -.IR kbdfs (8) -process them. -Mouse events are sent to -.B /dev/mousein -in the same way. -.PP -The following options are understood: -.TF -k -.TP -.B \-a -Accelerate the mouse to level -.I n -(similar to the kernel mouse driver acceleration). -.TP -.B \-k -Serve just the keyboard (and not the mouse). -.TP -.B \-m -Serve just the mouse (and not the keyboard). -.SS Disks -.I Disk -configures and manages USB mass storage devices. It -provides a file system (usually seen at -.BR /dev ) -that includes one directory per storage device, named -.BI sdU N . M -in correspondence with the usb device number and the storage -unit number (or LUN). -For example, LUN number 2 on -.B /dev/usb/ep3.0 -can be accessed through -.BR /dev/sdU3.2 . -.PP -The storage device directory contains the usual files -served by -.IR sd (3): -.BR data , -.BR raw , -and -.BR ctl . -.PP -The -.B ctl -file supplies the device -geometry when read. -.PP -The script -.B usbfat: -mounts the FAT file systems in the DOS partitions of the named -.IR disk s; -if none, it mounts those file systems found at -.BR /dev/sdU*.*/data . -When more than one partition is found, a suffix is appended to -the disk name to identify the partition number. -The script -.B usbeject -undoes the effect. If no argument is given, it unmounts all USB -disks. An argument -.BI sdU N -unmounts all partitions from disk with USB target -.IR N . -.ig -An argument -.BI sdU N . M -or -.BI sdU N . M . P -.\" TODO: fill in missing words -.. -.SS Printers -.I Print -provides a single file can be written to print on a USB printer. -Options are similar to those of -.IR disk . -The file is also bound at -.B /dev/lp -as is customary. -.SS Ethernet adapters -.I Ether -provides a file interface similar to that of -.IR ether (3) -for each USB Ethernet adapter found. -The name of an Ethernet device is -.BI etherU N -where -.I N -is the device name. -When started manually, the file interface is mounted at -.B /net -as is customary. -. -.SS Serial and JTAG ports -.I Serial -provides a file system (usually mounted at -.BR /dev ) -that includes one directory per USB serial port, named -.BI eiaU N -or -.BI eiaU N . M. -In this directory there are two files, -.BR eiaU , -similar to -.BI eia N -in -.IR uart (3), -and -.BR eiaUctl , -which admits writes in the same format as -.BI eia N ctl -in -.IR uart (3). -Reading from -.B eiaUctl -gives the serial port's settings in the same format as -.BI eia N status -in -.IR uart (3). -Options are similar to those of -.IR disk . -.PP -JTAG ports are similar -but the files are named -.B jtag -and -.BR jtagctl . -. -.SS Audio devices -.I Usbaudio -configures and manages a USB audio device. -It implements a file system, -normally mounted on -.BI /dev , -but this can be changed with -.BR \-m , -containing files -.BR volume , -.BR audioctl , -.BR audio , -and -.BR audioin . -The names -.B volume -and -.B audio -maintain backward compatibility with the Soundblaster driver. -.PP -The -.B \-V -option (verbose) -causes -.I audio -to print information about the device on startup. -The -.B \-s -option specifies a name for a file descriptor to be posted in -.BR /srv . -The -.B \-v -options sets initial -.IR volume . -.PP -Reading -.B volume -or -.B audioctl -yields the device's settings. -The data format of -.B volume -is compatible with the Soundblaster and produces output in this -format: -.IP -.EX -audio out 65 -treb out 0 -bass out 0 -speed out 44100 -.EE -.PP -This file can be written using the same syntax. -The keyword -.L out -may be omitted. -Settings are given as percentages of the range, -except for speed which is in Hz. -.PP -The file -.B audioctl -provides more information, using up to 6 columns of 12 characters each. -From left to right, the fields are: -.IR "control name" , -.I in -or -.IR out , -.IR "current value" , -.IR "minimum value" , -.IR maximum , -and -.IR resolution . -There are 3, 5, or 6 columns present. -Maxima and resolution are omitted when they are not available or not applicable. -The resolution for -.I speed -is reported as 1 (one) if the sampling frequency is continuously variable. -It is absent if it is settable at a fixed number of discrete values only. -.PP -When all values from -.B audioctl -have been read, a zero-length buffer is returned -(the usual end-of-file indication). -A new -.I read -will then block until one of the settings changes, -then report its new value. -.PP -The file -.B audioctl -can be written like -.BR volume . -.PP -Audio data is written to -.B audio -and read from -.BR audioin . -The data format is little-endian, -samples ordered primarily by time and -secondarily by channel. -Samples occupy the minimum integral number of bytes. -Read and write operations of arbitrary size are allowed. -. -.SS Ccid -.I Ccid -discovers and configures SIM or SAM cards using the CCID standard. -It provides a file system (usually mounted at -.BR /dev ) -that includes three files, -.BI ctl , -.B raw -and -.BI rpc . -Reading from -.B ctl -a description of the smartcard reader capabilities is printed. -.B raw -is just intended for debugging. -Reads and writes to the -raw file send and receive raw CCID packets. -Smart cards identify themselves by giving out an ATR, -an array of characters describing the card uniquely. -Users of the driver write the ATR to the -.B rpc -file and are blocked until a card with that ATR is seen. -From then on they can do ICC RPCs using whatever -language the smart card speaks. A small write cancels -an outstanding RPC. -.PP -The driver takes care of powering the card adequately, based -on its ATR, and tunnelling the RPCs through the USB device. -Only slot 0 is supported. -.PP -When the smartcard disappears, -all reads and write fail until the file is reopened and -a new ATR is written to it. -. -.ig -.SS Ibuddy -.PP -Ibuddy supports a USB I-buddy toy, a little winged-demon. -The driver provides one directory per attached toy with a single -.BR ctl -file to control the device. -Directories are named -.BR ibuddyN , -being -.I N -the corresponding usb device number. -When read, the -.BR ctl -file provides the state of the device in this form: -.IP -.EX -hips right|left -wings open|close -red on|off -green on|off -blue on|off -heart on|off -.EE -.PP -Each line describes the status of one feature. -.IR Red , -.IR blue , -and -.IR green -are the different leds in the head of -the toy. -.IR Heart -represents the red led in the chest of -the toy. -.IR Wings -represents the status of the wings, which -can be closed or open. -.IR Hips -represents the orientation -of the toy (left or right, from the figure's point of view). -.PP -Lines can be written to the -.BR ctl -file to command the device. -Multiple lines (six at most) can be written -at once, with one action per line. -.. -.SH SOURCE -.B /sys/src/cmd/usb -.SH "SEE ALSO" -.IR mouse (3), -.IR sd (3), -.IR uart (3), -.IR usb (3), -.IR usbd (4), -.IR partfs (8), -.IR kbdfs (8) -.SH BUGS -The various device drivers are generic USB drivers and -may work only for certain devices on each class. -.PP -USB ATA storage devices are not supported. -.PP -The Ethernet device works only for certain ASIX-based cards and for CDC devices. -Both the Ethernet and printer drivers have not -been tested and it is likely they will fail. -.PP -The serial driver works only for the Prolific chip and Ftdi, -and control of the -.B dcd -and -.B dsr -signals and some of the extra features are unimplemented. -For Ftdi, only the Sheevaplug and Guruplug have been tried. -There is support for the EHCI debug port, but it loses bytes. diff --git a/sys/man/4/usbd b/sys/man/4/usbd deleted file mode 100644 index c0d3ca6cd..000000000 --- a/sys/man/4/usbd +++ /dev/null @@ -1,245 +0,0 @@ -.TH USBD 4 -.SH NAME -usbd \- Universal Serial Bus daemon -.SH SYNOPSIS -.B usbd -[ -.B -Dd -] -[ -.B -s -.I srv -] -[ -.B -m -.I mnt -] -[ -.I hub... -] -.SH DESCRIPTION -.I Usbd -complements -.IR usb (3) -to provide USB I/O for device drivers. -It enumerates the bus, polling -hub ports to detect device attachments and detachments, performs -initial configuration of setup endpoints, and writes extra information into -.IR usb (3) -endpoint control files, to ease device location. -.PP -By default, -.I usbd -opens all setup endpoints found at -.B #u/usb -(which correspond to built-in hubs initialized by the kernel during boot). -Paths to directories representing setup endpoints for hubs can be given -as arguments to restrict -.I usbd -operation to such hubs. -.PP -When a device is attached, -depending upon a configuration file compiled into -.I usbd , -the appropriate device driver may be started without -user intervention. -This mechanism can be used to statically link some USB device drivers into -.I usbd -itself. -Initial configuration for setup endpoints is performed independently -of this configuration. -.PP -.I Usbd -provides a file interface used to change debugging flags, and also used by -USB device drivers statically linked into -.IR usbd . -By default, the file system is mounted (after) at -.B /dev -and a 9P connection is posted at -.BR /srv/usb . -.PP -Besides files provided by device drivers, the file -.B usbdctl -is always present in the file interface. -It accepts these control requests: -.TF "fsdebug\fI n -.TP -.BI debug " n" -Sets the debugging level to -.IR n . -.TP -.BI fsdebug " n" -Sets the file system debugging level to -.IR n . -.TP -.B dump -Prints the list of devices and file systems known by -.IR usbd . -.PD -.PP -.I Usbd -recognizes the following options: -.TF "-m\fI mnt -.TP -.B -d -Print debugging diagnostics. -Repeating the option increases verbosity. -.TP -.B -D -Print debugging diagnostics for the file system interface. -.TP -.BI -m " mnt" -Mount the served file system at -.IR mnt . -.TP -.BI -s " srv" -Post a 9P connection at -.BI #s/ srv. -.PD -.SS Configuration -.PP -.I Usbd -can be configured to start drivers for devices matching one or more CSPs -(hex representation of USB class, subclass and protocol), class, -subclass, protocol, vendor id, or device id. -When a new device is attached, -.I usbd -scans the configuration and, if an entry matches the device descriptor, starts -the driver. -If no driver is configured, the setup endpoint for the device is left -configured to let the user start the driver by hand. -.PP -Configuration is via compilation -because one of the options is to embed (link) the driver into the -.I usbd -binary. -If the driver is embedded, -.I usbd -creates a process for it and calls its main entry point. -Otherwise, -.I usbd -tries to locate the driver binary in -.B /bin/usb -and creates a process to execute it. -.PP -The configuration file, -.BR usbdb , -has two sections: -.B embed -and -.BR auto . -Each section includes lines to configure particular drivers. -A driver may have more than one line if necessary. -Each line includes the name of the -driver (the base name of the binary) and one or more attributes of the form -.IP -.IR name = value -.PP -The following attributes exist: -.TF subclass -.TP -.B class -.I Value -may be the name of the class -or a number identifying the device class (using C syntax). -The following class names are known: -.BR audio , -.BR comms , -.BR hid , -.BR printer , -.BR storage , -.BR hub , -and -.BR data . -.TP -.B subclass -.I Value -is the number of the device subclass. -.TP -.B proto -.I Value -is the number of the device protocol. -.TP -.B csp -.I Value -is the hexadecimal number describing the CSP for the device. -.TP -.B vid -.I Value -is the vendor id. -.TP -.B did -.I Value -is the device id. -.TP -.B args -This must be the last field. -The value is the rest of the line, -and is supplied as arguments to the driver process. -.PD -.LP -Several environment variables can be used to alter the behaviour of -.IR usbd , -for example, for use in -.IR plan9.ini (8). -.B usbdebug -sets a debug level (zero for no diagnostics and positive -values for increasing verbosity). -.B kbargs -overrides the keyboard arguments as specified by the configuration file. -.B diskargs -overrides the disk arguments in the same way. -.SH EXAMPLE -This configuration file links -.B usb/kb -into -.I usbd -when it is compiled. -It arranges for the driver's entry point, -.B kbmain -in this case, -to be called for any device with CSPs matching either -.B 0x010103 -or -.BR 0x020103 . -Option -.B -d -will be supplied as command line arguments for -.BR kbmain . -This configuration also arranges for -.B /bin/usb/disk -to start (with no arguments) whenever a device of class -.B storage -is attached. -.IP -.EX -embed - kb csp=0x010103 csp=0x020103 args=-d -auto - disk class=storage args= -.EE -.SH FILES -.TF /srv/usb -.TP -.B /srv/usb -9P connection to the driver file system. -.TP -.B /dev -mount point for the driver file system. -.TP -.B /sys/src/cmd/usb/usbd/usbdb -Configuration file deciding which devices are included into -.I usbd -and which ones are started automatically. -.SH SOURCE -.B /sys/src/cmd/usb/usbd -.SH "SEE ALSO" -.IR usb (2), -.IR usb (3), -.IR usb (4) -.SH BUGS -.I Usbd -is not supposed to be restarted. -This is arguable. -.PP -Not heavily exercised yet. diff --git a/sys/man/8/prep b/sys/man/8/prep index 3d72fda47..c09232d34 100644 --- a/sys/man/8/prep +++ b/sys/man/8/prep @@ -709,7 +709,7 @@ disk/format -b /386/pbs -d -r 2 /dev/sdC0/9fat \e .SH SEE ALSO .IR floppy (3), .IR sd (3), -.IR usb (4), +.IR nusb (4), .IR 9boot (8), .IR partfs (8) .SH BUGS |