00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifdef HAVE_CONFIG_H
00027 # include <config.h>
00028 #endif
00029
00030 #include <ctype.h>
00031 #include <stdio.h>
00032 #include <stdlib.h>
00033 #include <string.h>
00034 #include <getopt.h>
00035 #include <assert.h>
00036 #include <unistd.h>
00037 #include <stdarg.h>
00038 #include <limits.h>
00039
00040 #include "../logger.h"
00041 #include "../device_store.h"
00042 #include "../hald.h"
00043
00044 #include "class_device.h"
00045 #include "common.h"
00046
00069 static void
00070 input_class_pre_process (ClassDeviceHandler *self,
00071 HalDevice *d,
00072 const char *sysfs_path,
00073 struct sysfs_class_device *class_device)
00074 {
00075
00076 hal_device_property_set_string (d, "info.category", "input");
00077 hal_device_add_capability (d, "input");
00078
00083 }
00084
00100 static void
00101 input_class_get_device_file_target (ClassDeviceHandler *self,
00102 HalDevice *d,
00103 const char *sysfs_path,
00104 struct sysfs_class_device *class_device,
00105 char* dev_file_prop,
00106 int dev_file_prop_len)
00107 {
00108 const char *sysfs_name;
00109
00110
00111
00112 sysfs_name = get_last_element (sysfs_path);
00113 if (strlen (sysfs_name) > sizeof("event")-1 &&
00114 strncmp (sysfs_name, "event", sizeof("event")-1) == 0) {
00115 strncpy(dev_file_prop, "input.device", dev_file_prop_len);
00116 } else {
00117
00118
00119
00120
00121 strncpy(dev_file_prop, "input.device.arch", dev_file_prop_len);
00122 }
00123 }
00124
00126 ClassDeviceHandler input_class_handler = {
00127 class_device_init,
00128 class_device_detection_done,
00129 class_device_shutdown,
00130 class_device_tick,
00131 class_device_accept,
00132 class_device_visit,
00133 class_device_removed,
00134 class_device_udev_event,
00135 input_class_get_device_file_target,
00136 input_class_pre_process,
00137 class_device_post_merge,
00138 class_device_got_udi,
00139 NULL,
00140 "input",
00141 "input",
00142 TRUE,
00143 TRUE
00144 };
00145