libwacom
Wacom model identification library
Defines | Typedefs | Enumerations | Functions
/home/hadess/Projects/jhbuild/libwacom/libwacom/libwacom.h File Reference

Go to the source code of this file.

Defines

#define _LIBWACOM_H_
#define WACOM_STYLUS_FALLBACK_ID   0xfffff
#define WACOM_ERASER_FALLBACK_ID   0xffffe

Typedefs

typedef struct _WacomDevice WacomDevice
typedef struct _WacomStylus WacomStylus
typedef struct _WacomError WacomError
typedef struct _WacomDeviceDatabase WacomDeviceDatabase

Enumerations

enum  WacomErrorCode {
  WERROR_NONE, WERROR_BAD_ALLOC, WERROR_INVALID_PATH, WERROR_INVALID_DB,
  WERROR_BAD_ACCESS, WERROR_UNKNOWN_MODEL
}
 Possible error codes. More...
enum  WacomBusType { WBUSTYPE_UNKNOWN, WBUSTYPE_USB, WBUSTYPE_SERIAL, WBUSTYPE_BLUETOOTH }
 Bus types for tablets. More...
enum  WacomClass {
  WCLASS_UNKNOWN, WCLASS_INTUOS3, WCLASS_INTUOS4, WCLASS_CINTIQ,
  WCLASS_BAMBOO, WCLASS_GRAPHIRE, WCLASS_ISDV4
}
 Classes of devices. More...
enum  WacomStylusType {
  WSTYLUS_UNKNOWN, WSTYLUS_GENERAL, WSTYLUS_INKING, WSTYLUS_AIRBRUSH,
  WSTYLUS_CLASSIC, WSTYLUS_MARKER, WSTYLUS_STROKE
}
 Class of stylus. More...

Functions

WacomErrorlibwacom_error_new (void)
 Allocate a new structure for error reporting.
void libwacom_error_free (WacomError **error)
 Free the error and associated memory.
enum WacomErrorCode libwacom_error_get_code (WacomError *error)
const char * libwacom_error_get_message (WacomError *error)
WacomDeviceDatabaselibwacom_database_new (void)
 Loads the Tablet and Stylus databases, to be used in libwacom_new_*() functions.
WacomDeviceDatabaselibwacom_database_new_for_path (const char *datadir)
 Loads the Tablet and Stylus databases, to be used in libwacom_new_*() functions, from the prefix path passes.
void libwacom_database_destroy (WacomDeviceDatabase *db)
 Free all memory used by the database.
WacomDevicelibwacom_new_from_path (WacomDeviceDatabase *db, const char *path, int fallback, WacomError *error)
 Create a new device reference from the given device path.
WacomDevicelibwacom_new_from_usbid (WacomDeviceDatabase *db, int vendor_id, int product_id, WacomError *error)
 Create a new device reference from the given vendor/product IDs.
WacomDevicelibwacom_new_from_name (WacomDeviceDatabase *db, const char *name, WacomError *error)
 Create a new device reference from the given name.
void libwacom_destroy (WacomDevice *device)
 Remove the device and free all memory and references to it.
WacomClass libwacom_get_class (WacomDevice *device)
const char * libwacom_get_vendor (WacomDevice *device)
int libwacom_get_vendor_id (WacomDevice *device)
const char * libwacom_get_product (WacomDevice *device)
const char * libwacom_get_match (WacomDevice *device)
int libwacom_get_product_id (WacomDevice *device)
int libwacom_get_width (WacomDevice *device)
 Retrieve the width of the device.
int libwacom_get_height (WacomDevice *device)
 Retrieve the height of the device.
int libwacom_has_stylus (WacomDevice *device)
int libwacom_has_touch (WacomDevice *device)
int libwacom_get_num_buttons (WacomDevice *device)
int * libwacom_get_supported_styli (WacomDevice *device, int *num_styli)
int libwacom_has_ring (WacomDevice *device)
int libwacom_has_ring2 (WacomDevice *device)
int libwacom_has_vstrip (WacomDevice *device)
int libwacom_has_hstrip (WacomDevice *device)
int libwacom_is_builtin (WacomDevice *device)
int libwacom_is_reversible (WacomDevice *device)
WacomBusType libwacom_get_bustype (WacomDevice *device)
const WacomStyluslibwacom_stylus_get_for_id (WacomDeviceDatabase *db, int id)
 Get the WacomStylus for the given tool ID.
int libwacom_stylus_get_id (const WacomStylus *stylus)
const char * libwacom_stylus_get_name (const WacomStylus *stylus)
int libwacom_stylus_get_num_buttons (const WacomStylus *stylus)
int libwacom_stylus_has_eraser (const WacomStylus *stylus)
int libwacom_stylus_is_eraser (const WacomStylus *stylus)
WacomStylusType libwacom_stylus_get_type (const WacomStylus *stylus)

Detailed Description


Define Documentation

#define _LIBWACOM_H_
#define WACOM_ERASER_FALLBACK_ID   0xffffe
#define WACOM_STYLUS_FALLBACK_ID   0xfffff

Typedef Documentation

typedef struct _WacomDevice WacomDevice
typedef struct _WacomDeviceDatabase WacomDeviceDatabase
typedef struct _WacomError WacomError
typedef struct _WacomStylus WacomStylus

Enumeration Type Documentation

Bus types for tablets.

Enumerator:
WBUSTYPE_UNKNOWN 

Unknown/unsupported bus type.

WBUSTYPE_USB 

USB tablet.

WBUSTYPE_SERIAL 

Serial tablet.

WBUSTYPE_BLUETOOTH 

Bluetooth tablet.

enum WacomClass

Classes of devices.

Enumerator:
WCLASS_UNKNOWN 

Unknown/unsupported device class.

WCLASS_INTUOS3 

Any Intuos3 series.

WCLASS_INTUOS4 

Any Intuos4 series.

WCLASS_CINTIQ 

Any Cintiq device.

WCLASS_BAMBOO 

Any Bamboo device.

WCLASS_GRAPHIRE 

Any Graphire device.

WCLASS_ISDV4 

Any serial ISDV4 device.

Possible error codes.

Enumerator:
WERROR_NONE 

No error has occured.

WERROR_BAD_ALLOC 

Allocation error.

WERROR_INVALID_PATH 

A path specified is invalid.

WERROR_INVALID_DB 

The passed DB is invalid.

WERROR_BAD_ACCESS 

Invalid permissions to access the path.

WERROR_UNKNOWN_MODEL 

Unsupported/unknown device.

Class of stylus.

Enumerator:
WSTYLUS_UNKNOWN 
WSTYLUS_GENERAL 
WSTYLUS_INKING 
WSTYLUS_AIRBRUSH 
WSTYLUS_CLASSIC 
WSTYLUS_MARKER 
WSTYLUS_STROKE 

Function Documentation

void libwacom_database_destroy ( WacomDeviceDatabase db)

Free all memory used by the database.

Parameters:
dbA Tablet and Stylus database.
WacomDeviceDatabase* libwacom_database_new ( void  )

Loads the Tablet and Stylus databases, to be used in libwacom_new_*() functions.

Returns:
A new database or NULL on error.
WacomDeviceDatabase* libwacom_database_new_for_path ( const char *  datadir)

Loads the Tablet and Stylus databases, to be used in libwacom_new_*() functions, from the prefix path passes.

This is only useful for diagnostics applications.

Returns:
A new database or NULL on error.
void libwacom_destroy ( WacomDevice device)

Remove the device and free all memory and references to it.

Parameters:
deviceThe device to delete
void libwacom_error_free ( WacomError **  error)

Free the error and associated memory.

Resets error to NULL.

Parameters:
errorA reference to a error struct.
See also:
libwacom_error_new
enum WacomErrorCode libwacom_error_get_code ( WacomError error)
Returns:
The code for this error.
const char* libwacom_error_get_message ( WacomError error)
Returns:
A human-readable message for this error
WacomError* libwacom_error_new ( void  )

Allocate a new structure for error reporting.

Returns:
A newly allocated error structure or NULL if the allocation failed.
WacomBusType libwacom_get_bustype ( WacomDevice device)
Parameters:
deviceThe tablet to query
Returns:
The bustype of this device.
WacomClass libwacom_get_class ( WacomDevice device)
Parameters:
deviceThe tablet to query
Returns:
The class of the device
int libwacom_get_height ( WacomDevice device)

Retrieve the height of the device.

This is the height of the usable area as advertised, not the total size of the physical tablet. For e.g. an Intuos4 6x9 this will return 6.

Parameters:
deviceThe tablet to query
Returns:
The width of this device in inches
const char* libwacom_get_match ( WacomDevice device)
Parameters:
deviceThe tablet to query
Returns:
The first match for the device in question
int libwacom_get_num_buttons ( WacomDevice device)
Parameters:
deviceThe tablet to query
Returns:
The number of buttons on the tablet
const char* libwacom_get_product ( WacomDevice device)
Parameters:
deviceThe tablet to query
Returns:
The human-readable product for this device
int libwacom_get_product_id ( WacomDevice device)
Parameters:
deviceThe tablet to query
Returns:
The numeric product ID for this device
int* libwacom_get_supported_styli ( WacomDevice device,
int *  num_styli 
)
Parameters:
deviceThe tablet to query
num_styliReturn location for the number of listed styli
Returns:
an array of Styli IDs supported by the device
const char* libwacom_get_vendor ( WacomDevice device)
Parameters:
deviceThe tablet to query
Returns:
The human-readable vendor for this device
int libwacom_get_vendor_id ( WacomDevice device)
Parameters:
deviceThe tablet to query
Returns:
The numeric vendor ID for this device
int libwacom_get_width ( WacomDevice device)

Retrieve the width of the device.

This is the width of the usable area as advertised, not the total size of the physical tablet. For e.g. an Intuos4 6x9 this will return 9.

Parameters:
deviceThe tablet to query
Returns:
The width of this device in inches
int libwacom_has_hstrip ( WacomDevice device)
Parameters:
deviceThe tablet to query
Returns:
non-zero if the device has a horizontal touch strip or zero otherwise
int libwacom_has_ring ( WacomDevice device)
Parameters:
deviceThe tablet to query
Returns:
non-zero if the device has a touch ring or zero otherwise
int libwacom_has_ring2 ( WacomDevice device)
Parameters:
deviceThe tablet to query
Returns:
non-zero if the device has a second touch ring or zero otherwise
int libwacom_has_stylus ( WacomDevice device)
Parameters:
deviceThe tablet to query
Returns:
non-zero if the device supports styli or zero otherwise
int libwacom_has_touch ( WacomDevice device)
Parameters:
deviceThe tablet to query
Returns:
non-zero if the device supports touch or zero otherwise
int libwacom_has_vstrip ( WacomDevice device)
Parameters:
deviceThe tablet to query
Returns:
non-zero if the device has a vertical touch strip or zero otherwise
int libwacom_is_builtin ( WacomDevice device)
Parameters:
deviceThe tablet to query
Returns:
non-zero if the device is built-in or zero if the device is an external tablet
int libwacom_is_reversible ( WacomDevice device)
Parameters:
deviceThe tablet to query
Returns:
non-zero if the device can be used left-handed (rotated 180 degrees)
WacomDevice* libwacom_new_from_name ( WacomDeviceDatabase db,
const char *  name,
WacomError error 
)

Create a new device reference from the given name.

In case of error, NULL is returned and the error is set to the appropriate value.

Parameters:
dbA device database
nameThe name identifying the device
errorIf not NULL, set to the error if any occurs
Returns:
A new reference to this device or NULL on error.
WacomDevice* libwacom_new_from_path ( WacomDeviceDatabase db,
const char *  path,
int  fallback,
WacomError error 
)

Create a new device reference from the given device path.

In case of error, NULL is returned and the error is set to the appropriate value.

Parameters:
dbA device database
pathA device path in the form of e.g. /dev/input/event0
fallbackWhether we should create a generic if model is unknown
errorIf not NULL, set to the error if any occurs
Returns:
A new reference to this device or NULL on errror.
WacomDevice* libwacom_new_from_usbid ( WacomDeviceDatabase db,
int  vendor_id,
int  product_id,
WacomError error 
)

Create a new device reference from the given vendor/product IDs.

In case of error, NULL is returned and the error is set to the appropriate value.

Parameters:
dbA device database
vendor_idThe vendor ID of the device
product_idThe product ID of the device
errorIf not NULL, set to the error if any occurs
Returns:
A new reference to this device or NULL on errror.
const WacomStylus* libwacom_stylus_get_for_id ( WacomDeviceDatabase db,
int  id 
)

Get the WacomStylus for the given tool ID.

Parameters:
dbA Tablet and Stylus database.
idThe Tool ID for this stylus
Returns:
A WacomStylus representing the stylus. Do not free.
int libwacom_stylus_get_id ( const WacomStylus stylus)
Parameters:
stylusThe stylus to query
Returns:
the ID of the tool
const char* libwacom_stylus_get_name ( const WacomStylus stylus)
Parameters:
stylusThe stylus to query
Returns:
The name of the stylus
int libwacom_stylus_get_num_buttons ( const WacomStylus stylus)
Parameters:
stylusThe stylus to query
Returns:
The number of buttons on the stylus
WacomStylusType libwacom_stylus_get_type ( const WacomStylus stylus)
Parameters:
stylusThe stylus to query
Returns:
The type of stylus
int libwacom_stylus_has_eraser ( const WacomStylus stylus)
Parameters:
stylusThe stylus to query
Returns:
Whether the stylus has an eraser
int libwacom_stylus_is_eraser ( const WacomStylus stylus)
Parameters:
stylusThe stylus to query
Returns:
Whether the stylus is actually an eraser
 All Files Functions Typedefs Enumerations Enumerator Defines