00001 /*************************************************************************** 00002 * CVSID: $Id: linux_common.h,v 1.3 2004/01/02 12:11:24 david Exp $ 00003 * 00004 * linux_common.h : Common functionality used by Linux specific parts 00005 * 00006 * Copyright (C) 2003 David Zeuthen, <david@fubar.dk> 00007 * 00008 * Licensed under the Academic Free License version 2.0 00009 * 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 * 00024 **************************************************************************/ 00025 00026 #ifndef LINUX_COMMON_H 00027 #define LINUX_COMMON_H 00028 00029 #include <dbus/dbus.h> 00030 00031 #include "../device_store.h" 00032 #include "libsysfs/libsysfs.h" 00033 00041 double parse_double(const char* str); 00042 dbus_int32_t parse_dec(const char* str); 00043 dbus_int32_t parse_hex(const char* str); 00044 00045 long int find_num(char* pre, char* s, int base); 00046 double find_double(char* pre, char* s); 00047 int find_bcd2(char* pre, char* s); 00048 char* find_string(char* pre, char* s); 00049 00050 char* read_single_line(char* filename_format,...); 00051 00052 const char* get_last_element(const char* s); 00053 00062 typedef char* (*ComputeFDI)(HalDevice* d, int append_num); 00063 00064 char* rename_and_merge(HalDevice* d, ComputeFDI naming_func, 00065 const char* namespace); 00066 00067 char* get_parent_sysfs_path(const char* path); 00068 00069 void find_and_set_physical_device(HalDevice* device); 00070 00071 00072 const char* drivers_lookup(const char* device_path); 00073 00074 void drivers_collect(const char* bus_name); 00075 00088 #define HAL_LINUX_HOTPLUG_TIMEOUT 30000 00089 00090 extern dbus_bool_t is_probing; 00091 00092 extern char sysfs_mount_path[SYSFS_PATH_MAX]; 00093 00094 /* @} */ 00095 00096 #endif /* LINUX_COMMON_H */