libwacom Wacom model identification library

Typedefs | Enumerations | Functions
libwacom context

Functions to create and manage libwacom context. More...

## Typedefs
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 , WERROR_BUG_CALLER }
| Possible error codes. More...

## Functions
WacomError * | libwacom_error_new (void)
| Allocate a new structure for error reporting. More...
void | libwacom_error_free (WacomError **error)
| Free the error and associated memory. More...
enum WacomErrorCode | libwacom_error_get_code (WacomError *error)
const char * | libwacom_error_get_message (WacomError *error)
WacomDeviceDatabase * | libwacom_database_new (void)
| Loads the Tablet and Stylus databases, to be used in libwacom_new_*() functions. More...
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. More...
void | libwacom_database_destroy (WacomDeviceDatabase *db)
| Free all memory used by the database. More...

## Detailed Description

Functions to create and manage libwacom context.

## Typedef Documentation

## ◆ WacomDeviceDatabase

typedef struct _WacomDeviceDatabase WacomDeviceDatabase

## ◆ WacomError

typedef struct _WacomError WacomError

## Enumeration Type Documentation

## ◆ WacomErrorCode

enum WacomErrorCode

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.
WERROR_BUG_CALLER | A bug in the caller.

## Function Documentation

## ◆ libwacom_database_destroy()

void libwacom_database_destroy | ( | WacomDeviceDatabase * | db | ) |

Free all memory used by the database.

Parameters

  db | A Tablet and Stylus database.

## ◆ libwacom_database_new()

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.

## ◆ libwacom_database_new_for_path()

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.

## ◆ libwacom_error_free()

void libwacom_error_free | ( | WacomError ** | error | ) |

Free the error and associated memory.

Resets error to NULL.

Parameters

  error | A reference to a error struct.

See also
  libwacom_error_new

## ◆ libwacom_error_get_code()

enum WacomErrorCode libwacom_error_get_code | ( | WacomError * | error | ) |

Returns
  The code for this error.

## ◆ libwacom_error_get_message()

const char * libwacom_error_get_message | ( | WacomError * | error | ) |

Returns
  A human-readable message for this error

## ◆ libwacom_error_new()

WacomError * libwacom_error_new | ( | void |  | ) |

Allocate a new structure for error reporting.

Returns
  A newly allocated error structure or NULL if the allocation failed.