lomoco.h
Go to the documentation of this file.00001 /* 00002 * lomoco - Logitech Mouse Control for Linux 00003 * 00004 * Copyright (c) 2007 by Andreas Schneider <mail@cynapses.org> 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * vim: ts=2 sw=2 et cindent 00021 */ 00022 00023 #ifndef _LOMOCO_H 00024 #define _LOMOCO_H 00025 00026 /** 00027 * @struct lomoco_device_s 00028 * 00029 * Used to store all needed information of a lomoco device 00030 */ 00031 00032 /** 00033 * @typedef logitech_device_t 00034 * Creates a type name for logitech_device_s 00035 */ 00036 typedef struct lomoco_device_s { 00037 char *name; 00038 int vid; 00039 int pid; 00040 } lomoco_device_t; 00041 00042 /** 00043 * @struct lomoco_base_s 00044 * 00045 * Used to store all needed information for lomoco 00046 */ 00047 00048 /** 00049 * @typedef logitech_base_t 00050 * Creates a type name for logitech_base_s 00051 */ 00052 typedef struct lomoco_base_s { 00053 /** List of Logitech Corded Mice */ 00054 struct lomoco_list_s *logitech_mice_corded; 00055 /** List of Logitech Cordless Mice */ 00056 struct lomoco_list_s *logitech_mice_cordless; 00057 /** List of Logitech receivers */ 00058 struct lomoco_list_s *logitech_receiver; 00059 /** Logitech vendor id */ 00060 int logitech_vid; 00061 00062 int err_mask; 00063 } lomoco_base_t; 00064 00065 typedef int (*lomoco_device_func) (lomoco_device_t *device); 00066 00067 /** 00068 * @brief Initializes all needed structures and reads the config file. 00069 * 00070 * This function has to be called before you can use any other function. It 00071 * reads the config file, allocates the base structure and add all information. 00072 * 00073 * @param debug_level Set the debug level of lomoco 00074 * 00075 * @return Returns the initialized base structure 00076 */ 00077 lomoco_base_t *lomoco_init(int debug_level); 00078 00079 00080 /** 00081 * @brief Get all attached supported devices by lomoco. 00082 * 00083 * This function will search for all attached and supported devices. It will 00084 * call a callback function on every found device. 00085 * 00086 * @param base The initialized base structure. 00087 * @param fn The callback function called on every device found. 00088 * 00089 * @return 1 on success, 0 if no device has been found and -1 on an error. 00090 */ 00091 int lomoco_get_devices(lomoco_base_t *base, lomoco_device_func fn); 00092 00093 00094 /** 00095 * @brief Frees the allocated memory of the base structure. 00096 * 00097 * Frees all lists and allocated memory. This function should be called before 00098 * you exit. 00099 * 00100 * @param base The initialized base structure. 00101 */ 00102 void lomoco_finish(lomoco_base_t *base); 00103 00104 #endif /* _LOMOCO_H */ 00105