Lines Matching refs:fd

62     int fd;
69 int fd;
134 wds[0] = inotify_add_watch(context->fd, USB_FS_DIR, IN_CREATE | IN_DELETE);
141 ret = inotify_add_watch(context->fd, path, IN_CREATE | IN_DELETE);
154 context->fd = inotify_init();
155 if (context->fd < 0) {
165 close(context->fd);
189 wdd = inotify_add_watch(context->fd, DEV_DIR, IN_CREATE | IN_DELETE);
205 ret = read(context->fd, event_buf, sizeof(event_buf));
216 inotify_rm_watch(context->fd, wds[i]);
228 ret = inotify_add_watch(context->fd, path,
235 inotify_rm_watch(context->fd, wds[i]);
259 int fd, did_retry = 0, writeable = 1;
264 fd = open(dev_name, O_RDWR);
265 if (fd < 0) {
267 fd = open(dev_name, O_RDONLY);
268 D("usb_device_open open returned %d errno %d\n", fd, errno);
269 if (fd < 0 && (errno == EACCES || errno == ENOENT) && !did_retry) {
276 if (fd < 0)
279 D("[ usb open read-only %s fd = %d]\n", dev_name, fd);
282 struct usb_device* result = usb_device_new(dev_name, fd);
290 close(device->fd);
294 struct usb_device *usb_device_new(const char *dev_name, int fd)
299 D("usb_device_new %s fd: %d\n", dev_name, fd);
301 if (lseek(fd, 0, SEEK_SET) != 0)
303 length = read(fd, device->desc, sizeof(device->desc));
309 device->fd = fd;
316 close(fd);
326 int fd = open(device->dev_name, O_RDWR);
327 if (fd >= 0) {
328 close(device->fd);
329 device->fd = fd;
341 return device->fd;
481 return ioctl(device->fd, USBDEVFS_CLAIMINTERFACE, &interface);
486 return ioctl(device->fd, USBDEVFS_RELEASEINTERFACE, &interface);
497 return ioctl(device->fd, USBDEVFS_IOCTL, &ctl);
523 return ioctl(device->fd, USBDEVFS_CONTROL, &ctrl);
543 return ioctl(device->fd, USBDEVFS_BULK, &ctrl);
599 res = ioctl(req->dev->fd, USBDEVFS_SUBMITURB, urb);
612 int res = ioctl(dev->fd, USBDEVFS_REAPURB, &urb);
634 return ioctl(req->dev->fd, USBDEVFS_DISCARDURB, &urb);