update to v0.5

This commit is contained in:
jakob 2002-09-07 19:21:55 +00:00
parent 12547f9a6d
commit dcc9813e18
5 changed files with 5 additions and 448 deletions

View File

@ -1,10 +1,9 @@
# $OpenBSD: Makefile,v 1.10 2002/03/21 21:25:52 espie Exp $
# $OpenBSD: Makefile,v 1.11 2002/09/07 19:21:55 jakob Exp $
COMMENT= "USB developer utilities"
DISTNAME= usbutil-0.4
DISTNAME= usbutil-0.5
CATEGORIES= sysutils
NEED_VERSION= 1.515
MASTER_SITES= ftp://ftp.augustsson.net/pub/netbsd/

View File

@ -1,3 +1,3 @@
MD5 (usbutil-0.4.tar.gz) = 901bee1fd69f3375aa3aa6b6ae554822
RMD160 (usbutil-0.4.tar.gz) = 0122290eea989ec82504da417e28b27fa8800e15
SHA1 (usbutil-0.4.tar.gz) = b64567b19cf55f1baba727ba57ad21c2cff27bc4
MD5 (usbutil-0.5.tar.gz) = 3ca61f11056567846e403787b7ea20d0
RMD160 (usbutil-0.5.tar.gz) = 48c6bedeed8daf50a760feedef3575db021066f8
SHA1 (usbutil-0.5.tar.gz) = 4c9abc6f370ab561bd2748b1792802d1e959c599

View File

@ -1,333 +0,0 @@
$OpenBSD: patch-usbctl_c,v 1.1 2002/06/16 19:36:33 pvalchev Exp $
--- usbctl.c.orig Sun Jun 16 13:32:56 2002
+++ usbctl.c Sun Jun 16 13:35:00 2002
@@ -76,18 +76,18 @@ getstring(int si, char *s)
*s = 0;
return;
}
- req.addr = usbaddr;
- req.request.bmRequestType = UT_READ_DEVICE;
- req.request.bRequest = UR_GET_DESCRIPTOR;
- req.data = &us;
- USETW2(req.request.wValue, UDESC_STRING, si);
- USETW(req.request.wIndex, 0);
+ req.ucr_addr = usbaddr;
+ req.ucr_request.bmRequestType = UT_READ_DEVICE;
+ req.ucr_request.bRequest = UR_GET_DESCRIPTOR;
+ req.ucr_data = &us;
+ USETW2(req.ucr_request.wValue, UDESC_STRING, si);
+ USETW(req.ucr_request.wIndex, 0);
#ifdef NSTRINGS
- USETW(req.request.wLength, sizeof(usb_string_descriptor_t));
- req.flags = USBD_SHORT_XFER_OK;
+ USETW(req.ucr_request.wLength, sizeof(usb_string_descriptor_t));
+ req.ucr_flags = USBD_SHORT_XFER_OK;
#else
- USETW(req.request.wLength, 1);
- req.flags = 0;
+ USETW(req.ucr_request.wLength, 1);
+ req.ucr_flags = 0;
#endif
r = ioctl(usbf, USB_REQUEST, &req);
if (r < 0) {
@@ -96,7 +96,7 @@ getstring(int si, char *s)
return;
}
#ifndef NSTRINGS
- USETW(req.request.wLength, us.bLength);
+ USETW(req.ucr_request.wLength, us.bLength);
r = ioctl(usbf, USB_REQUEST, &req);
if (r < 0)
err(1, "USB_REQUEST");
@@ -123,10 +123,10 @@ prunits(int f)
int r, n, i;
for(n = i = 0; i < USB_MAX_DEVICES; i++) {
- di.addr = i;
+ di.udi_addr = i;
r = ioctl(f, USB_DEVICEINFO, &di);
if (r == 0) {
- printf("USB device %d: %d\n", i, di.class);
+ printf("USB device %d: %d\n", i, di.udi_class);
n++;
}
}
@@ -618,14 +618,14 @@ gethubdesc(int f, usb_hub_descriptor_t *
struct usb_ctl_request req;
int r;
- req.addr = addr;
- req.request.bmRequestType = UT_READ_CLASS_DEVICE;
- req.request.bRequest = UR_GET_DESCRIPTOR;
- USETW(req.request.wValue, 0);
- USETW(req.request.wIndex, 0);
- USETW(req.request.wLength, USB_HUB_DESCRIPTOR_SIZE);
- req.data = d;
- req.flags = 0;
+ req.ucr_addr = addr;
+ req.ucr_request.bmRequestType = UT_READ_CLASS_DEVICE;
+ req.ucr_request.bRequest = UR_GET_DESCRIPTOR;
+ USETW(req.ucr_request.wValue, 0);
+ USETW(req.ucr_request.wIndex, 0);
+ USETW(req.ucr_request.wLength, USB_HUB_DESCRIPTOR_SIZE);
+ req.ucr_data = d;
+ req.ucr_flags = 0;
r = ioctl(f, USB_REQUEST, &req);
if (r < 0)
err(1, "USB_REQUEST");
@@ -637,14 +637,14 @@ getdevicedesc(int f, usb_device_descript
struct usb_ctl_request req;
int r;
- req.addr = addr;
- req.request.bmRequestType = UT_READ_DEVICE;
- req.request.bRequest = UR_GET_DESCRIPTOR;
- USETW2(req.request.wValue, UDESC_DEVICE, 0);
- USETW(req.request.wIndex, 0);
- USETW(req.request.wLength, USB_DEVICE_DESCRIPTOR_SIZE);
- req.data = d;
- req.flags = 0;
+ req.ucr_addr = addr;
+ req.ucr_request.bmRequestType = UT_READ_DEVICE;
+ req.ucr_request.bRequest = UR_GET_DESCRIPTOR;
+ USETW2(req.ucr_request.wValue, UDESC_DEVICE, 0);
+ USETW(req.ucr_request.wIndex, 0);
+ USETW(req.ucr_request.wLength, USB_DEVICE_DESCRIPTOR_SIZE);
+ req.ucr_data = d;
+ req.ucr_flags = 0;
r = ioctl(f, USB_REQUEST, &req);
if (r < 0)
err(1, "USB_REQUEST");
@@ -656,24 +656,24 @@ getconfigdesc(int f, int i, usb_config_d
struct usb_ctl_request req;
int r;
- req.addr = addr;
- req.request.bmRequestType = UT_READ_DEVICE;
- req.request.bRequest = UR_GET_DESCRIPTOR;
- USETW2(req.request.wValue, UDESC_CONFIG, i);
- USETW(req.request.wIndex, 0);
- USETW(req.request.wLength, USB_CONFIG_DESCRIPTOR_SIZE);
- req.data = d;
- req.flags = 0;
+ req.ucr_addr = addr;
+ req.ucr_request.bmRequestType = UT_READ_DEVICE;
+ req.ucr_request.bRequest = UR_GET_DESCRIPTOR;
+ USETW2(req.ucr_request.wValue, UDESC_CONFIG, i);
+ USETW(req.ucr_request.wIndex, 0);
+ USETW(req.ucr_request.wLength, USB_CONFIG_DESCRIPTOR_SIZE);
+ req.ucr_data = d;
+ req.ucr_flags = 0;
r = ioctl(f, USB_REQUEST, &req);
if (r < 0)
err(1, "USB_REQUEST");
- req.addr = addr;
- req.request.bmRequestType = UT_READ_DEVICE;
- req.request.bRequest = UR_GET_DESCRIPTOR;
- USETW2(req.request.wValue, UDESC_CONFIG, i);
- USETW(req.request.wIndex, 0);
- USETW(req.request.wLength, UGETW(d->wTotalLength));
- req.data = d;
+ req.ucr_addr = addr;
+ req.ucr_request.bmRequestType = UT_READ_DEVICE;
+ req.ucr_request.bRequest = UR_GET_DESCRIPTOR;
+ USETW2(req.ucr_request.wValue, UDESC_CONFIG, i);
+ USETW(req.ucr_request.wIndex, 0);
+ USETW(req.ucr_request.wLength, UGETW(d->wTotalLength));
+ req.ucr_data = d;
r = ioctl(f, USB_REQUEST, &req);
if (r < 0)
err(1, "USB_REQUEST");
@@ -685,14 +685,14 @@ gethiddesc(int f, int i, usb_hid_descrip
struct usb_ctl_request req;
int r;
- req.addr = addr;
- req.request.bmRequestType = UT_READ_INTERFACE;
- req.request.bRequest = UR_GET_DESCRIPTOR;
- USETW2(req.request.wValue, UDESC_HID, 0);
- USETW(req.request.wIndex, i);
- USETW(req.request.wLength, size);
- req.data = d;
- req.flags = 0;
+ req.ucr_addr = addr;
+ req.ucr_request.bmRequestType = UT_READ_INTERFACE;
+ req.ucr_request.bRequest = UR_GET_DESCRIPTOR;
+ USETW2(req.ucr_request.wValue, UDESC_HID, 0);
+ USETW(req.ucr_request.wIndex, i);
+ USETW(req.ucr_request.wLength, size);
+ req.ucr_data = d;
+ req.ucr_flags = 0;
r = ioctl(f, USB_REQUEST, &req);
if (r < 0)
err(1, "USB_REQUEST");
@@ -704,14 +704,14 @@ getreportdesc(int f, int ifc, int no, ch
struct usb_ctl_request req;
int r;
- req.addr = addr;
- req.request.bmRequestType = UT_READ_INTERFACE;
- req.request.bRequest = UR_GET_DESCRIPTOR;
- USETW2(req.request.wValue, UDESC_REPORT, no);
- USETW(req.request.wIndex, ifc);
- USETW(req.request.wLength, size);
- req.data = d;
- req.flags = 0;
+ req.ucr_addr = addr;
+ req.ucr_request.bmRequestType = UT_READ_INTERFACE;
+ req.ucr_request.bRequest = UR_GET_DESCRIPTOR;
+ USETW2(req.ucr_request.wValue, UDESC_REPORT, no);
+ USETW(req.ucr_request.wIndex, ifc);
+ USETW(req.ucr_request.wLength, size);
+ req.ucr_data = d;
+ req.ucr_flags = 0;
r = ioctl(f, USB_REQUEST, &req);
if (r < 0)
err(1, "USB_REQUEST");
@@ -723,14 +723,14 @@ getportstatus(int f, int i, usb_port_sta
struct usb_ctl_request req;
int r;
- req.addr = addr;
- req.request.bmRequestType = UT_READ_CLASS_OTHER;
- req.request.bRequest = UR_GET_STATUS;
- USETW(req.request.wValue, 0);
- USETW(req.request.wIndex, i);
- USETW(req.request.wLength, 4);
- req.data = d;
- req.flags = 0;
+ req.ucr_addr = addr;
+ req.ucr_request.bmRequestType = UT_READ_CLASS_OTHER;
+ req.ucr_request.bRequest = UR_GET_STATUS;
+ USETW(req.ucr_request.wValue, 0);
+ USETW(req.ucr_request.wIndex, i);
+ USETW(req.ucr_request.wLength, 4);
+ req.ucr_data = d;
+ req.ucr_flags = 0;
r = ioctl(f, USB_REQUEST, &req);
if (r < 0)
err(1, "USB_REQUEST");
@@ -742,14 +742,14 @@ gethubstatus(int f, usb_hub_status_t *d,
struct usb_ctl_request req;
int r;
- req.addr = addr;
- req.request.bmRequestType = UT_READ_CLASS_DEVICE;
- req.request.bRequest = UR_GET_STATUS;
- USETW(req.request.wValue, 0);
- USETW(req.request.wIndex, 0);
- USETW(req.request.wLength, 4);
- req.data = d;
- req.flags = 0;
+ req.ucr_addr = addr;
+ req.ucr_request.bmRequestType = UT_READ_CLASS_DEVICE;
+ req.ucr_request.bRequest = UR_GET_STATUS;
+ USETW(req.ucr_request.wValue, 0);
+ USETW(req.ucr_request.wIndex, 0);
+ USETW(req.ucr_request.wLength, 4);
+ req.ucr_data = d;
+ req.ucr_flags = 0;
r = ioctl(f, USB_REQUEST, &req);
if (r < 0)
err(1, "USB_REQUEST");
@@ -761,14 +761,14 @@ getconfiguration(int f, u_int8_t *d, int
struct usb_ctl_request req;
int r;
- req.addr = addr;
- req.request.bmRequestType = UT_READ_DEVICE;
- req.request.bRequest = UR_GET_CONFIG;
- USETW(req.request.wValue, 0);
- USETW(req.request.wIndex, 0);
- USETW(req.request.wLength, 1);
- req.data = d;
- req.flags = 0;
+ req.ucr_addr = addr;
+ req.ucr_request.bmRequestType = UT_READ_DEVICE;
+ req.ucr_request.bRequest = UR_GET_CONFIG;
+ USETW(req.ucr_request.wValue, 0);
+ USETW(req.ucr_request.wIndex, 0);
+ USETW(req.ucr_request.wLength, 1);
+ req.ucr_data = d;
+ req.ucr_flags = 0;
r = ioctl(f, USB_REQUEST, &req);
if (r < 0)
err(1, "USB_REQUEST");
@@ -780,14 +780,14 @@ getdevicestatus(int f, usb_status_t *d,
struct usb_ctl_request req;
int r;
- req.addr = addr;
- req.request.bmRequestType = UT_READ_DEVICE;
- req.request.bRequest = UR_GET_STATUS;
- USETW(req.request.wValue, 0);
- USETW(req.request.wIndex, 0);
- USETW(req.request.wLength, 2);
- req.data = d;
- req.flags = 0;
+ req.ucr_addr = addr;
+ req.ucr_request.bmRequestType = UT_READ_DEVICE;
+ req.ucr_request.bRequest = UR_GET_STATUS;
+ USETW(req.ucr_request.wValue, 0);
+ USETW(req.ucr_request.wIndex, 0);
+ USETW(req.ucr_request.wLength, 2);
+ req.ucr_data = d;
+ req.ucr_flags = 0;
r = ioctl(f, USB_REQUEST, &req);
if (r < 0)
err(1, "USB_REQUEST");
@@ -799,14 +799,14 @@ getinterfacestatus(int f, usb_status_t *
struct usb_ctl_request req;
int r;
- req.addr = addr;
- req.request.bmRequestType = UT_READ_INTERFACE;
- req.request.bRequest = UR_GET_STATUS;
- USETW(req.request.wValue, 0);
- USETW(req.request.wIndex, ifc);
- USETW(req.request.wLength, 2);
- req.data = d;
- req.flags = 0;
+ req.ucr_addr = addr;
+ req.ucr_request.bmRequestType = UT_READ_INTERFACE;
+ req.ucr_request.bRequest = UR_GET_STATUS;
+ USETW(req.ucr_request.wValue, 0);
+ USETW(req.ucr_request.wIndex, ifc);
+ USETW(req.ucr_request.wLength, 2);
+ req.ucr_data = d;
+ req.ucr_flags = 0;
r = ioctl(f, USB_REQUEST, &req);
if (r < 0)
err(1, "USB_REQUEST");
@@ -818,14 +818,14 @@ getendpointstatus(int f, usb_status_t *d
struct usb_ctl_request req;
int r;
- req.addr = addr;
- req.request.bmRequestType = UT_READ_ENDPOINT;
- req.request.bRequest = UR_GET_STATUS;
- USETW(req.request.wValue, 0);
- USETW(req.request.wIndex, endp);
- USETW(req.request.wLength, 2);
- req.data = d;
- req.flags = 0;
+ req.ucr_addr = addr;
+ req.ucr_request.bmRequestType = UT_READ_ENDPOINT;
+ req.ucr_request.bRequest = UR_GET_STATUS;
+ USETW(req.ucr_request.wValue, 0);
+ USETW(req.ucr_request.wIndex, endp);
+ USETW(req.ucr_request.wLength, 2);
+ req.ucr_data = d;
+ req.ucr_flags = 0;
r = ioctl(f, USB_REQUEST, &req);
if (r < 0)
err(1, "USB_REQUEST");
@@ -1324,7 +1324,7 @@ main(int argc, char **argv)
for(addr = 0; addr < USB_MAX_DEVICES; addr++) {
if (doaddr != -1 && addr != doaddr)
continue;
- di.addr = addr;
+ di.udi_addr = addr;
r = ioctl(f, USB_DEVICEINFO, &di);
if (r)
continue;

View File

@ -1,91 +0,0 @@
$OpenBSD: patch-usbgen_c,v 1.1 2002/06/16 19:36:33 pvalchev Exp $
--- usbgen.c.orig Sun Jun 16 13:31:54 2002
+++ usbgen.c Sun Jun 16 13:31:58 2002
@@ -123,9 +123,9 @@ dump_idesc(int f, int all, int cindex, i
struct usb_endpoint_desc edesc;
int e;
- idesc.config_index = cindex;
- idesc.interface_index = iindex;
- idesc.alt_index = aindex;
+ idesc.uid_config_index = cindex;
+ idesc.uid_interface_index = iindex;
+ idesc.uid_alt_index = aindex;
/*printf("*** idesc %d %d %d\n", cindex, iindex, aindex);*/
if (ioctl(f, USB_GET_INTERFACE_DESC, &idesc) != 0)
err(1, "ioctl USB_GET_INTERFACE_DESC");
@@ -135,18 +135,18 @@ dump_idesc(int f, int all, int cindex, i
} else {
printf(" INTERFACE descriptor index %d:\n", iindex);
}
- show_interface_desc(2, &idesc.desc);
+ show_interface_desc(2, &idesc.uid_desc);
printf("\n");
- edesc.config_index = cindex;
- edesc.interface_index = iindex;
- edesc.alt_index = aindex;
- for (e = 0; e < idesc.desc.bNumEndpoints; e++) {
- edesc.endpoint_index = e;
+ edesc.ued_config_index = cindex;
+ edesc.ued_interface_index = iindex;
+ edesc.ued_alt_index = aindex;
+ for (e = 0; e < idesc.uid_desc.bNumEndpoints; e++) {
+ edesc.ued_endpoint_index = e;
if (ioctl(f, USB_GET_ENDPOINT_DESC, &edesc) != 0)
err(1, "ioctl USB_GET_ENDPOINT_DESC");
printf(" ENDPOINT descriptor index %d:\n", e);
- show_endpoint_desc(4, &edesc.desc);
+ show_endpoint_desc(4, &edesc.ued_desc);
printf("\n");
}
}
@@ -158,29 +158,29 @@ dump_cdesc(int f, int all, int cindex)
struct usb_alt_interface ai;
int i, a;
- cdesc.config_index = cindex;
+ cdesc.ucd_config_index = cindex;
if (ioctl(f, USB_GET_CONFIG_DESC, &cdesc) != 0)
err(1, "ioctl USB_GET_CONFIG_DESC");
if (all)
printf("CONFIGURATION descriptor index %d:\n", cindex);
else
printf("CONFIGURATION descriptor:\n");
- show_config_desc(0, &cdesc.desc);
+ show_config_desc(0, &cdesc.ucd_desc);
printf("\n");
- for (i = 0; i < cdesc.desc.bNumInterface; i++) {
+ for (i = 0; i < cdesc.ucd_desc.bNumInterface; i++) {
if (all) {
#if 0
if (ioctl(f, USB_GET_ALTINTERFACE, &ai) != 0)
err(1, "USB_GET_ALTINTERFACE");
printf("Current alternative %d\n", ai->alt_no);
#endif
- ai.config_index = cindex;
- ai.interface_index = i;
+ ai.uai_config_index = cindex;
+ ai.uai_interface_index = i;
if (ioctl(f, USB_GET_NO_ALT, &ai) != 0)
err(1, "USB_GET_NO_ALT");
/*printf("*** %d alts\n", ai.alt_no);*/
- for (a = 0; a < ai.alt_no; a++)
+ for (a = 0; a < ai.uai_alt_no; a++)
dump_idesc(f, all, cindex, i, a);
} else {
dump_idesc(f, all, cindex, i, USB_CURRENT_ALT_INDEX);
@@ -219,9 +219,9 @@ dump_deviceinfo(int f)
if (ioctl(f, USB_GET_DEVICEINFO, &di) != 0)
err(1, "USB_GET_DEVICEINFO");
- printf("Product: %s\n", di.product);
- printf("Vendor: %s\n", di.vendor);
- printf("address %d\n", di.addr);
+ printf("Product: %s\n", di.udi_product);
+ printf("Vendor: %s\n", di.udi_vendor);
+ printf("address %d\n", di.udi_addr);
}
void

View File

@ -1,18 +0,0 @@
$OpenBSD: patch-usbstats_c,v 1.1 2002/06/16 19:36:33 pvalchev Exp $
--- usbstats.c.orig Sun Jun 16 13:35:07 2002
+++ usbstats.c Sun Jun 16 13:35:34 2002
@@ -60,10 +60,10 @@ stats(char *dev, int msg)
err(1, "USB_DEVICESTATS");
if (!msg)
printf("Controller %s:\n", dev);
- printf("%10lu control\n", stats.requests[UE_CONTROL]);
- printf("%10lu isochronous\n", stats.requests[UE_ISOCHRONOUS]);
- printf("%10lu bulk\n", stats.requests[UE_BULK]);
- printf("%10lu interrupt\n", stats.requests[UE_INTERRUPT]);
+ printf("%10lu control\n", stats.uds_requests[UE_CONTROL]);
+ printf("%10lu isochronous\n", stats.uds_requests[UE_ISOCHRONOUS]);
+ printf("%10lu bulk\n", stats.uds_requests[UE_BULK]);
+ printf("%10lu interrupt\n", stats.uds_requests[UE_INTERRUPT]);
}
int