1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-25 04:43:33 +00:00

Allow pppoa to also compile on older FreeBSDs before the usb.h

structure change.
This commit is contained in:
Josef Karthauser 2002-04-30 08:50:25 +00:00
parent 33b28557ec
commit afd972be29
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=58358

View File

@ -1,87 +1,113 @@
--- src/pusb-bsd.c.orig Wed Nov 7 19:45:26 2001
+++ src/pusb-bsd.c Thu Apr 25 21:15:55 2002
@@ -100,7 +100,7 @@
+++ src/pusb-bsd.c Tue Apr 30 09:50:20 2002
@@ -100,7 +100,11 @@
{
struct usb_device_info di;
- di.addr = device;
+#if (__FreeBSD_version > 500000 && __FreeBSD_version < 500031) || (__FreeBSD_version < 450001)
di.addr = device;
+#else
+ di.udi_addr = device;
+#endif
if(ioctl(cfd, USB_DEVICEINFO, &di) < 0)
continue;
@@ -116,15 +116,15 @@
@@ -116,15 +120,25 @@
}
#endif
- if(di.vendorNo == vendorID && di.productNo == productID)
+ if(di.udi_vendorNo == vendorID && di.udi_productNo == productID)
+#if (__FreeBSD_version > 500000 && __FreeBSD_version < 500031) || (__FreeBSD_version < 450001)
if(di.vendorNo == vendorID && di.productNo == productID)
{
- if(strncmp(di.devnames[0], "ugen", 4) != 0)
if(strncmp(di.devnames[0], "ugen", 4) != 0)
+#else
+ if(di.udi_vendorNo == vendorID && di.udi_productNo == productID)
+ {
+ if(strncmp(di.udi_devnames[0], "ugen", 4) != 0)
+#endif
{
/* Has a real driver, don't mess with it */
continue;
}
- sprintf(prefix, "/dev/%s", di.devnames[0]);
+#if (__FreeBSD_version > 500000 && __FreeBSD_version < 500031) || (__FreeBSD_version < 450001)
sprintf(prefix, "/dev/%s", di.devnames[0]);
+#else
+ sprintf(prefix, "/dev/%s", di.udi_devnames[0]);
+#endif
#if defined(__FreeBSD__)
sprintf(buf, "%s", prefix);
#else
@@ -199,14 +199,14 @@
@@ -199,6 +213,7 @@
{
struct usb_ctl_request req;
- req.request.bmRequestType = request_type;
- req.request.bRequest = request;
- USETW(req.request.wValue, value);
- USETW(req.request.wIndex, index);
- USETW(req.request.wLength, size);
+#if (__FreeBSD_version > 500000 && __FreeBSD_version < 500031) || (__FreeBSD_version < 450001)
req.request.bmRequestType = request_type;
req.request.bRequest = request;
USETW(req.request.wValue, value);
@@ -206,7 +221,16 @@
USETW(req.request.wLength, size);
req.data = buf;
- req.flags = USBD_SHORT_XFER_OK;
+#else
+ req.ucr_request.bmRequestType = request_type;
+ req.ucr_request.bRequest = request;
+ USETW(req.ucr_request.wValue, value);
+ USETW(req.ucr_request.wIndex, index);
+ USETW(req.ucr_request.wLength, size);
- req.data = buf;
- req.flags = USBD_SHORT_XFER_OK;
+
+ req.ucr_data = buf;
+ req.ucr_flags = USBD_SHORT_XFER_OK;
+#endif
/* !!! If your kernel is built with DIAGNOSTIC (which it is by
!!! default under some versions of NetBSD) this ioctl will fail.
@@ -227,7 +227,7 @@
@@ -227,7 +251,11 @@
if(ioctl(dev->fd, USB_DO_REQUEST, &req) < 0)
return -1;
else
- return req.actlen;
+#if (__FreeBSD_version > 500000 && __FreeBSD_version < 500031) || (__FreeBSD_version < 450001)
return req.actlen;
+#else
+ return req.ucr_actlen;
+#endif
}
int pusb_set_configuration(pusb_device_t dev, int config)
@@ -249,8 +249,8 @@
@@ -249,8 +277,13 @@
struct usb_alt_interface intf;
int config;
- intf.interface_index = interface;
- intf.alt_no = alternate;
+#if (__FreeBSD_version > 500000 && __FreeBSD_version < 500031) || (__FreeBSD_version < 450001)
intf.interface_index = interface;
intf.alt_no = alternate;
+#else
+ intf.uai_interface_index = interface;
+ intf.uai_alt_no = alternate;
+#endif
if(ioctl(dev->fd, USB_SET_ALTINTERFACE, &intf) < 0)
{
@@ -278,12 +278,12 @@
@@ -278,12 +311,20 @@
{
struct usb_alt_interface intf;
- intf.interface_index = interface;
+#if (__FreeBSD_version > 500000 && __FreeBSD_version < 500031) || (__FreeBSD_version < 450001)
intf.interface_index = interface;
+#else
+ intf.uai_interface_index = interface;
+#endif
if(ioctl(dev->fd, USB_GET_ALTINTERFACE, &intf) < 0)
return -1;
- return intf.alt_no;
+#if (__FreeBSD_version > 500000 && __FreeBSD_version < 500031) || (__FreeBSD_version < 450001)
return intf.alt_no;
+#else
+ return intf.uai_alt_no;
+#endif
}
pusb_endpoint_t pusb_endpoint_open(pusb_device_t dev, int epnum, int flags)