Changeset 409 for trunk/src/ifd/sys-bsd.c
- Timestamp:
- 10/18/03 21:09:43 (9 years ago)
- File:
-
- 1 edited
-
trunk/src/ifd/sys-bsd.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ifd/sys-bsd.c
r398 r409 54 54 } 55 55 56 const char *57 ifd_sysdep_channel_to_name(unsigned int num)58 {59 static char namebuf[256];60 61 switch (num >> 24) {62 case 0:63 sprintf(namebuf, "/dev/ttyS%u", num);64 break;65 case 1:66 #ifdef __FreeBSD__67 sprintf(namebuf, "/dev/ugen%d", num);68 #else69 sprintf(namebuf, "/dev/ugen%d.00", num);70 #endif71 break;72 default:73 ct_error("Unknown device channel 0x%x\n", num);74 return NULL;75 }76 77 return namebuf;78 }79 80 56 /* 81 57 * USB control command 82 58 */ 83 59 int 84 ifd_sysdep_usb_control(i nt fd,60 ifd_sysdep_usb_control(ifd_device_t *dev, 85 61 unsigned int requesttype, 86 62 unsigned int request, … … 105 81 106 82 val = timeout; 107 rc = ioctl( fd, USB_SET_TIMEOUT, &val);83 rc = ioctl(dev->fd, USB_SET_TIMEOUT, &val); 108 84 if (rc < 0) { 109 85 ct_error("usb_set_timeout failed: %m"); … … 111 87 } 112 88 113 if ((rc = ioctl( fd, USB_DO_REQUEST, &ctrl)) < 0) {89 if ((rc = ioctl(dev->fd, USB_DO_REQUEST, &ctrl)) < 0) { 114 90 ct_error("usb_control failed: %m"); 115 91 return IFD_ERROR_COMM_ERROR; … … 144 120 145 121 int 146 ifd_sysdep_usb_begin_capture(i nt fd,122 ifd_sysdep_usb_begin_capture(ifd_device_t *dev, 147 123 int type, int endpoint, size_t maxpacket, 148 124 ifd_usb_capture_t **capret) … … 155 131 /* Assume the interface # is 0 */ 156 132 cap->interface = 0; 157 rc = ioctl( fd, USBDEVFS_CLAIMINTERFACE, &cap->interface);133 rc = ioctl(dev->fd, USBDEVFS_CLAIMINTERFACE, &cap->interface); 158 134 if (rc < 0) { 159 135 ct_error("usb_claiminterface failed: %m"); … … 166 142 cap->maxpacket = maxpacket; 167 143 168 if (usb_submit_urb( fd, cap) < 0) {144 if (usb_submit_urb(dev->fd, cap) < 0) { 169 145 ct_error("usb_submiturb failed: %m"); 170 ifd_sysdep_usb_end_capture( fd, cap);146 ifd_sysdep_usb_end_capture(dev, cap); 171 147 return IFD_ERROR_COMM_ERROR; 172 148 } … … 177 153 178 154 int 179 ifd_sysdep_usb_capture(i nt fd,155 ifd_sysdep_usb_capture(ifd_device_t *dev, 180 156 ifd_usb_capture_t *cap, 181 157 void *buffer, size_t len, … … 198 174 return IFD_ERROR_TIMEOUT; 199 175 200 pfd.fd = fd;176 pfd.fd = dev->fd; 201 177 pfd.events = POLLOUT; 202 178 if (poll(&pfd, 1, wait) != 1) … … 204 180 205 181 purb = NULL; 206 rc = ioctl( fd, USBDEVFS_REAPURBNDELAY, &purb);182 rc = ioctl(dev->fd, USBDEVFS_REAPURBNDELAY, &purb); 207 183 if (rc < 0) { 208 184 if (errno == EAGAIN) … … 235 211 236 212 int 237 ifd_sysdep_usb_end_capture(i nt fd, ifd_usb_capture_t *cap)213 ifd_sysdep_usb_end_capture(ifd_device_t *dev, ifd_usb_capture_t *cap) 238 214 { 239 215 int rc = 0; 240 216 241 if (ioctl( fd, USBDEVFS_DISCARDURB, &cap->urb) < 0 && errno != EINVAL) {217 if (ioctl(dev->fd, USBDEVFS_DISCARDURB, &cap->urb) < 0 && errno != EINVAL) { 242 218 ct_error("usb_discardurb failed: %m"); 243 219 rc = IFD_ERROR_COMM_ERROR; … … 248 224 * clobbering random memory. 249 225 */ 250 (void) ioctl( fd, USBDEVFS_REAPURBNDELAY, &cap->urb);251 if (ioctl( fd, USBDEVFS_RELEASEINTERFACE, &cap->interface) < 0) {226 (void) ioctl(dev->fd, USBDEVFS_REAPURBNDELAY, &cap->urb); 227 if (ioctl(dev->fd, USBDEVFS_RELEASEINTERFACE, &cap->interface) < 0) { 252 228 ct_error("usb_releaseinterface failed: %m"); 253 229 rc = IFD_ERROR_COMM_ERROR; … … 259 235 /* 260 236 * Scan all usb devices to see if there is one we support 261 * This function is called at start-up because we can't be262 * sure the hotplug system notifies us of devices that were263 * attached at startup time already.264 237 */ 265 238 int 266 239 ifd_scan_usb(void) 267 240 { 268 /* do some cold plugging here */269 270 241 return 0; 271 242 }
Note: See TracChangeset
for help on using the changeset viewer.
