Prefix structure members to protect them against clashes with eg.
c++ keywords. This keeps us in sync with NetBSD because they actually committed my delta first. Ok'd by: lennard
This commit is contained in:
parent
9308b7002c
commit
5bcd0580d7
@ -51,11 +51,11 @@ hid_get_report_desc(int fd)
|
||||
{
|
||||
struct usb_ctl_report_desc rep;
|
||||
|
||||
rep.size = 0;
|
||||
rep.ucrd_size = 0;
|
||||
if (ioctl(fd, USB_GET_REPORT_DESC, &rep) < 0)
|
||||
return (NULL);
|
||||
|
||||
return hid_use_report_desc(rep.data, (unsigned int)rep.size);
|
||||
return hid_use_report_desc(rep.ucrd_data, (unsigned int)rep.ucrd_size);
|
||||
}
|
||||
|
||||
report_desc_t
|
||||
|
@ -51,11 +51,11 @@ hid_get_report_desc(int fd)
|
||||
{
|
||||
struct usb_ctl_report_desc rep;
|
||||
|
||||
rep.size = 0;
|
||||
rep.ucrd_size = 0;
|
||||
if (ioctl(fd, USB_GET_REPORT_DESC, &rep) < 0)
|
||||
return (NULL);
|
||||
|
||||
return hid_use_report_desc(rep.data, (unsigned int)rep.size);
|
||||
return hid_use_report_desc(rep.ucrd_data, (unsigned int)rep.ucrd_size);
|
||||
}
|
||||
|
||||
report_desc_t
|
||||
|
@ -1161,37 +1161,37 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd,
|
||||
case USB_GET_ALTINTERFACE:
|
||||
ai = (struct usb_alt_interface *)addr;
|
||||
err = usbd_device2interface_handle(sc->sc_udev,
|
||||
ai->interface_index, &iface);
|
||||
ai->uai_interface_index, &iface);
|
||||
if (err)
|
||||
return (EINVAL);
|
||||
idesc = usbd_get_interface_descriptor(iface);
|
||||
if (idesc == NULL)
|
||||
return (EIO);
|
||||
ai->alt_no = idesc->bAlternateSetting;
|
||||
ai->uai_alt_no = idesc->bAlternateSetting;
|
||||
break;
|
||||
case USB_SET_ALTINTERFACE:
|
||||
if (!(flag & FWRITE))
|
||||
return (EPERM);
|
||||
ai = (struct usb_alt_interface *)addr;
|
||||
err = usbd_device2interface_handle(sc->sc_udev,
|
||||
ai->interface_index, &iface);
|
||||
ai->uai_interface_index, &iface);
|
||||
if (err)
|
||||
return (EINVAL);
|
||||
err = ugen_set_interface(sc, ai->interface_index, ai->alt_no);
|
||||
err = ugen_set_interface(sc, ai->uai_interface_index, ai->uai_alt_no);
|
||||
if (err)
|
||||
return (EINVAL);
|
||||
break;
|
||||
case USB_GET_NO_ALT:
|
||||
ai = (struct usb_alt_interface *)addr;
|
||||
cdesc = ugen_get_cdesc(sc, ai->config_index, 0);
|
||||
cdesc = ugen_get_cdesc(sc, ai->uai_config_index, 0);
|
||||
if (cdesc == NULL)
|
||||
return (EINVAL);
|
||||
idesc = usbd_find_idesc(cdesc, ai->interface_index, 0);
|
||||
idesc = usbd_find_idesc(cdesc, ai->uai_interface_index, 0);
|
||||
if (idesc == NULL) {
|
||||
free(cdesc, M_TEMP);
|
||||
return (EINVAL);
|
||||
}
|
||||
ai->alt_no = usbd_get_no_alts(cdesc, idesc->bInterfaceNumber);
|
||||
ai->uai_alt_no = usbd_get_no_alts(cdesc, idesc->bInterfaceNumber);
|
||||
free(cdesc, M_TEMP);
|
||||
break;
|
||||
case USB_GET_DEVICE_DESC:
|
||||
@ -1200,47 +1200,47 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd,
|
||||
break;
|
||||
case USB_GET_CONFIG_DESC:
|
||||
cd = (struct usb_config_desc *)addr;
|
||||
cdesc = ugen_get_cdesc(sc, cd->config_index, 0);
|
||||
cdesc = ugen_get_cdesc(sc, cd->ucd_config_index, 0);
|
||||
if (cdesc == NULL)
|
||||
return (EINVAL);
|
||||
cd->desc = *cdesc;
|
||||
cd->ucd_desc = *cdesc;
|
||||
free(cdesc, M_TEMP);
|
||||
break;
|
||||
case USB_GET_INTERFACE_DESC:
|
||||
id = (struct usb_interface_desc *)addr;
|
||||
cdesc = ugen_get_cdesc(sc, id->config_index, 0);
|
||||
cdesc = ugen_get_cdesc(sc, id->uid_config_index, 0);
|
||||
if (cdesc == NULL)
|
||||
return (EINVAL);
|
||||
if (id->config_index == USB_CURRENT_CONFIG_INDEX &&
|
||||
id->alt_index == USB_CURRENT_ALT_INDEX)
|
||||
alt = ugen_get_alt_index(sc, id->interface_index);
|
||||
if (id->uid_config_index == USB_CURRENT_CONFIG_INDEX &&
|
||||
id->uid_alt_index == USB_CURRENT_ALT_INDEX)
|
||||
alt = ugen_get_alt_index(sc, id->uid_interface_index);
|
||||
else
|
||||
alt = id->alt_index;
|
||||
idesc = usbd_find_idesc(cdesc, id->interface_index, alt);
|
||||
alt = id->uid_alt_index;
|
||||
idesc = usbd_find_idesc(cdesc, id->uid_interface_index, alt);
|
||||
if (idesc == NULL) {
|
||||
free(cdesc, M_TEMP);
|
||||
return (EINVAL);
|
||||
}
|
||||
id->desc = *idesc;
|
||||
id->uid_desc = *idesc;
|
||||
free(cdesc, M_TEMP);
|
||||
break;
|
||||
case USB_GET_ENDPOINT_DESC:
|
||||
ed = (struct usb_endpoint_desc *)addr;
|
||||
cdesc = ugen_get_cdesc(sc, ed->config_index, 0);
|
||||
cdesc = ugen_get_cdesc(sc, ed->ued_config_index, 0);
|
||||
if (cdesc == NULL)
|
||||
return (EINVAL);
|
||||
if (ed->config_index == USB_CURRENT_CONFIG_INDEX &&
|
||||
ed->alt_index == USB_CURRENT_ALT_INDEX)
|
||||
alt = ugen_get_alt_index(sc, ed->interface_index);
|
||||
if (ed->ued_config_index == USB_CURRENT_CONFIG_INDEX &&
|
||||
ed->ued_alt_index == USB_CURRENT_ALT_INDEX)
|
||||
alt = ugen_get_alt_index(sc, ed->ued_interface_index);
|
||||
else
|
||||
alt = ed->alt_index;
|
||||
edesc = usbd_find_edesc(cdesc, ed->interface_index,
|
||||
alt, ed->endpoint_index);
|
||||
alt = ed->ued_alt_index;
|
||||
edesc = usbd_find_edesc(cdesc, ed->ued_interface_index,
|
||||
alt, ed->ued_endpoint_index);
|
||||
if (edesc == NULL) {
|
||||
free(cdesc, M_TEMP);
|
||||
return (EINVAL);
|
||||
}
|
||||
ed->desc = *edesc;
|
||||
ed->ued_desc = *edesc;
|
||||
free(cdesc, M_TEMP);
|
||||
break;
|
||||
case USB_GET_FULL_DESC:
|
||||
@ -1251,10 +1251,10 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd,
|
||||
struct usb_full_desc *fd = (struct usb_full_desc *)addr;
|
||||
int error;
|
||||
|
||||
cdesc = ugen_get_cdesc(sc, fd->config_index, &len);
|
||||
if (len > fd->size)
|
||||
len = fd->size;
|
||||
iov.iov_base = (caddr_t)fd->data;
|
||||
cdesc = ugen_get_cdesc(sc, fd->ufd_config_index, &len);
|
||||
if (len > fd->ufd_size)
|
||||
len = fd->ufd_size;
|
||||
iov.iov_base = (caddr_t)fd->ufd_data;
|
||||
iov.iov_len = len;
|
||||
uio.uio_iov = &iov;
|
||||
uio.uio_iovcnt = 1;
|
||||
@ -1269,15 +1269,15 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd,
|
||||
}
|
||||
case USB_GET_STRING_DESC:
|
||||
si = (struct usb_string_desc *)addr;
|
||||
err = usbd_get_string_desc(sc->sc_udev, si->string_index,
|
||||
si->language_id, &si->desc);
|
||||
err = usbd_get_string_desc(sc->sc_udev, si->usd_string_index,
|
||||
si->usd_language_id, &si->usd_desc);
|
||||
if (err)
|
||||
return (EINVAL);
|
||||
break;
|
||||
case USB_DO_REQUEST:
|
||||
{
|
||||
struct usb_ctl_request *ur = (void *)addr;
|
||||
int len = UGETW(ur->request.wLength);
|
||||
int len = UGETW(ur->ucr_request.wLength);
|
||||
struct iovec iov;
|
||||
struct uio uio;
|
||||
void *ptr = 0;
|
||||
@ -1287,18 +1287,18 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd,
|
||||
if (!(flag & FWRITE))
|
||||
return (EPERM);
|
||||
/* Avoid requests that would damage the bus integrity. */
|
||||
if ((ur->request.bmRequestType == UT_WRITE_DEVICE &&
|
||||
ur->request.bRequest == UR_SET_ADDRESS) ||
|
||||
(ur->request.bmRequestType == UT_WRITE_DEVICE &&
|
||||
ur->request.bRequest == UR_SET_CONFIG) ||
|
||||
(ur->request.bmRequestType == UT_WRITE_INTERFACE &&
|
||||
ur->request.bRequest == UR_SET_INTERFACE))
|
||||
if ((ur->ucr_request.bmRequestType == UT_WRITE_DEVICE &&
|
||||
ur->ucr_request.bRequest == UR_SET_ADDRESS) ||
|
||||
(ur->ucr_request.bmRequestType == UT_WRITE_DEVICE &&
|
||||
ur->ucr_request.bRequest == UR_SET_CONFIG) ||
|
||||
(ur->ucr_request.bmRequestType == UT_WRITE_INTERFACE &&
|
||||
ur->ucr_request.bRequest == UR_SET_INTERFACE))
|
||||
return (EINVAL);
|
||||
|
||||
if (len < 0 || len > 32767)
|
||||
return (EINVAL);
|
||||
if (len != 0) {
|
||||
iov.iov_base = (caddr_t)ur->data;
|
||||
iov.iov_base = (caddr_t)ur->ucr_data;
|
||||
iov.iov_len = len;
|
||||
uio.uio_iov = &iov;
|
||||
uio.uio_iovcnt = 1;
|
||||
@ -1306,7 +1306,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd,
|
||||
uio.uio_offset = 0;
|
||||
uio.uio_segflg = UIO_USERSPACE;
|
||||
uio.uio_rw =
|
||||
ur->request.bmRequestType & UT_READ ?
|
||||
ur->ucr_request.bmRequestType & UT_READ ?
|
||||
UIO_READ : UIO_WRITE;
|
||||
uio.uio_procp = p;
|
||||
ptr = malloc(len, M_TEMP, M_WAITOK);
|
||||
@ -1316,8 +1316,8 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd,
|
||||
goto ret;
|
||||
}
|
||||
}
|
||||
err = usbd_do_request_flags(sc->sc_udev, &ur->request,
|
||||
ptr, ur->flags, &ur->actlen);
|
||||
err = usbd_do_request_flags(sc->sc_udev, &ur->ucr_request,
|
||||
ptr, ur->ucr_flags, &ur->ucr_actlen);
|
||||
if (err) {
|
||||
error = EIO;
|
||||
goto ret;
|
||||
|
@ -633,9 +633,9 @@ uhid_do_ioctl(sc, cmd, addr, flag, p)
|
||||
|
||||
case USB_GET_REPORT_DESC:
|
||||
rd = (struct usb_ctl_report_desc *)addr;
|
||||
size = min(sc->sc_repdesc_size, sizeof rd->data);
|
||||
rd->size = size;
|
||||
memcpy(rd->data, sc->sc_repdesc, size);
|
||||
size = min(sc->sc_repdesc_size, sizeof rd->ucrd_data);
|
||||
rd->ucrd_size = size;
|
||||
memcpy(rd->ucrd_data, sc->sc_repdesc, size);
|
||||
break;
|
||||
|
||||
case USB_SET_IMMED:
|
||||
@ -653,7 +653,7 @@ uhid_do_ioctl(sc, cmd, addr, flag, p)
|
||||
|
||||
case USB_GET_REPORT:
|
||||
re = (struct usb_ctl_report *)addr;
|
||||
switch (re->report) {
|
||||
switch (re->ucr_report) {
|
||||
case UHID_INPUT_REPORT:
|
||||
size = sc->sc_isize;
|
||||
id = sc->sc_iid;
|
||||
@ -669,7 +669,7 @@ uhid_do_ioctl(sc, cmd, addr, flag, p)
|
||||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
err = usbd_get_report(sc->sc_iface, re->report, id, re->data,
|
||||
err = usbd_get_report(sc->sc_iface, re->ucr_report, id, re->ucr_data,
|
||||
size);
|
||||
if (err)
|
||||
return (EIO);
|
||||
@ -677,7 +677,7 @@ uhid_do_ioctl(sc, cmd, addr, flag, p)
|
||||
|
||||
case USB_SET_REPORT:
|
||||
re = (struct usb_ctl_report *)addr;
|
||||
switch (re->report) {
|
||||
switch (re->ucr_report) {
|
||||
case UHID_INPUT_REPORT:
|
||||
size = sc->sc_isize;
|
||||
id = sc->sc_iid;
|
||||
@ -693,7 +693,7 @@ uhid_do_ioctl(sc, cmd, addr, flag, p)
|
||||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
err = usbd_set_report(sc->sc_iface, re->report, id, re->data,
|
||||
err = usbd_set_report(sc->sc_iface, re->ucr_report, id, re->ucr_data,
|
||||
size);
|
||||
if (err)
|
||||
return (EIO);
|
||||
|
@ -470,11 +470,11 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p)
|
||||
case USB_REQUEST:
|
||||
{
|
||||
struct usb_ctl_request *ur = (void *)data;
|
||||
int len = UGETW(ur->request.wLength);
|
||||
int len = UGETW(ur->ucr_request.wLength);
|
||||
struct iovec iov;
|
||||
struct uio uio;
|
||||
void *ptr = 0;
|
||||
int addr = ur->addr;
|
||||
int addr = ur->ucr_addr;
|
||||
usbd_status err;
|
||||
int error = 0;
|
||||
|
||||
@ -485,7 +485,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p)
|
||||
sc->sc_bus->devices[addr] == 0)
|
||||
return (EINVAL);
|
||||
if (len != 0) {
|
||||
iov.iov_base = (caddr_t)ur->data;
|
||||
iov.iov_base = (caddr_t)ur->ucr_data;
|
||||
iov.iov_len = len;
|
||||
uio.uio_iov = &iov;
|
||||
uio.uio_iovcnt = 1;
|
||||
@ -493,7 +493,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p)
|
||||
uio.uio_offset = 0;
|
||||
uio.uio_segflg = UIO_USERSPACE;
|
||||
uio.uio_rw =
|
||||
ur->request.bmRequestType & UT_READ ?
|
||||
ur->ucr_request.bmRequestType & UT_READ ?
|
||||
UIO_READ : UIO_WRITE;
|
||||
uio.uio_procp = p;
|
||||
ptr = malloc(len, M_TEMP, M_WAITOK);
|
||||
@ -504,7 +504,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p)
|
||||
}
|
||||
}
|
||||
err = usbd_do_request_flags(sc->sc_bus->devices[addr],
|
||||
&ur->request, ptr, ur->flags, &ur->actlen);
|
||||
&ur->ucr_request, ptr, ur->ucr_flags, &ur->ucr_actlen);
|
||||
if (err) {
|
||||
error = EIO;
|
||||
goto ret;
|
||||
@ -525,7 +525,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p)
|
||||
case USB_DEVICEINFO:
|
||||
{
|
||||
struct usb_device_info *di = (void *)data;
|
||||
int addr = di->addr;
|
||||
int addr = di->udi_addr;
|
||||
usbd_device_handle dev;
|
||||
|
||||
if (addr < 1 || addr >= USB_MAX_DEVICES)
|
||||
@ -679,7 +679,7 @@ usb_add_event(int type, struct usb_event *uep)
|
||||
for (ueqi = TAILQ_FIRST(&usb_events); ueqi; ueqi = ueqi_next) {
|
||||
ueqi_next = TAILQ_NEXT(ueqi, next);
|
||||
if (ueqi->ue.u.ue_driver.ue_cookie.cookie ==
|
||||
uep->u.ue_device.cookie.cookie) {
|
||||
uep->u.ue_device.udi_cookie.cookie) {
|
||||
TAILQ_REMOVE(&usb_events, ueqi, next);
|
||||
free(ueqi, M_USBDEV);
|
||||
usb_nevents--;
|
||||
|
@ -525,58 +525,58 @@ typedef struct {
|
||||
/*** ioctl() related stuff ***/
|
||||
|
||||
struct usb_ctl_request {
|
||||
int addr;
|
||||
usb_device_request_t request;
|
||||
void *data;
|
||||
int flags;
|
||||
int ucr_addr;
|
||||
usb_device_request_t ucr_request;
|
||||
void *ucr_data;
|
||||
int ucr_flags;
|
||||
#define USBD_SHORT_XFER_OK 0x04 /* allow short reads */
|
||||
int actlen; /* actual length transferred */
|
||||
int ucr_actlen; /* actual length transferred */
|
||||
};
|
||||
|
||||
struct usb_alt_interface {
|
||||
int config_index;
|
||||
int interface_index;
|
||||
int alt_no;
|
||||
int uai_config_index;
|
||||
int uai_interface_index;
|
||||
int uai_alt_no;
|
||||
};
|
||||
|
||||
#define USB_CURRENT_CONFIG_INDEX (-1)
|
||||
#define USB_CURRENT_ALT_INDEX (-1)
|
||||
|
||||
struct usb_config_desc {
|
||||
int config_index;
|
||||
usb_config_descriptor_t desc;
|
||||
int ucd_config_index;
|
||||
usb_config_descriptor_t ucd_desc;
|
||||
};
|
||||
|
||||
struct usb_interface_desc {
|
||||
int config_index;
|
||||
int interface_index;
|
||||
int alt_index;
|
||||
usb_interface_descriptor_t desc;
|
||||
int uid_config_index;
|
||||
int uid_interface_index;
|
||||
int uid_alt_index;
|
||||
usb_interface_descriptor_t uid_desc;
|
||||
};
|
||||
|
||||
struct usb_endpoint_desc {
|
||||
int config_index;
|
||||
int interface_index;
|
||||
int alt_index;
|
||||
int endpoint_index;
|
||||
usb_endpoint_descriptor_t desc;
|
||||
int ued_config_index;
|
||||
int ued_interface_index;
|
||||
int ued_alt_index;
|
||||
int ued_endpoint_index;
|
||||
usb_endpoint_descriptor_t ued_desc;
|
||||
};
|
||||
|
||||
struct usb_full_desc {
|
||||
int config_index;
|
||||
u_int size;
|
||||
u_char *data;
|
||||
int ufd_config_index;
|
||||
u_int ufd_size;
|
||||
u_char *ufd_data;
|
||||
};
|
||||
|
||||
struct usb_string_desc {
|
||||
int string_index;
|
||||
int language_id;
|
||||
usb_string_descriptor_t desc;
|
||||
int usd_string_index;
|
||||
int usd_language_id;
|
||||
usb_string_descriptor_t usd_desc;
|
||||
};
|
||||
|
||||
struct usb_ctl_report_desc {
|
||||
int size;
|
||||
u_char data[1024]; /* filled data size will vary */
|
||||
int ucrd_size;
|
||||
u_char ucrd_data[1024]; /* filled data size will vary */
|
||||
};
|
||||
|
||||
typedef struct { u_int32_t cookie; } usb_event_cookie_t;
|
||||
@ -584,27 +584,27 @@ typedef struct { u_int32_t cookie; } usb_event_cookie_t;
|
||||
#define USB_MAX_DEVNAMES 4
|
||||
#define USB_MAX_DEVNAMELEN 16
|
||||
struct usb_device_info {
|
||||
u_int8_t bus;
|
||||
u_int8_t addr; /* device address */
|
||||
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 speed;
|
||||
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 power; /* power consumption in mA, 0 if selfpowered */
|
||||
int nports;
|
||||
char devnames[USB_MAX_DEVNAMES][USB_MAX_DEVNAMELEN];
|
||||
u_int8_t ports[16];/* hub only: addresses of devices on ports */
|
||||
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
|
||||
@ -612,12 +612,12 @@ struct usb_device_info {
|
||||
};
|
||||
|
||||
struct usb_ctl_report {
|
||||
int report;
|
||||
u_char data[1024]; /* filled data size will vary */
|
||||
int ucr_report;
|
||||
u_char ucr_data[1024]; /* filled data size will vary */
|
||||
};
|
||||
|
||||
struct usb_device_stats {
|
||||
u_long requests[4]; /* indexed by transfer type UE_* */
|
||||
u_long uds_requests[4]; /* indexed by transfer type UE_* */
|
||||
};
|
||||
|
||||
/* Events that can be read from /dev/usb */
|
||||
|
@ -1156,37 +1156,37 @@ usbd_fill_deviceinfo(usbd_device_handle dev, struct usb_device_info *di,
|
||||
struct usbd_port *p;
|
||||
int i, err, s;
|
||||
|
||||
di->bus = USBDEVUNIT(dev->bus->bdev);
|
||||
di->addr = dev->address;
|
||||
di->cookie = dev->cookie;
|
||||
usbd_devinfo_vp(dev, di->vendor, di->product, usedev);
|
||||
usbd_printBCD(di->release, UGETW(dev->ddesc.bcdDevice));
|
||||
di->vendorNo = UGETW(dev->ddesc.idVendor);
|
||||
di->productNo = UGETW(dev->ddesc.idProduct);
|
||||
di->releaseNo = UGETW(dev->ddesc.bcdDevice);
|
||||
di->class = dev->ddesc.bDeviceClass;
|
||||
di->subclass = dev->ddesc.bDeviceSubClass;
|
||||
di->protocol = dev->ddesc.bDeviceProtocol;
|
||||
di->config = dev->config;
|
||||
di->power = dev->self_powered ? 0 : dev->power;
|
||||
di->speed = dev->speed;
|
||||
di->udi_bus = USBDEVUNIT(dev->bus->bdev);
|
||||
di->udi_addr = dev->address;
|
||||
di->udi_cookie = dev->cookie;
|
||||
usbd_devinfo_vp(dev, di->udi_vendor, di->udi_product, usedev);
|
||||
usbd_printBCD(di->udi_release, UGETW(dev->ddesc.bcdDevice));
|
||||
di->udi_vendorNo = UGETW(dev->ddesc.idVendor);
|
||||
di->udi_productNo = UGETW(dev->ddesc.idProduct);
|
||||
di->udi_releaseNo = UGETW(dev->ddesc.bcdDevice);
|
||||
di->udi_class = dev->ddesc.bDeviceClass;
|
||||
di->udi_subclass = dev->ddesc.bDeviceSubClass;
|
||||
di->udi_protocol = dev->ddesc.bDeviceProtocol;
|
||||
di->udi_config = dev->config;
|
||||
di->udi_power = dev->self_powered ? 0 : dev->power;
|
||||
di->udi_speed = dev->speed;
|
||||
|
||||
if (dev->subdevs != NULL) {
|
||||
for (i = 0; dev->subdevs[i] &&
|
||||
i < USB_MAX_DEVNAMES; i++) {
|
||||
strncpy(di->devnames[i], USBDEVPTRNAME(dev->subdevs[i]),
|
||||
strncpy(di->udi_devnames[i], USBDEVPTRNAME(dev->subdevs[i]),
|
||||
USB_MAX_DEVNAMELEN);
|
||||
di->devnames[i][USB_MAX_DEVNAMELEN-1] = '\0';
|
||||
di->udi_devnames[i][USB_MAX_DEVNAMELEN-1] = '\0';
|
||||
}
|
||||
} else {
|
||||
i = 0;
|
||||
}
|
||||
for (/*i is set */; i < USB_MAX_DEVNAMES; i++)
|
||||
di->devnames[i][0] = 0; /* empty */
|
||||
di->udi_devnames[i][0] = 0; /* empty */
|
||||
|
||||
if (dev->hub) {
|
||||
for (i = 0;
|
||||
i < sizeof(di->ports) / sizeof(di->ports[0]) &&
|
||||
i < sizeof(di->udi_ports) / sizeof(di->udi_ports[0]) &&
|
||||
i < dev->hub->hubdesc.bNbrPorts;
|
||||
i++) {
|
||||
p = &dev->hub->ports[i];
|
||||
@ -1203,11 +1203,11 @@ usbd_fill_deviceinfo(usbd_device_handle dev, struct usb_device_info *di,
|
||||
else
|
||||
err = USB_PORT_DISABLED;
|
||||
}
|
||||
di->ports[i] = err;
|
||||
di->udi_ports[i] = err;
|
||||
}
|
||||
di->nports = dev->hub->hubdesc.bNbrPorts;
|
||||
di->udi_nports = dev->hub->hubdesc.bNbrPorts;
|
||||
} else
|
||||
di->nports = 0;
|
||||
di->udi_nports = 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -823,7 +823,7 @@ usb_transfer_complete(xfer)
|
||||
}
|
||||
|
||||
/* Count completed transfers. */
|
||||
++pipe->device->bus->stats.requests
|
||||
++pipe->device->bus->stats.uds_requests
|
||||
[pipe->endpoint->edesc->bmAttributes & UE_XFERTYPE];
|
||||
|
||||
xfer->done = 1;
|
||||
|
@ -582,23 +582,23 @@ print_event(struct usb_event *event)
|
||||
|
||||
printf(" at %ld.%09ld, %s, %s:\n",
|
||||
timespec->tv_sec, timespec->tv_nsec,
|
||||
devinfo->product, devinfo->vendor);
|
||||
devinfo->udi_product, devinfo->udi_vendor);
|
||||
|
||||
printf(" vndr=0x%04x prdct=0x%04x rlse=0x%04x "
|
||||
"clss=0x%04x subclss=0x%04x prtcl=0x%04x\n",
|
||||
devinfo->vendorNo, devinfo->productNo,
|
||||
devinfo->releaseNo,
|
||||
devinfo->class, devinfo->subclass, devinfo->protocol);
|
||||
devinfo->udi_vendorNo, devinfo->udi_productNo,
|
||||
devinfo->udi_releaseNo,
|
||||
devinfo->udi_class, devinfo->udi_subclass, devinfo->udi_protocol);
|
||||
|
||||
if (devinfo->devnames[0][0] != '\0') {
|
||||
if (devinfo->udi_devnames[0][0] != '\0') {
|
||||
char c = ' ';
|
||||
|
||||
printf(" device names:");
|
||||
for (i = 0; i < USB_MAX_DEVNAMES; i++) {
|
||||
if (devinfo->devnames[i][0] == '\0')
|
||||
if (devinfo->udi_devnames[i][0] == '\0')
|
||||
break;
|
||||
|
||||
printf("%c%s", c, devinfo->devnames[i]);
|
||||
printf("%c%s", c, devinfo->udi_devnames[i]);
|
||||
c = ',';
|
||||
}
|
||||
}
|
||||
@ -681,15 +681,15 @@ match_devname(action_t *action, struct usb_device_info *devinfo)
|
||||
int error;
|
||||
|
||||
for (i = 0; i < USB_MAX_DEVNAMES; i++) {
|
||||
if (devinfo->devnames[i][0] == '\0')
|
||||
if (devinfo->udi_devnames[i][0] == '\0')
|
||||
break;
|
||||
|
||||
error = regexec(&action->devname_regex, devinfo->devnames[i],
|
||||
error = regexec(&action->devname_regex, devinfo->udi_devnames[i],
|
||||
1, &match, 0);
|
||||
if (error == 0) {
|
||||
if (verbose >= 2)
|
||||
printf("%s: %s matches %s\n", __progname,
|
||||
devinfo->devnames[i], action->devname);
|
||||
devinfo->udi_devnames[i], action->devname);
|
||||
return(i);
|
||||
}
|
||||
}
|
||||
@ -707,17 +707,17 @@ find_action(struct usb_device_info *devinfo, action_match_t *action_match)
|
||||
|
||||
STAILQ_FOREACH(action, &actions, next) {
|
||||
if ((action->vendor == WILDCARD_INT ||
|
||||
action->vendor == devinfo->vendorNo) &&
|
||||
action->vendor == devinfo->udi_vendorNo) &&
|
||||
(action->product == WILDCARD_INT ||
|
||||
action->product == devinfo->productNo) &&
|
||||
action->product == devinfo->udi_productNo) &&
|
||||
(action->release == WILDCARD_INT ||
|
||||
action->release == devinfo->releaseNo) &&
|
||||
action->release == devinfo->udi_releaseNo) &&
|
||||
(action->class == WILDCARD_INT ||
|
||||
action->class == devinfo->class) &&
|
||||
action->class == devinfo->udi_class) &&
|
||||
(action->subclass == WILDCARD_INT ||
|
||||
action->subclass == devinfo->subclass) &&
|
||||
action->subclass == devinfo->udi_subclass) &&
|
||||
(action->protocol == WILDCARD_INT ||
|
||||
action->protocol == devinfo->protocol) &&
|
||||
action->protocol == devinfo->udi_protocol) &&
|
||||
(action->devname == WILDCARD_STRING ||
|
||||
(match = match_devname(action, devinfo)) != -1)) {
|
||||
/* found match !*/
|
||||
@ -727,16 +727,16 @@ find_action(struct usb_device_info *devinfo, action_match_t *action_match)
|
||||
* one devname for that device, use that.
|
||||
*/
|
||||
if (match >= 0)
|
||||
devname = devinfo->devnames[match];
|
||||
else if (devinfo->devnames[0][0] != '\0' &&
|
||||
devinfo->devnames[1][0] == '\0')
|
||||
devname = devinfo->udi_devnames[match];
|
||||
else if (devinfo->udi_devnames[0][0] != '\0' &&
|
||||
devinfo->udi_devnames[1][0] == '\0')
|
||||
/* if we have exactly 1 device name */
|
||||
devname = devinfo->devnames[0];
|
||||
devname = devinfo->udi_devnames[0];
|
||||
|
||||
if (verbose) {
|
||||
printf("%s: Found action '%s' for %s, %s",
|
||||
__progname, action->name,
|
||||
devinfo->product, devinfo->vendor);
|
||||
devinfo->udi_product, devinfo->udi_vendor);
|
||||
if (devname)
|
||||
printf(" at %s", devname);
|
||||
printf("\n");
|
||||
|
@ -78,7 +78,7 @@ usbdev(int f, int a, int rec)
|
||||
struct usb_device_info di;
|
||||
int e, p, i;
|
||||
|
||||
di.addr = a;
|
||||
di.udi_addr = a;
|
||||
e = ioctl(f, USB_DEVICEINFO, &di);
|
||||
if (e) {
|
||||
if (errno != ENXIO)
|
||||
@ -88,38 +88,38 @@ usbdev(int f, int a, int rec)
|
||||
printf("addr %d: ", a);
|
||||
done[a] = 1;
|
||||
if (verbose) {
|
||||
switch (di.speed) {
|
||||
switch (di.udi_speed) {
|
||||
case USB_SPEED_LOW: printf("low speed, "); break;
|
||||
case USB_SPEED_FULL: printf("full speed, "); break;
|
||||
case USB_SPEED_HIGH: printf("high speed, "); break;
|
||||
default: break;
|
||||
}
|
||||
if (di.power)
|
||||
printf("power %d mA, ", di.power);
|
||||
if (di.udi_power)
|
||||
printf("power %d mA, ", di.udi_power);
|
||||
else
|
||||
printf("self powered, ");
|
||||
if (di.config)
|
||||
printf("config %d, ", di.config);
|
||||
if (di.udi_config)
|
||||
printf("config %d, ", di.udi_config);
|
||||
else
|
||||
printf("unconfigured, ");
|
||||
}
|
||||
if (verbose) {
|
||||
printf("%s(0x%04x), %s(0x%04x), rev %s",
|
||||
di.product, di.productNo,
|
||||
di.vendor, di.vendorNo, di.release);
|
||||
di.udi_product, di.udi_productNo,
|
||||
di.udi_vendor, di.udi_vendorNo, di.udi_release);
|
||||
} else
|
||||
printf("%s, %s", di.product, di.vendor);
|
||||
printf("%s, %s", di.udi_product, di.udi_vendor);
|
||||
printf("\n");
|
||||
if (showdevs) {
|
||||
for (i = 0; i < USB_MAX_DEVNAMES; i++)
|
||||
if (di.devnames[i][0])
|
||||
if (di.udi_devnames[i][0])
|
||||
printf("%*s %s\n", indent, "",
|
||||
di.devnames[i]);
|
||||
di.udi_devnames[i]);
|
||||
}
|
||||
if (!rec)
|
||||
return;
|
||||
for (p = 0; p < di.nports; p++) {
|
||||
int s = di.ports[p];
|
||||
for (p = 0; p < di.udi_nports; p++) {
|
||||
int s = di.udi_ports[p];
|
||||
if (s >= USB_MAX_DEVICES) {
|
||||
if (verbose) {
|
||||
printf("%*sport %d %s\n", indent+1, "", p+1,
|
||||
|
Loading…
Reference in New Issue
Block a user