mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-16 21:34:10 +00:00
Get usb(4) manual page closer to reality:
- update ``struct usb_device_info'' - add information about new fields in about struct - document USB_EVENT_IS_ATTACH() and USB_EVENT_IS_DETACH() - update URL of the USB.ORG developer documentation PR: docs/41580 (original patch) Reviewed by: n_hibma Approved by: des (mentor), re (bmah)
This commit is contained in:
parent
3ebd9b48ce
commit
b8a83c23ca
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=115284
|
@ -178,42 +178,47 @@ This is the only way that new devices are found on the bus.
|
|||
This command can be used to retrieve some information about a device
|
||||
on the bus.
|
||||
The
|
||||
.Va addr
|
||||
.Va udi_addr
|
||||
field should be filled before the call and the other fields will
|
||||
be filled by information about the device on that address.
|
||||
Should no such device exist, an error is reported.
|
||||
.Bd -literal
|
||||
#define USB_MAX_DEVNAMES 4
|
||||
#define USB_MAX_DEVNAMELEN 16
|
||||
struct usb_device_info {
|
||||
u_int8_t bus;
|
||||
u_int8_t addr;
|
||||
usb_event_cookie_t cookie;
|
||||
char product[USB_MAX_STRING_LEN];
|
||||
char vendor[USB_MAX_STRING_LEN];
|
||||
char release[8];
|
||||
u_int16_t productNo;
|
||||
u_int16_t vendorNo;
|
||||
u_int16_t releaseNo;
|
||||
u_int8_t class;
|
||||
u_int8_t subclass;
|
||||
u_int8_t protocol;
|
||||
u_int8_t config;
|
||||
u_int8_t lowspeed;
|
||||
int power;
|
||||
int nports;
|
||||
char devnames[USB_MAX_DEVNAMES][USB_MAX_DEVNAMELEN];
|
||||
u_int8_t ports[16];
|
||||
#define USB_PORT_ENABLED 0xff
|
||||
#define USB_PORT_SUSPENDED 0xfe
|
||||
#define USB_PORT_POWERED 0xfd
|
||||
#define USB_PORT_DISABLED 0xfc
|
||||
u_int8_t udi_bus;
|
||||
u_int8_t udi_addr; /* device address */
|
||||
usb_event_cookie_t udi_cookie;
|
||||
char udi_product[USB_MAX_STRING_LEN];
|
||||
char udi_vendor[USB_MAX_STRING_LEN];
|
||||
char udi_release[8];
|
||||
u_int16_t udi_productNo;
|
||||
u_int16_t udi_vendorNo;
|
||||
u_int16_t udi_releaseNo;
|
||||
u_int8_t udi_class;
|
||||
u_int8_t udi_subclass;
|
||||
u_int8_t udi_protocol;
|
||||
u_int8_t udi_config;
|
||||
u_int8_t udi_speed;
|
||||
#define USB_SPEED_LOW 1
|
||||
#define USB_SPEED_FULL 2
|
||||
#define USB_SPEED_HIGH 3
|
||||
int udi_power;/* power consumption in mA, 0 if selfpowered */
|
||||
int udi_nports;
|
||||
char udi_devnames[USB_MAX_DEVNAMES][USB_MAX_DEVNAMELEN];
|
||||
u_int8_t udi_ports[16];/* hub only: addresses of devices on ports */
|
||||
#define USB_PORT_ENABLED 0xff
|
||||
#define USB_PORT_SUSPENDED 0xfe
|
||||
#define USB_PORT_POWERED 0xfd
|
||||
#define USB_PORT_DISABLED 0xfc
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
.Va bus
|
||||
.Va udi_bus
|
||||
and
|
||||
.Va addr
|
||||
.Va udi_addr
|
||||
contain the topological information for the device.
|
||||
.Va devnames
|
||||
.Va udi_devnames
|
||||
contains the device names of the connected drivers.
|
||||
For example, the
|
||||
third
|
||||
|
@ -221,30 +226,34 @@ third
|
|||
Zip drive connected will be
|
||||
.Li umass2 .
|
||||
The
|
||||
.Va product , vendor
|
||||
.Va udi_product , udi_vendor
|
||||
and
|
||||
.Va release
|
||||
.Va udi_release
|
||||
fields contain self-explanatory descriptions of the device.
|
||||
.Va productNo , vendorNo , releaseNo , class , subclass
|
||||
.Va udi_productNo , udi_vendorNo , udi_releaseNo , udi_class , udi_subclass
|
||||
and
|
||||
.Va protocol
|
||||
.Va udi_protocol
|
||||
contain the corresponding values from the device descriptors.
|
||||
The
|
||||
.Va config
|
||||
.Va udi_config
|
||||
field shows the current configuration of the device.
|
||||
.Pp
|
||||
.Va lowspeed
|
||||
indicates whether the device is a full speed (0) or low speed (1)
|
||||
device.
|
||||
.Va udi_peed
|
||||
indicates whether the device is at low speed
|
||||
.Pq Dv USB_SPEED_LOW ,
|
||||
full speed
|
||||
.Pq Dv USB_SPEED_FULL
|
||||
or high speed
|
||||
.Pq Dv USB_SPEED_HIGH .
|
||||
The
|
||||
.Va power
|
||||
.Va udi_power
|
||||
field shows the power consumption in milli-amps drawn at 5 volts,
|
||||
or zero if the device is self powered.
|
||||
.Pp
|
||||
If the device is a hub, the
|
||||
.Va nports
|
||||
.Va udi_nports
|
||||
field is non-zero, and the
|
||||
.Va ports
|
||||
.Va udi_ports
|
||||
field contains the addresses of the connected devices.
|
||||
If no device is connected to a port, one of the
|
||||
.Dv USB_PORT_*
|
||||
|
@ -253,12 +262,12 @@ values indicates its status.
|
|||
This command retrieves statistics about the controller.
|
||||
.Bd -literal
|
||||
struct usb_device_stats {
|
||||
u_long requests[4];
|
||||
u_long uds_requests[4];
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
The
|
||||
.Va requests
|
||||
.Va udi_requests
|
||||
field is indexed by the transfer kind, i.e.\&
|
||||
.Dv UE_* ,
|
||||
and indicates how many transfers of each kind that has been completed
|
||||
|
@ -337,6 +346,15 @@ The possible events are attach/detach of a host controller,
|
|||
a device, or a device driver.
|
||||
The union contains information
|
||||
pertinent to the different types of events.
|
||||
Macros,
|
||||
.Fn USB_EVENT_IS_ATTACH "ue_type"
|
||||
and
|
||||
.Fn USB_EVENT_IS_DETACH "ue_type"
|
||||
can be used to determine if an event was an
|
||||
.Dq attach
|
||||
or a
|
||||
.Dq detach
|
||||
request.
|
||||
.Pp
|
||||
The
|
||||
.Va ue_bus
|
||||
|
@ -373,7 +391,7 @@ The
|
|||
.Tn USB
|
||||
specifications can be found at:
|
||||
.Pp
|
||||
.D1 Pa http://www.usb.org/developers/docs.html
|
||||
.D1 Pa http://www.usb.org/developers/docs/
|
||||
.Pp
|
||||
.Xr aue 4 ,
|
||||
.Xr cue 4 ,
|
||||
|
|
Loading…
Reference in a new issue