245 lines · 5.1 KB · Text
RawDownload
.TH USBD 4.SH NAMEusbd \- Universal Serial Bus daemon.SH SYNOPSIS.B usbd[.B -Dd][.B -s.I srv][.B -m.I mnt][.I hub...].SH DESCRIPTION.I Usbdcomplements.IR usb (3)to provide USB I/O for device drivers.It enumerates the bus, pollinghub ports to detect device attachments and detachments, performsinitial configuration of setup endpoints, and writes extra information into.IR usb (3)endpoint control files, to ease device location..PPBy default,.I usbdopens 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 givenas arguments to restrict.I usbdoperation to such hubs..PPWhen a device is attached,depending upon a configuration file compiled into.I usbd ,the appropriate device driver may be started withoutuser intervention.This mechanism can be used to statically link some USB device drivers into.I usbditself.Initial configuration for setup endpoints is performed independentlyof this configuration..PP.I Usbdprovides a file interface used to change debugging flags, and also used byUSB device drivers statically linked into.IR usbd .By default, the file system is mounted (after) at.B /devand a 9P connection is posted at.BR /srv/usb ..PPBesides files provided by device drivers, the file.B usbdctlis 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 dumpPrints the list of devices and file systems known by.IR usbd ..PD.PP.I Usbdrecognizes the following options:.TF "-m\fI mnt.TP.B -dPrint debugging diagnostics.Repeating the option increases verbosity..TP.B -DPrint 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 Usbdcan 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 usbdscans the configuration and, if an entry matches the device descriptor, startsthe driver.If no driver is configured, the setup endpoint for the device is leftconfigured to let the user start the driver by hand..PPConfiguration is via compilationbecause one of the options is to embed (link) the driver into the.I usbdbinary.If the driver is embedded,.I usbdcreates a process for it and calls its main entry point.Otherwise,.I usbdtries to locate the driver binary in.B /bin/usband creates a process to execute it..PPThe configuration file,.BR usbdb ,has two sections:.B embedand.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 thedriver (the base name of the binary) and one or more attributes of the form.IP.IR name = value.PPThe following attributes exist:.TF subclass.TP.B class.I Valuemay be the name of the classor 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 Valueis the number of the device subclass..TP.B proto.I Valueis the number of the device protocol..TP.B csp.I Valueis the hexadecimal number describing the CSP for the device..TP.B vid.I Valueis the vendor id..TP.B did.I Valueis the device id..TP.B argsThis must be the last field.The value is the rest of the line,and is supplied as arguments to the driver process..PD.LPSeveral environment variables can be used to alter the behaviour of.IR usbd ,for example, for use in.IR plan9.ini (8)..B usbdebugsets a debug level (zero for no diagnostics and positivevalues for increasing verbosity)..B kbargsoverrides the keyboard arguments as specified by the configuration file..B diskargsoverrides the disk arguments in the same way..SH EXAMPLEThis configuration file links.B usb/kbinto.I usbdwhen it is compiled.It arranges for the driver's entry point,.B kbmainin this case,to be called for any device with CSPs matching either.B 0x010103or.BR 0x020103 .Option.B -dwill be supplied as command line arguments for.BR kbmain .This configuration also arranges for.B /bin/usb/diskto start (with no arguments) whenever a device of class.B storageis attached..IP.EXembed	kb	csp=0x010103 csp=0x020103	args=-dauto	disk	class=storage	args=.EE.SH FILES.TF /srv/usb.TP.B /srv/usb9P connection to the driver file system..TP.B /devmount point for the driver file system..TP.B /sys/src/cmd/usb/usbd/usbdbConfiguration file deciding which devices are included into.I usbdand 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 Usbdis not supposed to be restarted.This is arguable..PPNot heavily exercised yet.