# LIRC libraries: /var/tmp/portage/app-misc/lirc-0.10.1-r4/work/lirc-0.10.1/lib/drv_admin.c File Reference

drv_admin.c File Reference

Implements drv_admin.h. More...

`#include <stdio.h>`
`#include <dirent.h>`
`#include <dlfcn.h>`
`#include "lirc/driver.h"`
`#include "lirc/drv_admin.h"`
`#include "lirc/lirc_options.h"`
`#include "lirc_log.h"`
`#include "driver.h"`

Go to the source code of this file.

## Macros

#define | MAX_PLUGINS 256
| Max number if plugins handled. More...

## Functions

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

## Variables

struct driver | drv
| Access to otherwise private drv. More...
const struct driver | drv_null
| Default driver, a placeholder. More...

## Detailed Description

Implements drv_admin.h.

Author
  Alec Leamas

Date
  August 2014 license: GPL2 or later

Definition in file drv_admin.c.

## Macro Definition Documentation

## MAX_PLUGINS

#define MAX_PLUGINS 256

Max number if plugins handled.

No point to malloc() this.

Definition at line 40 of file drv_admin.c.

## 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.

## Variable Documentation

## drv

struct driver drv

Access to otherwise private drv.

Access to otherwise private drv.

Set by hw_choose_driver().

Definition at line 28 of file driver.c.

## drv_null

const struct driver drv_null

Initial value:
= {
.name = "null",
.device = "/dev/null",
.features = 0,
.send_mode = 0,
.rec_mode = 0,
.code_length = 0,
.init_func = NULL,
.deinit_func = NULL,
.send_func = NULL,
.rec_func = NULL,
.decode_func = NULL,
.readdata = NULL,
.drvctl_func = default_drvctl,
.open_func = default_open,
.close_func = default_close,
.api_version = 2,
.driver_version = "0.9.2"
}
default_close
int default_close(void)
For now, a placeholder.
Definition: driver.c:52
default_drvctl
int default_drvctl(unsigned int fd, void *arg)
Return DRV_ERR_NOTIMPLEMENTED.
Definition: driver.c:57
default_open
int default_open(const char *path)
Stores path in drv.device if non-null.
Definition: driver.c:37

Default driver, a placeholder.

Definition at line 54 of file drv_admin.c.