Subject: Re: Manual pages for usb
To: None <tech-kern@NetBSD.org>
From: Ian Zagorskih <ianzag@megasignal.com>
List: tech-kern
Date: 02/06/2004 18:33:03
On Thursday 05 February 2004 21:48, Ian Zagorskih wrote:
> Not sure if I should post this message to tech-kern or tech-docs.. Well,
> let it be tech-kern :)
>
> From "man usb" at http://netbsd.gw.com/cgi-bin/man-cgi?usb++NetBSD-current
>
> ---cut---
> USB EVENT INTERFACE
> All USB events are reported via the /dev/usb device. This devices can
> be opened for reading and each read(2) will yield an event record (if some-
> thing has happened). The poll(2) system call can be used to determine if
> an event record is available for reading.
> ---cut---
>
> When i read this i got confused that i can open for events not only
> /dev/usb device but also /dev/usb0, usb1 and so on i.e. all /dev/usbX.
> Though as practice shows (at least on NetBSD-1.6.1/i386) only /dev/usb
> device actually returns event on read() call and all another /dev/usbX
> devices just immediatly return ENXIO "Device not configured".
>
> Maybe, it would be better to re-phrase a bit this paragraph like
> "s/devices/device" in "This devices can be" ?
>
> // wbr
Just addition: "man usb(4)" and actuall dev/usb/usb.h headers differs in
describing usb_device_info structure:
---man usb(4) and http://netbsd.gw.com/cgi-bin/man-cgi?usb+4---
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
};
---man usb---
---dev/usb/usb.h---
struct usb_device_info {
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
};
---dev/usb/usb.h---
// wbr