g13 tux logo   g13

udev.c File Reference

#include "udev.h"
#include "name.h"
#include "framebuffer.h"
#include <string.h>
#include <stdlib.h>
Include dependency graph for udev.c:

Functions

g13_list_entryg13_list_entry_get_next (g13_list_entry *list_entry)
 Convenience replacement for udev_list_entry_get_next().
void g13_init ()
 Initializes the g13 library by preparing the various udev structures that are needed for finding g13 devices.
void g13_shutdown ()
 Shuts down the g13 library.
int g13_initialized ()
struct udev * g13_udev ()
g13_enumerateg13_enumerate_new ()
g13_enumerateg13_enumerate_ref (g13_enumerate *e)
 Increment the refcount of an enumeration context.
void g13_enumerate_unref (g13_enumerate *e)
 Drop a reference of an enumeration context.
int g13_enumerate_scan_devices (g13_enumerate *e)
 Inititiate a udev scanning for g13 devices on the specified enumeration.
g13_list_entryg13_enumerate_get_list_entry (g13_enumerate *e)
g13_list_entryg13_enumerate_scan_devices_get_list_entry (g13_enumerate *e)
 Scans the enumeration for G13 devices and returns the first entry.
const char * g13_list_entry_get_name (g13_list_entry *entry)
 Convenience replacement for udev_list_entry_get_name().
const char * g13_list_entry_get_value (g13_list_entry *entry)
 Convenience replacement for udev_list_entry_get_value().
g13_deviceg13_device_new_from_list_entry (g13_list_entry *list_entry)
 Create a new device from a list entry.
g13_deviceg13_device_new_from_name (const char *find)
 Create a new device by searching for a specific G13 name.
g13_deviceg13_device_ref (g13_device *g13d)
 Increment the reference count for the device.
void g13_device_unref (g13_device *g13d)
 Decrement the device reference count.
struct udev_device * g13_device_get_parent (g13_device *g13d)
 Thin wrapper to support g13_device* types without accessing g13_device member udevd.
struct udev_device * g13_device_get_parent_with_subsystem_devtype (g13_device *g13d, const char *subsystem, const char *devtype)
 Thin wrapper to support g13_device* types without accessing g13_device member udevd.
const char * g13_device_get_devpath (g13_device *g13d)
 Thin wrapper to support g13_device* types without accessing g13_device member udevd.
const char * g13_device_get_subsystem (g13_device *g13d)
 Thin wrapper to support g13_device* types without accessing g13_device member udevd.
const char * g13_device_get_devtype (g13_device *g13d)
 Thin wrapper to support g13_device* types without accessing g13_device member udevd.
const char * g13_device_get_syspath (g13_device *g13d)
 Thin wrapper to support g13_device* types without accessing g13_device member udevd.
const char * g13_device_get_sysname (g13_device *g13d)
 Thin wrapper to support g13_device* types without accessing g13_device member udevd.
const char * g13_device_get_sysnum (g13_device *g13d)
 Thin wrapper to support g13_device* types without accessing g13_device member udevd.
const char * g13_device_get_devnode (g13_device *g13d)
 Thin wrapper to support g13_device* types without accessing g13_device member udevd.
const char * g13_device_get_property_value (g13_device *g13d, const char *key)
 Thin wrapper to support g13_device* types without accessing g13_device member udevd.
const char * g13_device_get_driver (g13_device *g13d)
 Thin wrapper to support g13_device* types without accessing g13_device member udevd.
dev_t g13_device_get_devnum (g13_device *g13d)
 Thin wrapper to support g13_device* types without accessing g13_device member udevd.
const char * g13_device_get_action (g13_device *g13d)
 Thin wrapper to support g13_device* types without accessing g13_device member udevd.
const char * g13_device_get_sysattr_value (g13_device *g13d, const char *sysattr)
 Thin wrapper to support g13_device* types without accessing g13_device member udevd.

Variables

int __g13_initialized = 0
struct udev * __g13_udev = NULL
struct udev_enumerate * __g13_enumerate = NULL

Function Documentation

const char* g13_device_get_action ( g13_device g13d  ) 

Thin wrapper to support g13_device* types without accessing g13_device member udevd.

const char* g13_device_get_devnode ( g13_device g13d  ) 

Thin wrapper to support g13_device* types without accessing g13_device member udevd.

dev_t g13_device_get_devnum ( g13_device g13d  ) 

Thin wrapper to support g13_device* types without accessing g13_device member udevd.

const char* g13_device_get_devpath ( g13_device g13d  ) 

Thin wrapper to support g13_device* types without accessing g13_device member udevd.

const char* g13_device_get_devtype ( g13_device g13d  ) 

Thin wrapper to support g13_device* types without accessing g13_device member udevd.

const char* g13_device_get_driver ( g13_device g13d  ) 

Thin wrapper to support g13_device* types without accessing g13_device member udevd.

struct udev_device* g13_device_get_parent ( g13_device g13d  )  [read]

Thin wrapper to support g13_device* types without accessing g13_device member udevd.

struct udev_device* g13_device_get_parent_with_subsystem_devtype ( g13_device g13d,
const char *  subsystem,
const char *  devtype 
) [read]

Thin wrapper to support g13_device* types without accessing g13_device member udevd.

const char* g13_device_get_property_value ( g13_device g13d,
const char *  key 
)

Thin wrapper to support g13_device* types without accessing g13_device member udevd.

const char* g13_device_get_subsystem ( g13_device g13d  ) 

Thin wrapper to support g13_device* types without accessing g13_device member udevd.

const char* g13_device_get_sysattr_value ( g13_device g13d,
const char *  sysattr 
)

Thin wrapper to support g13_device* types without accessing g13_device member udevd.

const char* g13_device_get_sysname ( g13_device g13d  ) 

Thin wrapper to support g13_device* types without accessing g13_device member udevd.

const char* g13_device_get_sysnum ( g13_device g13d  ) 

Thin wrapper to support g13_device* types without accessing g13_device member udevd.

const char* g13_device_get_syspath ( g13_device g13d  ) 
g13_device* g13_device_new_from_list_entry ( g13_list_entry list_entry  ) 

Create a new device from a list entry.

Returns:
The new device that should be freed with g13_device_unref()

References __g13_udev, g13_init(), g13_initialized(), and g13_list_entry_get_name().

Referenced by G13::Device::create(), and g13_device_new_from_name().

g13_device* g13_device_new_from_name ( const char *  name  ) 

Create a new device by searching for a specific G13 name.

Returns:
the new g13_device* that should be freed with g13_device_unref()
Parameters:
name the G13 device name to look for

References g13_device_free_name(), g13_device_get_name(), g13_device_new_from_list_entry(), g13_device_unref(), g13_enumerate_scan_devices_get_list_entry(), and g13_list_entry_foreach.

Referenced by G13::Device::create().

g13_device* g13_device_ref ( g13_device g13d  ) 

Increment the reference count for the device.

Referenced by G13::Device::Device().

void g13_device_unref ( g13_device device  ) 

Decrement the device reference count.

If the refcount is zero the device resources will be freed.

Referenced by g13_device_new_from_name(), and G13::Device::~Device().

g13_list_entry* g13_enumerate_get_list_entry ( g13_enumerate e  ) 
Returns:
the first entry of the sorted list of G13 device paths
Parameters:
e The g13 enumeration to return the entry from or NULL to use the default enumeration

References __g13_enumerate, g13_init(), and g13_initialized().

g13_enumerate* g13_enumerate_new (  ) 
Returns:
a new pointer to a g13 enumeration structure or NULL on failure Should be freed with g13_enumerate_unref()

References __g13_udev, G13_DRIVER_NAME, and g13_init().

Referenced by g13_init().

g13_enumerate* g13_enumerate_ref ( g13_enumerate e  ) 

Increment the refcount of an enumeration context.

This is a shallow wrapper around udev_enumerate_ref() provided to allow g13 enumeration contexts to be referenced without casting.

Returns:
the enumeration context passed in
int g13_enumerate_scan_devices ( g13_enumerate e  ) 

Inititiate a udev scanning for g13 devices on the specified enumeration.

Returns:
0 on success, otherwise a negative error value
Parameters:
e the enumeration to perform the scan on or NULL to use the default enumeration

References __g13_enumerate, g13_init(), and g13_initialized().

g13_list_entry* g13_enumerate_scan_devices_get_list_entry ( g13_enumerate e  ) 

Scans the enumeration for G13 devices and returns the first entry.

Returns:
the first entry in the sorted list of g13 devices or NULL on failure/no devices
Parameters:
e The g13 enumeration to return the devices of or NULL to use the default enumeration

References __g13_enumerate, g13_init(), and g13_initialized().

Referenced by g13_device_new_from_name().

void g13_enumerate_unref ( g13_enumerate e  ) 

Drop a reference of an enumeration context.

If the refcount reaches zero, all resources of the enumeration context will be released.

void g13_init (  ) 

Initializes the g13 library by preparing the various udev structures that are needed for finding g13 devices.

This will be implicitly called by g13 library functions such as g13_enumerate_devices() that need udev structures initiated.

Whether the library is initialized explicity with a call to g13_init() or implicitly through a call to g13_enumerate_devices(), g13_shutdown() should be called after all g13 library work is done. This is typically at the end of the program.

References __g13_enumerate, __g13_initialized, __g13_udev, and g13_enumerate_new().

Referenced by g13_device_new_from_list_entry(), g13_enumerate_get_list_entry(), g13_enumerate_new(), g13_enumerate_scan_devices(), and g13_enumerate_scan_devices_get_list_entry().

int g13_initialized (  ) 
Returns:
1 if the g13 library is initialized or 0 if it is not.

References __g13_initialized.

Referenced by g13_device_new_from_list_entry(), g13_enumerate_get_list_entry(), g13_enumerate_scan_devices(), and g13_enumerate_scan_devices_get_list_entry().

const char* g13_list_entry_get_name ( g13_list_entry entry  ) 

Convenience replacement for udev_list_entry_get_name().

Returns:
The name string of this entry

Referenced by g13_device_new_from_list_entry().

g13_list_entry* g13_list_entry_get_next ( g13_list_entry list_entry  ) 

Convenience replacement for udev_list_entry_get_next().

const char* g13_list_entry_get_value ( g13_list_entry entry  ) 

Convenience replacement for udev_list_entry_get_value().

Returns:
The value string of this entry
void g13_shutdown (  ) 

Shuts down the g13 library.

Primary purpose is to clean up udev structures allocated during g13_init().

References __g13_enumerate, __g13_initialized, and __g13_udev.

struct udev* g13_udev (  )  [read]
Returns:
the udev structure used internally by the g13 library

References __g13_udev.


Variable Documentation

struct udev_enumerate* __g13_enumerate = NULL
struct udev* __g13_udev = NULL

Generated on Wed Mar 24 10:13:19 2010 for g13 by doxygen 1.6.1