Lines Matching defs:device

121 /** create mock device
122 * create a mock device entry
123 * @param device device pointer to fill with mock data
127 create_mock_device (char *devname, device_list_type * device)
129 memset (device, 0, sizeof (device_list_type));
130 device->devname = strdup (devname);
131 device->vendor = 0xdead;
132 device->product = 0xbeef;
134 device->method = sanei_usb_method_libusb;
137 device->method = sanei_usb_method_usbcalls;
140 device->method == sanei_usb_method_scanner_driver;
147 * the startiing situation is that the mock device has never
148 * put into device list.
163 * to store device */
174 printf ("ERROR: store past end of device list!\n");
177 /* walk device list to be sure mock device hasn't been stored */
183 ("ERROR: device stored although there were no place for it!\n");
195 /* store mock device */
207 printf ("ERROR: mock device not stored !\n");
225 printf ("ERROR: mock device still present !\n");
243 printf ("ERROR: mock device slot not reusable !\n");
247 /* store mock device again, slot in devices should be reused
261 printf ("ERROR: mock device not stored !\n");
265 /* last rescan to wipe mock device out */
312 * @param dn array to store opened device number
330 /* open device */
346 printf ("ERROR: couldn't open device %s!\n",
355 /* try to reopen an opened device when there is one */
371 /** test opening invalid device
372 * try to open an non existing device
381 status = sanei_usb_open ("invalid device", &dn);
384 printf ("ERROR: unexpected success opening invalid device!\n");
392 * @param dn array of opened device number
405 /* close device */
418 * @param dn array of opened device number
436 printf ("ERROR: couldn't claim interface 0 on device %d!\n", dn[i]);
451 /* try to claim invalid device entry */
455 printf ("ERROR: could claim interface 0 on invalid device!\n");
459 /* create a mock device and make it missing by rescanning */
464 /* try to claim interface on missing device */
468 printf ("ERROR: could claim interface 0 on invalid device!\n");
472 /* remove mock device */
483 * @param dn array of opened device number
502 printf ("ERROR: couldn't release interface 0 on device %d!\n",
518 /* try to release invalid device entry */
522 printf ("ERROR: could release interface 0 on invalid device!\n");
526 /* create a mock device and make it missing by rescanning */
531 /* try to claim interface on missing device */
535 printf ("ERROR: could release interface 0 on invalid device!\n");
539 /* remove mock device */
566 /* get device id */
571 printf ("ERROR: couldn't query device %s!\n",
577 printf ("ERROR: incomplete device id for %s!\n",
585 /* add mock device */
599 /* remove mock device */
636 /* get device id */
640 printf ("ERROR: couldn't query device %d!\n", i);
645 printf ("ERROR: incomplete device id for %d!\n", i);
652 /* add mock device */
667 /* remove mock device */
706 /** test device scanning
742 * expected device name during attach
765 /** test attaching usb device
766 * create a mock device and attach to it, checking
775 /* add mock device and try to attach to it */
785 printf ("ERROR: couldn't attach to 'usb xdead 0xbeef' device!\n");
795 printf ("ERROR: couldn't attach to 'mock' device!\n");
799 /* attach to bogus device */
806 printf ("ERROR: shouldn't be attached to bogus device!\n");
816 printf ("ERROR: shouldn't be attached to bogus device!\n");
820 /* remove mock device */
868 /* test corner cases with mock device */
885 /* try to open an inexisting device */
915 /* check there is no opened device */
924 /* test attach matching device with a mock */