* Timo Rongas <ext-timo.2.rongas@nokia.com>
* Lihan Guo <lihan.guo@digia.com>
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with keymap; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <stdio.h>
r = read(fd, ev, sizeof(struct input_event) * 64);
- if (r < (int) sizeof(struct input_event))
+ if (r < (int) sizeof(struct input_event)) {
+ close(fd);
return;
+ }
for (i = 0; i < r / (int) sizeof(struct input_event); i++) {
if (got_syn == 1) {
if (udev == NULL)
return 1;
- udev_log_init("input_id");
+ log_open();
udev_set_log_fn(udev, log_fn);
/* CLI argument parsing */
switch (option) {
case 'd':
debug = 1;
- if (udev_get_log_priority(udev) < LOG_INFO)
- udev_set_log_priority(udev, LOG_INFO);
+ log_set_max_level(LOG_DEBUG);
+ udev_set_log_priority(udev, LOG_DEBUG);
break;
case 'h':
help();
}
/* get the device */
- snprintf(devpath, sizeof(devpath), "%s/%s", udev_get_sys_path(udev), argv[optind]);
+ snprintf(devpath, sizeof(devpath), "/sys/%s", argv[optind]);
dev = udev_device_new_from_syspath(udev, devpath);
if (dev == NULL) {
fprintf(stderr, "unable to access '%s'\n", devpath);
return 0;
}
- /* Get the children devices and find the devnode
- * FIXME: use udev_enumerate_add_match_children() instead
- * when it's available */
+ /* Get the children devices and find the devnode */
+ /* FIXME: use udev_enumerate_add_match_parent() instead */
devnode = NULL;
enumerate = udev_enumerate_new(udev);
udev_enumerate_add_match_property(enumerate, "ID_PATH", id_path);
return 0;
}
- info(udev, "Opening accelerometer device %s\n", devnode);
+ log_debug("opening accelerometer device %s\n", devnode);
test_orientation(udev, dev, devnode);
free(devnode);
-
+ log_close();
return 0;
}