openbsd-ports/graphics/s10sh/patches/patch-libusb-0_1_3b_freebsd_c

65 lines
1.9 KiB
Plaintext

$OpenBSD: patch-libusb-0_1_3b_freebsd_c,v 1.1.1.1 2001/05/08 22:19:48 markus Exp $
--- libusb-0.1.3b/freebsd.c.orig Tue Oct 10 00:08:22 2000
+++ libusb-0.1.3b/freebsd.c Tue May 8 08:47:40 2001
@@ -41,16 +41,18 @@ int usb_os_open(usb_dev_handle *dev)
{
int i;
struct freebsd_usb_dev_handle_info *info;
+ char ctlpath[PATH_MAX];
info = malloc(sizeof(*info));
if (!info)
USB_ERROR(-ENOMEM);
dev->impl_info = info;
- dev->fd = open(dev->device->filename, O_RDWR);
+ snprintf(ctlpath, PATH_MAX, "%s.00", dev->device->filename);
+ dev->fd = open(ctlpath, O_RDWR);
if (dev->fd < 0)
{
- dev->fd = open(dev->device->filename, O_RDONLY);
+ dev->fd = open(ctlpath, O_RDONLY);
if (dev->fd < 0)
{
free(info);
@@ -152,7 +154,7 @@ static int ensure_ep_open(usb_dev_handle
if(info->ep_fd[ep] < 0)
{
- sprintf(buf, "%s.%d", dev->device->filename, ep);
+ sprintf(buf, "%s.%02d", dev->device->filename, ep);
fd = open(buf, O_RDONLY);
if(fd < 0)
USB_ERROR_STR(fd, "can't open %s for bulk read: %s\n",
@@ -234,10 +236,12 @@ int usb_control_msg(usb_dev_handle *dev,
req.data = bytes;
req.flags = 0;
+#if 0
ret = ioctl(dev->fd, USB_SET_TIMEOUT, &timeout);
if (ret < 0)
USB_ERROR_STR(ret, "error setting timeout: %s",
strerror(errno));
+#endif
ret = ioctl(dev->fd, USB_DO_REQUEST, &req);
if (ret < 0)
@@ -285,7 +289,7 @@ int usb_find_devices_on_bus(struct usb_b
/* Open its control endpoint */
- sprintf(buf, "/dev/%s", di.devnames[0]);
+ sprintf(buf, "/dev/%s.00", di.devnames[0]);
dfd = open(buf, O_RDONLY);
if(dfd < 0)
{
@@ -302,7 +306,7 @@ int usb_find_devices_on_bus(struct usb_b
dev->bus = bus;
- strcpy(dev->filename, buf);
+ sprintf(dev->filename, "/dev/%s", di.devnames[0]);
if(ioctl(dfd, USB_GET_DEVICE_DESC, &dev->descriptor) < 0)
USB_ERROR_STR(-errno, "couldn't get device descriptor for %s: %s",