Lines Matching refs:device

37    	- sane_open() : open a particular scanner device, adding a handle
38 to the opened device
47 - sane_close() : close opened scanner device, freeing scanner handle
80 * The same device may be opened several time by different sessions.
195 * running on). If it is false, the device list includes all remote
199 * sane_open() call is performed. A device name may be specified
202 * @param device_list pointer where to store the device list
210 struct P5_Device *device;
228 * the device detection must be run at each call. We are handling
241 DBG (DBG_proc, "sane_get_devices: exit with no device\n");
247 device = devices;
248 while (device->next)
251 device = device->next;
262 device = devices;
267 /* add device according to local only flag */
268 if ((local_only == SANE_TRUE && device->local == SANE_TRUE)
271 /* allocate memory to add the device */
279 sane_device->name = device->name;
280 sane_device->vendor = device->model->vendor;
281 sane_device->model = device->model->product;
282 sane_device->type = device->model->type;
285 /* increment device counter */
289 /* go to next detected device */
290 device = device->next;
308 * device. The name of the device to be opened is passed in argument
309 * name. If the call completes successfully, a handle for the device
311 * string as the device requests opening the first available device
312 * (if there is such a device). Another special case is to only give
313 * the name of the backend as the device name, in this case the first
314 * available device will also be used.
315 * @param name name of the device to open
324 struct P5_Device *device = NULL;
328 /* check there is at least a device */
331 DBG (DBG_proc, "sane_open: exit, no device to open!\n");
338 "sane_open: no specific device requested, using default\n");
341 device = devices;
342 DBG (DBG_info, "sane_open: device %s used as default device\n",
343 device->name);
348 DBG (DBG_info, "sane_open: device %s requested\n", name);
349 /* walk the device list until we find a matching name */
350 device = devices;
351 while (device && strcmp (device->name, name) != 0)
353 DBG (DBG_trace, "sane_open: device %s doesn't match\n",
354 device->name);
355 device = device->next;
359 /* check whether we have found a match or reach the end of the device list */
360 if (!device)
362 DBG (DBG_info, "sane_open: no device found\n");
366 /* now we have a device, duplicate it and return it in handle */
367 DBG (DBG_info, "sane_open: device %s found\n", name);
369 /* device initialization */
370 if (device->initialized == SANE_FALSE)
375 device->fd = open_pp (device->name);
376 if (device->fd < 0)
378 DBG (DBG_error, "sane_open: failed to open '%s' device!\n",
379 device->name);
384 if (connect (device->fd) != SANE_TRUE)
387 close_pp (device->fd);
392 restore_calibration (device);
394 /* device link is OK now */
395 device->initialized = SANE_TRUE;
397 device->buffer = NULL;
398 device->gain = NULL;
399 device->offset = NULL;
410 session->dev = device;
477 * returns the option descriptor for option number n of the device
480 * options that are available for device handle h (the count includes
483 * (and at the returned address) until the device is closed.
682 * number n of the device represented by handle h. The manner in which
811 * @return SANE_STATUS_GOOD on success, SANE_STATUS_BUSY if the device is
812 * in use by another session or SANE_STATUS_WARMING_UP if the device is
828 DBG (DBG_info, "sane_start: device is already scanning\n");
832 /* check that the device has been initialized */
835 DBG (DBG_error, "sane_start: device is not initialized\n");
843 DBG (DBG_error, "sane_start: device is already scanning\n");
1079 * device for which the parameters should be obtained and a pointer
1104 * This function is used to read image data from the device
1336 * cancel the currently pending operation of the device represented by
1365 /* device hasn't finished scan, we are aborting it
1384 * This function terminates the association between the device handle
1385 * passed in argument h and the device it represents. If the device is
1425 /* close low level device */
1437 /* free device data */
1468 * function will first close all device handles that still might be
1469 * open (it is recommended to close device handles explicitly through
1532 * the backend is present. Each detected device will be added to the
1580 * to attach the backend to a device specified by the configuration file.
1584 * @param devname name of the device to try to attach to, it is
1602 * the corresponding device. Since there is no resources common to each
1610 /** @brief try to attach to a device by its name
1611 * The attach tries to open the given device and match it
1617 * @param devicename name of the device to try to attach to, it is
1623 * device structure
1624 * SANE_STATUS_UNSUPPORTED if the device if unknown by the backend
1630 struct P5_Device *device;
1640 for (device = devices; device; device = device->next)
1642 if (strcmp (device->name, devicename) == 0)
1644 DBG (DBG_info, "attach: device already attached\n");
1651 * do physical probe of the device here. In case the device is recognized,
1652 * we allocate a device struct and give it options and model.
1659 "attach: device %s is not managed by the backend\n", devicename);
1664 /* allocate device struct */
1665 device = malloc (sizeof (*device));
1666 if (device == NULL)
1671 memset (device, 0, sizeof (*device));
1672 device->model = model;
1674 /* name of the device */
1675 device->name = strdup (devicename);
1678 device->model->vendor, device->model->product, device->model->type,
1679 device->name);
1681 /* we insert new device at start of the chained list */
1684 device->next = devices;
1685 devices = device;
1688 device->initialized = SANE_FALSE;
1689 device->calibrated = SANE_FALSE;
1698 * of the model of the physical device.
1976 /** @brief physical probe of a device
1977 * This function probes for a scanning device using the given name. If the
1978 * device is managed, a model structure describing the device will be returned.
1979 * @param devicename low level device to access to probe hardware
1980 * @return NULL is the device is unsupported, or a model struct describing the
1981 * device.
1988 /* open parallel port device */
1992 DBG (DBG_error, "probe: failed to open '%s' device!\n", devicename);
2026 /* release device and parport for next uses */