Loading...
Searching...
No Matches
drv_admin.h File Reference
Internal API

Routines for dynamic drivers. More...

`#include "driver.h"`

Go to the source code of this file.

## Typedefs

typedef struct driver *(* | drv_guest_func) (struct driver *, void *)
| Argument to for_each_driver().
typedef struct driver *(* | plugin_guest_func) (const char *, drv_guest_func, void *)
| Argument to for_each_plugin.

## Functions

int | hw_choose_driver (const char *name)
| Search for driver with given name, update global drv with driver data if found.
void | hw_print_drivers (FILE *)
| Prints all drivers known to the system to the file given as argument.
struct driver * | for_each_driver (drv_guest_func func, void *arg, const char *pluginpath)
| Apply func to all existing drivers.
void | for_each_plugin (plugin_guest_func plugin_guest, void *arg, const char *pluginpath)
| Apply func to all plugins (i.

## Detailed Description

Routines for dynamic drivers.

Author
  Alec Leamas

License:\n GPL2 or later

Date
  August 2014

Functions in this file provides primitives to iterate over the dynamic drivers + a single function to install such a driver.

Drivers are loaded from a path defined by (falling priority):

- The "lircd:pluginpath" option.
- The LIRC_PLUGIN_PATH environment variable.
- The hardcoded PLUGINDIR constant.

Definition in file drv_admin.h.

## Typedef Documentation

## drv_guest_func

typedef struct driver *(* drv_guest_func) (struct driver *, void *)

Argument to for_each_driver().

Called with the loaded struct driver* data and the argument given to for_each_driver(). Returns NULL if iteration should continue, else a struct hardware* pointer.

Definition at line 1 of file drv_admin.h.

## plugin_guest_func

typedef struct driver *(* plugin_guest_func) (const char *, drv_guest_func, void *)

Argument to for_each_plugin.

Called with a path to the so-file, a function to apply to each found driver (see drv_guest_func()) and an untyped argument given to for_each_plugin(). Returns NULL if iteration should continue, else a struct driver* pointer.

Definition at line 1 of file drv_admin.h.

## Function Documentation

## for_each_driver()

struct driver * for_each_driver | ( | drv_guest_func | func,
|  | void * | arg,
|  | const char * | pluginpath )

Apply func to all existing drivers.

Returns pointer to a driver if such a pointer is returned by func(), else NULL. Pluginpath defaults to lircd:pluginpath, LIRC_PLUGINPATH and a hardcoded last resort.

Definition at line 227 of file drv_admin.c.

## for_each_plugin()

void for_each_plugin | ( | plugin_guest_func | plugin_guest,
|  | void * | arg,
|  | const char * | pluginpath )

Apply func to all plugins (i.

e., .so-files) in plugin path. plugin path default to lircd:pluginpath, LIRC_PLUGINPATH and a hardcoded last resort.

Definition at line 235 of file drv_admin.c.

## hw_choose_driver()

int hw_choose_driver | ( | const char * | name | ) |

Search for driver with given name, update global drv with driver data if found.

Returns
  Returns 0 if found and hw updated, else -1.

Definition at line 297 of file drv_admin.c.

## hw_print_drivers()

void hw_print_drivers | ( | FILE * | file | ) |

Prints all drivers known to the system to the file given as argument.

Parameters

  file | File to print to.

Definition at line 270 of file drv_admin.c.