Driver structures

Driver structures — Driver structures

Types and Values

struct usb_id
enum fp_driver_type

Includes

#include <fpi-core.h>

Description

Driver structures need to be defined inside each driver in order for the core library to know what function to call, and the capabilities of the driver and the devices it supports.

Functions

Types and Values

struct usb_id

struct usb_id {
	uint16_t vendor;
	uint16_t product;
	unsigned long driver_data;
};

The struct usb_id is used to declare devices supported by a particular driver. The driver_data information is used to differentiate different models of devices which only need small changes compared to the default driver behaviour to function.

For example, a device might have a different initialisation from the stock device, so the driver could do:

1
2
3
4
5
if (driver_data == MY_DIFFERENT_DEVICE_QUIRK) {
    ...
} else {
    ...
}

The default value is zero, so the driver_data needs to be a non-zero to be useful.

Members

uint16_t vendor;

the USB vendor ID

 

uint16_t product;

the USB product ID

 

unsigned long driver_data;

data to differentiate devices of different vendor and product IDs.

 

enum fp_driver_type

The type of device the driver supports.

Members

DRIVER_PRIMITIVE

primitive, non-imaging, driver

 

DRIVER_IMAGING

imaging driver