• Home
  • Raw
  • Download

Lines Matching full:device

140   Ricoh2_Device *device;  in lookup_handle()  local
142 for (device = ricoh2_devices; device; device = device->next) in lookup_handle()
144 if (device == handle) in lookup_handle()
145 return device; in lookup_handle()
162 return "Unidentified device"; in get_model_by_productid()
170 Ricoh2_Device *device = NULL; in attach() local
173 for (device = ricoh2_devices; device; device = device->next) in attach()
175 if (strcmp (device->sane.name, devname) == 0) in attach()
177 device->active = SANE_TRUE; in attach()
182 device = (Ricoh2_Device *) malloc (sizeof (Ricoh2_Device)); in attach()
183 if (!device) in attach()
192 DBG (1, "attach: couldn't open device `%s': %s\n", devname, in attach()
201 "attach: couldn't get vendor and product ids of device `%s': %s\n", in attach()
208 device->sane.name = strdup (devname); in attach()
209 device->sane.vendor = "Ricoh"; in attach()
210 device->sane.model = get_model_by_productid (product); in attach()
211 device->sane.type = "flatbed scanner"; in attach()
212 device->active = SANE_TRUE; in attach()
213 device->buffer = NULL; in attach()
215 device->next = ricoh2_devices; in attach()
216 ricoh2_devices = device; in attach()
218 DBG (2, "Found device %s\n", device->sane.name); in attach()
308 Ricoh2_Device *device = NULL; in sane_get_devices() local
325 for (device = ricoh2_devices; device; device = device->next) in sane_get_devices()
326 if (device->active) in sane_get_devices()
328 sane_devices[i++] = &(device->sane); in sane_get_devices()
343 Ricoh2_Device *device; in sane_open() local
352 /* walk the linked list of scanner device until there is a match in sane_open()
353 * with the device name */ in sane_open()
354 for (device = ricoh2_devices; device; device = device->next) in sane_open()
357 device->sane.name); in sane_open()
360 || strcmp (name, device->sane.name) == 0) in sane_open()
364 *handle = device; in sane_open()
366 if (!device) in sane_open()
368 DBG (1, "sane_open: Not a Ricoh device\n"); in sane_open()
372 status = init_options (device); in sane_open()
384 Ricoh2_Device *device; in sane_get_option_descriptor() local
396 if (!(device = lookup_handle(handle))) in sane_get_option_descriptor()
399 if (device->opt[option].name) in sane_get_option_descriptor()
402 device->opt[option].name); in sane_get_option_descriptor()
405 return &(device->opt[option]); in sane_get_option_descriptor()
415 Ricoh2_Device *device; in sane_control_option() local
423 device = lookup_handle (handle); in sane_control_option()
424 CHECK_IF (device); in sane_control_option()
427 CHECK_IF (device->opt[option].type != SANE_TYPE_GROUP); in sane_control_option()
432 CHECK_IF (SANE_OPTION_IS_SETTABLE (device->opt[option].cap)); in sane_control_option()
433 CHECK_IF (device->opt[option].cap & SANE_CAP_AUTOMATIC); in sane_control_option()
441 device->opt[option].name); in sane_control_option()
442 device->val[option].w = default_resolution; in sane_control_option()
449 device->opt[option].name); in sane_control_option()
450 strcpy (device->val[option].s, default_mode); in sane_control_option()
459 CHECK_IF (SANE_OPTION_IS_SETTABLE (device->opt[option].cap)); in sane_control_option()
461 if (device->opt[option].type == SANE_TYPE_BOOL) in sane_control_option()
467 if (device->opt[option].constraint_type == SANE_CONSTRAINT_RANGE) in sane_control_option()
469 status = sanei_constrain_value (&(device->opt[option]), value, info); in sane_control_option()
480 device->opt[option].name); in sane_control_option()
481 device->val[option].w = *(SANE_Word *) value; in sane_control_option()
488 device->opt[option].name); in sane_control_option()
489 strcpy (device->val[option].s, value); in sane_control_option()
503 *(SANE_Word *) value = device->val[option].w; in sane_control_option()
505 device->opt[option].name); in sane_control_option()
508 strcpy (value, device->val[option].s); in sane_control_option()
524 update_scan_params (Ricoh2_Device *device) in update_scan_params() argument
527 if (strcmp(device->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_COLOR) == 0) in update_scan_params()
529 device->mode = SCAN_MODE_COLOR; in update_scan_params()
533 device->mode = SCAN_MODE_GRAY; in update_scan_params()
537 device->resolution = device->val[OPT_RESOLUTION].w; in update_scan_params()
544 Ricoh2_Device *device; in sane_get_parameters() local
550 device = lookup_handle (handle); in sane_get_parameters()
551 CHECK_IF (device); in sane_get_parameters()
554 update_scan_params (device); in sane_get_parameters()
557 device->mode == SCAN_MODE_COLOR ? SANE_FRAME_RGB : SANE_FRAME_GRAY; in sane_get_parameters()
565 if (device->resolution == 600) in sane_get_parameters()
572 if (device->mode == SCAN_MODE_COLOR) in sane_get_parameters()
711 Ricoh2_Device *device; in sane_start() local
719 device = lookup_handle (handle); in sane_start()
720 CHECK_IF (device); in sane_start()
722 update_scan_params (device); in sane_start()
723 device->cancelled = SANE_FALSE; in sane_start()
725 status = sanei_usb_open (device->sane.name, &(device->dn)); in sane_start()
728 DBG (1, "could not open device %s: %s\n", in sane_start()
729 device->sane.name, sane_strstatus (status)); in sane_start()
733 DBG (2, "usb device %s opened, device number is %d\n", in sane_start()
734 device->sane.name, device->dn); in sane_start()
736 status = sanei_usb_claim_interface (device->dn, 0); in sane_start()
741 sanei_usb_close (device->dn); in sane_start()
745 sanei_usb_set_endpoint (device->dn, in sane_start()
749 sanei_usb_set_endpoint (device->dn, in sane_start()
753 status = sanei_usb_reset (device->dn); in sane_start()
756 DBG (1, "could not reset device %s: %s\n", in sane_start()
757 device->sane.name, sane_strstatus (status)); in sane_start()
758 sanei_usb_close (device->dn); in sane_start()
763 status = init_scan (device->dn, device->mode, device->resolution); in sane_start()
766 sanei_usb_close (device->dn); in sane_start()
770 resolution_factor = device->resolution == 600 ? 2 : 1; in sane_start()
774 device->bytes_to_read = in sane_start()
777 * (device->mode == SCAN_MODE_COLOR ? 3 : 1); in sane_start()
779 device->buffer = in sane_start()
783 device->mode == SCAN_MODE_COLOR); in sane_start()
785 DBG (8, "<sane_start: %lu bytes to read\n", device->bytes_to_read); in sane_start()
798 Ricoh2_Device *device; in sane_read() local
806 device = lookup_handle (handle); in sane_read()
807 CHECK_IF (device); in sane_read()
815 if (device->bytes_to_read <= 0) in sane_read()
820 if (!ricoh2_buffer_get_bytes_remain (device->buffer)) in sane_read()
825 ricoh2_buffer_get_internal_buffer (device->buffer); in sane_read()
831 status = send_receive (device->dn, &transfer); in sane_read()
834 device->bytes_to_read = 0; in sane_read()
839 *length = ricoh2_buffer_get_data (device->buffer, in sane_read()
841 min(maxlen, device->bytes_to_read)); in sane_read()
843 device->bytes_to_read -= *length; in sane_read()
848 device->bytes_to_read); in sane_read()
852 ricoh2_buffer_get_bytes_remain(device->buffer)); in sane_read()
855 if (device->bytes_to_read <= 0) in sane_read()
857 ricoh2_buffer_dispose(device->buffer); in sane_read()
858 device->buffer = NULL; in sane_read()
870 Ricoh2_Device *device; in sane_set_io_mode() local
875 device = lookup_handle (handle); in sane_set_io_mode()
876 CHECK_IF (device); in sane_set_io_mode()
887 Ricoh2_Device *device; in sane_get_select_fd() local
892 device = lookup_handle (handle); in sane_get_select_fd()
893 CHECK_IF (device); in sane_get_select_fd()
901 Ricoh2_Device *device; in sane_cancel() local
908 if (!(device = lookup_handle (handle))) in sane_cancel()
911 if (device->cancelled) in sane_cancel()
914 device->cancelled = SANE_TRUE; in sane_cancel()
916 teardown_scan (device->dn); in sane_cancel()
917 if (device->buffer) in sane_cancel()
919 ricoh2_buffer_dispose (device->buffer); in sane_cancel()
920 device->buffer = NULL; in sane_cancel()
923 sanei_usb_close(device->dn); in sane_cancel()
931 Ricoh2_Device *device; in sane_close() local
938 device = lookup_handle (handle); in sane_close()
939 if (!device) in sane_close()
950 Ricoh2_Device *device, *next; in sane_exit() local
957 for (device = ricoh2_devices, next = device; device; device = next) in sane_exit()
959 next = device->next; in sane_exit()
960 free (device); in sane_exit()