00001 /*************************************************************************** 00002 * Copyright (C) 2009 by Rick L. Vinyard, Jr. * 00003 * rvinyard@cs.nmsu.edu * 00004 * * 00005 * This file is part of the g13 library. * 00006 * * 00007 * The g13 library is free software; you can redistribute it and/or * 00008 * modify it under the terms of the GNU General Public License * 00009 * version 3 as published by the Free Software Foundation. * 00010 * * 00011 * The g13 library is distributed in the hope that it will be * 00012 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * 00013 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00014 * General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU General Public License * 00017 * along with this software. If not see <http://www.gnu.org/licenses/>. * 00018 ***************************************************************************/ 00019 #ifndef G13_UDEV_H 00020 #define G13_UDEV_H 00021 00022 #define _GNU_SOURCE 1 00023 00024 #define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE 1 00025 #include <libudev.h> 00026 00027 #define G13_DRIVER_NAME "hid-g13" 00028 00037 typedef struct udev_list_entry g13_list_entry; 00038 00045 typedef struct udev_device g13_device; 00046 00048 g13_list_entry *g13_list_entry_get_next(g13_list_entry *list_entry); 00049 00056 #define g13_list_entry_foreach(entry, first) \ 00057 for (entry = first; \ 00058 entry != NULL; \ 00059 entry = g13_list_entry_get_next(entry)) 00060 00067 typedef struct udev_enumerate g13_enumerate; 00068 00069 00082 void g13_init(); 00083 00090 void g13_shutdown(); 00091 00095 int g13_initialized(); 00096 00100 struct udev* g13_udev(); 00101 00106 g13_enumerate* g13_enumerate_new(); 00107 00116 g13_enumerate* g13_enumerate_ref(g13_enumerate* e); 00117 00122 void g13_enumerate_unref(g13_enumerate* e); 00123 00129 int g13_enumerate_scan_devices( g13_enumerate* e ); 00130 00135 g13_list_entry* g13_enumerate_get_list_entry(g13_enumerate* e); 00136 00143 g13_list_entry* g13_enumerate_scan_devices_get_list_entry(g13_enumerate* e); 00144 00149 const char* g13_list_entry_get_name( g13_list_entry* entry ); 00150 00155 const char* g13_list_entry_get_value( g13_list_entry* entry ); 00156 00161 g13_device* g13_device_new_from_list_entry( g13_list_entry* list_entry ); 00162 00168 g13_device* g13_device_new_from_name( const char* name ); 00169 00171 g13_device* g13_device_ref( g13_device* device ); 00172 00174 void g13_device_unref( g13_device* device ); 00175 00177 struct udev_device * g13_device_get_parent (g13_device *g13_device); 00178 00180 struct udev_device * g13_device_get_parent_with_subsystem_devtype 00181 (g13_device *g13_device, 00182 const char *subsystem, 00183 const char *devtype); 00184 00186 const char * g13_device_get_devpath (g13_device *g13_device); 00187 00189 const char * g13_device_get_subsystem (g13_device *g13_device); 00190 00192 const char * g13_device_get_devtype (g13_device *g13_device); 00193 00195 const char * g13_device_get_syspath (g13_device *g13_device); 00196 00198 const char * g13_device_get_sysname (g13_device *g13_device); 00199 00201 const char * g13_device_get_sysnum (g13_device *g13_device); 00202 00204 const char * g13_device_get_devnode (g13_device *g13_device); 00205 00207 const char * g13_device_get_property_value (g13_device *g13_device, const char *key); 00208 00210 const char * g13_device_get_driver (g13_device *g13_device); 00211 00213 dev_t g13_device_get_devnum (g13_device *g13_device); 00214 00216 const char * g13_device_get_action (g13_device *g13_device); 00217 00219 const char * g13_device_get_sysattr_value (g13_device *g13_device, const char *sysattr); 00220 00221 #endif 00222