From 75dfde27462b4d6d4b237cf07eead4a5a60948c7 Mon Sep 17 00:00:00 2001 From: mpi Date: Thu, 19 Jul 2018 12:35:14 +0000 Subject: [PATCH] Reuse implicit padding to export the port number of a USB device in USB_DEVICEINFO. devel/libusb1 requires this piece of information. ok jcs@, mikeb@, jasper@, sthen@ --- sys/dev/usb/usb.h | 3 ++- sys/dev/usb/usb_subr.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/usb/usb.h b/sys/dev/usb/usb.h index 619bac8cb01..413e06794e3 100644 --- a/sys/dev/usb/usb.h +++ b/sys/dev/usb/usb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: usb.h,v 1.60 2018/07/10 09:17:03 mpi Exp $ */ +/* $OpenBSD: usb.h,v 1.61 2018/07/19 12:35:14 mpi Exp $ */ /* $NetBSD: usb.h,v 1.69 2002/09/22 23:20:50 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb.h,v 1.14 1999/11/17 22:33:46 n_hibma Exp $ */ @@ -737,6 +737,7 @@ struct usb_device_info { #define USB_SPEED_FULL 2 #define USB_SPEED_HIGH 3 #define USB_SPEED_SUPER 4 + u_int8_t udi_port; int udi_power; /* power consumption in mA, 0 if selfpowered */ int udi_nports; char udi_devnames[USB_MAX_DEVNAMES][USB_MAX_DEVNAMELEN]; diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index 6fc14ed93a7..aef7519a61e 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_subr.c,v 1.137 2018/07/10 09:17:03 mpi Exp $ */ +/* $OpenBSD: usb_subr.c,v 1.138 2018/07/19 12:35:14 mpi Exp $ */ /* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -1321,6 +1321,7 @@ usbd_fill_deviceinfo(struct usbd_device *dev, struct usb_device_info *di) di->udi_config = dev->config; di->udi_power = dev->self_powered ? 0 : dev->power; di->udi_speed = dev->speed; + di->udi_port = dev->powersrc ? dev->powersrc->portno : 0; if (dev->subdevs != NULL) { for (i = 0; dev->subdevs[i] && i < USB_MAX_DEVNAMES; i++) { -- 2.20.1