2011-01-14 14:45:42 -05:00
|
|
|
/*
|
|
|
|
|
* Copyright © 2010 Intel Corporation
|
2013-11-10 17:55:40 +01:00
|
|
|
* Copyright © 2013 Jonas Ådahl
|
2011-01-14 14:45:42 -05:00
|
|
|
*
|
|
|
|
|
* Permission to use, copy, modify, distribute, and sell this software and
|
|
|
|
|
* its documentation for any purpose is hereby granted without fee, provided
|
|
|
|
|
* that the above copyright notice appear in all copies and that both that
|
|
|
|
|
* copyright notice and this permission notice appear in supporting
|
|
|
|
|
* documentation, and that the name of the copyright holders not be used in
|
|
|
|
|
* advertising or publicity pertaining to distribution of the software
|
|
|
|
|
* without specific, written prior permission. The copyright holders make
|
|
|
|
|
* no representations about the suitability of this software for any
|
|
|
|
|
* purpose. It is provided "as is" without express or implied warranty.
|
|
|
|
|
*
|
|
|
|
|
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
|
|
|
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
|
|
|
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
|
|
|
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
|
|
|
|
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
|
|
|
|
* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
|
|
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
2013-05-22 18:03:19 +03:00
|
|
|
#include "config.h"
|
|
|
|
|
|
2013-10-15 14:29:56 +02:00
|
|
|
#include <errno.h>
|
2011-01-14 14:45:42 -05:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <linux/input.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <fcntl.h>
|
2012-03-16 17:33:03 -03:00
|
|
|
#include <mtdev.h>
|
2013-09-24 12:09:03 +01:00
|
|
|
#include <assert.h>
|
2011-01-14 14:45:42 -05:00
|
|
|
|
2013-11-10 17:55:40 +01:00
|
|
|
#include "libinput.h"
|
2011-12-19 01:14:03 +02:00
|
|
|
#include "evdev.h"
|
2013-11-10 17:55:40 +01:00
|
|
|
#include "libinput-private.h"
|
2011-01-14 14:45:42 -05:00
|
|
|
|
2013-11-10 17:55:40 +01:00
|
|
|
#define DEFAULT_AXIS_STEP_DISTANCE li_fixed_from_int(10)
|
2012-10-03 22:56:58 +02:00
|
|
|
|
2012-08-03 14:39:05 +03:00
|
|
|
void
|
2013-11-10 17:55:40 +01:00
|
|
|
evdev_device_led_update(struct evdev_device *device, enum libinput_led leds)
|
2012-05-30 16:31:49 +01:00
|
|
|
{
|
|
|
|
|
static const struct {
|
2013-11-10 17:55:40 +01:00
|
|
|
enum libinput_led weston;
|
2012-05-30 16:31:49 +01:00
|
|
|
int evdev;
|
|
|
|
|
} map[] = {
|
2013-11-10 17:55:40 +01:00
|
|
|
{ LIBINPUT_LED_NUM_LOCK, LED_NUML },
|
|
|
|
|
{ LIBINPUT_LED_CAPS_LOCK, LED_CAPSL },
|
|
|
|
|
{ LIBINPUT_LED_SCROLL_LOCK, LED_SCROLLL },
|
2012-05-30 16:31:49 +01:00
|
|
|
};
|
2013-08-09 16:32:17 +02:00
|
|
|
struct input_event ev[ARRAY_LENGTH(map) + 1];
|
2012-05-30 16:31:49 +01:00
|
|
|
unsigned int i;
|
|
|
|
|
|
2012-08-06 14:57:07 +03:00
|
|
|
if (!device->caps & EVDEV_KEYBOARD)
|
|
|
|
|
return;
|
|
|
|
|
|
2012-05-30 16:31:49 +01:00
|
|
|
memset(ev, 0, sizeof(ev));
|
|
|
|
|
for (i = 0; i < ARRAY_LENGTH(map); i++) {
|
|
|
|
|
ev[i].type = EV_LED;
|
|
|
|
|
ev[i].code = map[i].evdev;
|
|
|
|
|
ev[i].value = !!(leds & map[i].weston);
|
|
|
|
|
}
|
2013-08-09 16:32:17 +02:00
|
|
|
ev[i].type = EV_SYN;
|
|
|
|
|
ev[i].code = SYN_REPORT;
|
2012-05-30 16:31:49 +01:00
|
|
|
|
2012-08-06 14:57:07 +03:00
|
|
|
i = write(device->fd, ev, sizeof ev);
|
|
|
|
|
(void)i; /* no, we really don't care about the return value */
|
2012-05-30 16:31:49 +01:00
|
|
|
}
|
|
|
|
|
|
2013-09-24 12:09:03 +01:00
|
|
|
static void
|
|
|
|
|
transform_absolute(struct evdev_device *device, int32_t *x, int32_t *y)
|
|
|
|
|
{
|
2013-11-10 17:55:40 +01:00
|
|
|
if (!device->abs.apply_calibration) {
|
|
|
|
|
*x = device->abs.x;
|
|
|
|
|
*y = device->abs.y;
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
*x = device->abs.x * device->abs.calibration[0] +
|
|
|
|
|
device->abs.y * device->abs.calibration[1] +
|
|
|
|
|
device->abs.calibration[2];
|
|
|
|
|
|
|
|
|
|
*y = device->abs.x * device->abs.calibration[3] +
|
|
|
|
|
device->abs.y * device->abs.calibration[4] +
|
|
|
|
|
device->abs.calibration[5];
|
|
|
|
|
}
|
2013-09-24 12:09:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
evdev_flush_pending_event(struct evdev_device *device, uint32_t time)
|
|
|
|
|
{
|
|
|
|
|
int32_t cx, cy;
|
|
|
|
|
int slot;
|
2013-11-10 17:55:40 +01:00
|
|
|
struct libinput_device *base = &device->base;
|
2013-09-24 12:09:03 +01:00
|
|
|
|
|
|
|
|
slot = device->mt.slot;
|
|
|
|
|
|
|
|
|
|
switch (device->pending_event) {
|
|
|
|
|
case EVDEV_NONE:
|
|
|
|
|
return;
|
|
|
|
|
case EVDEV_RELATIVE_MOTION:
|
2013-11-10 17:55:40 +01:00
|
|
|
pointer_notify_motion(base,
|
|
|
|
|
time,
|
|
|
|
|
device->rel.dx,
|
|
|
|
|
device->rel.dy);
|
2013-09-24 12:09:03 +01:00
|
|
|
device->rel.dx = 0;
|
|
|
|
|
device->rel.dy = 0;
|
|
|
|
|
goto handled;
|
|
|
|
|
case EVDEV_ABSOLUTE_MT_DOWN:
|
2013-11-10 17:55:40 +01:00
|
|
|
touch_notify_touch(base,
|
|
|
|
|
time,
|
|
|
|
|
slot,
|
|
|
|
|
li_fixed_from_int(device->mt.slots[slot].x),
|
|
|
|
|
li_fixed_from_int(device->mt.slots[slot].y),
|
|
|
|
|
LIBINPUT_TOUCH_TYPE_DOWN);
|
2013-09-24 12:09:03 +01:00
|
|
|
goto handled;
|
|
|
|
|
case EVDEV_ABSOLUTE_MT_MOTION:
|
2013-11-10 17:55:40 +01:00
|
|
|
touch_notify_touch(base,
|
|
|
|
|
time,
|
|
|
|
|
slot,
|
|
|
|
|
li_fixed_from_int(device->mt.slots[slot].x),
|
|
|
|
|
li_fixed_from_int(device->mt.slots[slot].y),
|
|
|
|
|
LIBINPUT_TOUCH_TYPE_MOTION);
|
2013-09-24 12:09:03 +01:00
|
|
|
goto handled;
|
|
|
|
|
case EVDEV_ABSOLUTE_MT_UP:
|
2013-11-10 17:55:40 +01:00
|
|
|
touch_notify_touch(base,
|
|
|
|
|
time,
|
|
|
|
|
slot,
|
|
|
|
|
0, 0,
|
|
|
|
|
LIBINPUT_TOUCH_TYPE_UP);
|
2013-09-24 12:09:03 +01:00
|
|
|
goto handled;
|
2013-09-24 20:05:07 +01:00
|
|
|
case EVDEV_ABSOLUTE_TOUCH_DOWN:
|
|
|
|
|
transform_absolute(device, &cx, &cy);
|
2013-11-10 17:55:40 +01:00
|
|
|
touch_notify_touch(base,
|
|
|
|
|
time,
|
|
|
|
|
slot,
|
|
|
|
|
li_fixed_from_int(cx),
|
|
|
|
|
li_fixed_from_int(cy),
|
|
|
|
|
LIBINPUT_TOUCH_TYPE_DOWN);
|
2013-09-24 20:05:07 +01:00
|
|
|
goto handled;
|
2013-09-24 12:09:03 +01:00
|
|
|
case EVDEV_ABSOLUTE_MOTION:
|
|
|
|
|
transform_absolute(device, &cx, &cy);
|
2013-11-10 17:55:40 +01:00
|
|
|
if (device->caps & EVDEV_TOUCH) {
|
|
|
|
|
touch_notify_touch(base,
|
|
|
|
|
time,
|
|
|
|
|
slot,
|
|
|
|
|
li_fixed_from_int(cx),
|
|
|
|
|
li_fixed_from_int(cy),
|
|
|
|
|
LIBINPUT_TOUCH_TYPE_DOWN);
|
|
|
|
|
} else {
|
|
|
|
|
pointer_notify_motion_absolute(base,
|
|
|
|
|
time,
|
|
|
|
|
li_fixed_from_int(cx),
|
|
|
|
|
li_fixed_from_int(cy));
|
|
|
|
|
}
|
2013-09-24 12:09:03 +01:00
|
|
|
goto handled;
|
2013-09-24 20:05:07 +01:00
|
|
|
case EVDEV_ABSOLUTE_TOUCH_UP:
|
2013-11-10 17:55:40 +01:00
|
|
|
touch_notify_touch(base,
|
|
|
|
|
time,
|
|
|
|
|
0, 0, 0, LIBINPUT_TOUCH_TYPE_UP);
|
2013-09-24 20:05:07 +01:00
|
|
|
goto handled;
|
2013-09-24 12:09:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assert(0 && "Unknown pending event type");
|
|
|
|
|
|
|
|
|
|
handled:
|
|
|
|
|
device->pending_event = EVDEV_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-24 20:05:07 +01:00
|
|
|
static void
|
|
|
|
|
evdev_process_touch_button(struct evdev_device *device, int time, int value)
|
|
|
|
|
{
|
|
|
|
|
if (device->pending_event != EVDEV_NONE &&
|
|
|
|
|
device->pending_event != EVDEV_ABSOLUTE_MOTION)
|
|
|
|
|
evdev_flush_pending_event(device, time);
|
|
|
|
|
|
|
|
|
|
device->pending_event = (value ?
|
|
|
|
|
EVDEV_ABSOLUTE_TOUCH_DOWN :
|
|
|
|
|
EVDEV_ABSOLUTE_TOUCH_UP);
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-01 19:00:03 +03:00
|
|
|
static inline void
|
2012-08-06 14:57:08 +03:00
|
|
|
evdev_process_key(struct evdev_device *device, struct input_event *e, int time)
|
2011-09-01 19:00:03 +03:00
|
|
|
{
|
2013-08-07 11:04:42 +10:00
|
|
|
/* ignore kernel key repeat */
|
2011-11-10 14:47:30 +02:00
|
|
|
if (e->value == 2)
|
|
|
|
|
return;
|
|
|
|
|
|
2013-09-24 20:05:07 +01:00
|
|
|
if (e->code == BTN_TOUCH) {
|
|
|
|
|
if (!device->is_mt)
|
|
|
|
|
evdev_process_touch_button(device, time, e->value);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-24 12:09:03 +01:00
|
|
|
evdev_flush_pending_event(device, time);
|
|
|
|
|
|
2011-09-01 19:00:03 +03:00
|
|
|
switch (e->code) {
|
|
|
|
|
case BTN_LEFT:
|
|
|
|
|
case BTN_RIGHT:
|
|
|
|
|
case BTN_MIDDLE:
|
|
|
|
|
case BTN_SIDE:
|
|
|
|
|
case BTN_EXTRA:
|
|
|
|
|
case BTN_FORWARD:
|
|
|
|
|
case BTN_BACK:
|
|
|
|
|
case BTN_TASK:
|
2013-11-10 17:55:40 +01:00
|
|
|
pointer_notify_button(
|
|
|
|
|
&device->base,
|
|
|
|
|
time,
|
|
|
|
|
e->code,
|
|
|
|
|
e->value ? LIBINPUT_POINTER_BUTTON_STATE_PRESSED :
|
|
|
|
|
LIBINPUT_POINTER_BUTTON_STATE_RELEASED);
|
2011-09-01 19:00:03 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
2013-11-10 17:55:40 +01:00
|
|
|
keyboard_notify_key(
|
|
|
|
|
&device->base,
|
|
|
|
|
time,
|
|
|
|
|
e->code,
|
|
|
|
|
e->value ? LIBINPUT_KEYBOARD_KEY_STATE_PRESSED :
|
|
|
|
|
LIBINPUT_KEYBOARD_KEY_STATE_RELEASED);
|
2011-09-01 19:00:03 +03:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-21 19:34:09 +02:00
|
|
|
static void
|
2013-09-24 12:09:03 +01:00
|
|
|
evdev_process_touch(struct evdev_device *device,
|
|
|
|
|
struct input_event *e,
|
|
|
|
|
uint32_t time)
|
2011-12-21 19:34:09 +02:00
|
|
|
{
|
2013-11-10 17:55:40 +01:00
|
|
|
int screen_width;
|
|
|
|
|
int screen_height;
|
|
|
|
|
|
|
|
|
|
device->base.device_interface->get_current_screen_dimensions(
|
|
|
|
|
&screen_width,
|
|
|
|
|
&screen_height,
|
|
|
|
|
device->base.device_interface_data);
|
2011-12-21 19:34:09 +02:00
|
|
|
|
|
|
|
|
switch (e->code) {
|
|
|
|
|
case ABS_MT_SLOT:
|
2013-09-24 12:09:03 +01:00
|
|
|
evdev_flush_pending_event(device, time);
|
2011-12-21 22:18:36 -05:00
|
|
|
device->mt.slot = e->value;
|
2011-12-21 19:34:09 +02:00
|
|
|
break;
|
|
|
|
|
case ABS_MT_TRACKING_ID:
|
2013-09-24 12:09:03 +01:00
|
|
|
if (device->pending_event != EVDEV_NONE &&
|
|
|
|
|
device->pending_event != EVDEV_ABSOLUTE_MT_MOTION)
|
|
|
|
|
evdev_flush_pending_event(device, time);
|
2011-12-21 19:34:09 +02:00
|
|
|
if (e->value >= 0)
|
2013-09-24 12:09:03 +01:00
|
|
|
device->pending_event = EVDEV_ABSOLUTE_MT_DOWN;
|
2011-12-21 19:34:09 +02:00
|
|
|
else
|
2013-09-24 12:09:03 +01:00
|
|
|
device->pending_event = EVDEV_ABSOLUTE_MT_UP;
|
2011-12-21 19:34:09 +02:00
|
|
|
break;
|
|
|
|
|
case ABS_MT_POSITION_X:
|
2013-09-24 12:09:03 +01:00
|
|
|
device->mt.slots[device->mt.slot].x =
|
2011-12-21 22:18:36 -05:00
|
|
|
(e->value - device->abs.min_x) * screen_width /
|
2013-07-22 15:09:30 -07:00
|
|
|
(device->abs.max_x - device->abs.min_x);
|
2013-09-24 12:09:03 +01:00
|
|
|
if (device->pending_event == EVDEV_NONE)
|
|
|
|
|
device->pending_event = EVDEV_ABSOLUTE_MT_MOTION;
|
2011-12-21 19:34:09 +02:00
|
|
|
break;
|
|
|
|
|
case ABS_MT_POSITION_Y:
|
2013-09-24 12:09:03 +01:00
|
|
|
device->mt.slots[device->mt.slot].y =
|
2011-12-21 22:18:36 -05:00
|
|
|
(e->value - device->abs.min_y) * screen_height /
|
2013-07-22 15:09:30 -07:00
|
|
|
(device->abs.max_y - device->abs.min_y);
|
2013-09-24 12:09:03 +01:00
|
|
|
if (device->pending_event == EVDEV_NONE)
|
|
|
|
|
device->pending_event = EVDEV_ABSOLUTE_MT_MOTION;
|
2011-12-21 19:34:09 +02:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-01 19:00:03 +03:00
|
|
|
static inline void
|
2012-08-06 14:57:08 +03:00
|
|
|
evdev_process_absolute_motion(struct evdev_device *device,
|
2011-12-21 22:18:36 -05:00
|
|
|
struct input_event *e)
|
2011-09-01 19:00:03 +03:00
|
|
|
{
|
2013-11-10 17:55:40 +01:00
|
|
|
int screen_width;
|
|
|
|
|
int screen_height;
|
|
|
|
|
|
|
|
|
|
device->base.device_interface->get_current_screen_dimensions(
|
|
|
|
|
&screen_width,
|
|
|
|
|
&screen_height,
|
|
|
|
|
device->base.device_interface_data);
|
2011-09-01 19:00:03 +03:00
|
|
|
|
|
|
|
|
switch (e->code) {
|
|
|
|
|
case ABS_X:
|
2011-12-21 22:18:36 -05:00
|
|
|
device->abs.x =
|
|
|
|
|
(e->value - device->abs.min_x) * screen_width /
|
2013-07-26 10:40:32 -07:00
|
|
|
(device->abs.max_x - device->abs.min_x);
|
2013-09-24 12:09:03 +01:00
|
|
|
if (device->pending_event == EVDEV_NONE)
|
|
|
|
|
device->pending_event = EVDEV_ABSOLUTE_MOTION;
|
2011-09-01 19:00:03 +03:00
|
|
|
break;
|
|
|
|
|
case ABS_Y:
|
2011-12-21 22:18:36 -05:00
|
|
|
device->abs.y =
|
|
|
|
|
(e->value - device->abs.min_y) * screen_height /
|
2013-07-26 10:40:32 -07:00
|
|
|
(device->abs.max_y - device->abs.min_y);
|
2013-09-24 12:09:03 +01:00
|
|
|
if (device->pending_event == EVDEV_NONE)
|
|
|
|
|
device->pending_event = EVDEV_ABSOLUTE_MOTION;
|
2011-09-01 19:00:03 +03:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void
|
2012-08-06 14:57:08 +03:00
|
|
|
evdev_process_relative(struct evdev_device *device,
|
2012-05-17 12:18:17 +02:00
|
|
|
struct input_event *e, uint32_t time)
|
2011-09-01 19:00:03 +03:00
|
|
|
{
|
2013-11-10 17:55:40 +01:00
|
|
|
struct libinput_device *base = &device->base;
|
|
|
|
|
|
2011-09-01 19:00:03 +03:00
|
|
|
switch (e->code) {
|
|
|
|
|
case REL_X:
|
2013-09-24 12:09:03 +01:00
|
|
|
if (device->pending_event != EVDEV_RELATIVE_MOTION)
|
|
|
|
|
evdev_flush_pending_event(device, time);
|
2013-11-10 17:55:40 +01:00
|
|
|
device->rel.dx += li_fixed_from_int(e->value);
|
2013-09-24 12:09:03 +01:00
|
|
|
device->pending_event = EVDEV_RELATIVE_MOTION;
|
2011-09-01 19:00:03 +03:00
|
|
|
break;
|
|
|
|
|
case REL_Y:
|
2013-09-24 12:09:03 +01:00
|
|
|
if (device->pending_event != EVDEV_RELATIVE_MOTION)
|
|
|
|
|
evdev_flush_pending_event(device, time);
|
2013-11-10 17:55:40 +01:00
|
|
|
device->rel.dy += li_fixed_from_int(e->value);
|
2013-09-24 12:09:03 +01:00
|
|
|
device->pending_event = EVDEV_RELATIVE_MOTION;
|
2011-09-01 19:00:03 +03:00
|
|
|
break;
|
2012-03-22 10:47:01 -06:00
|
|
|
case REL_WHEEL:
|
2013-09-24 12:09:03 +01:00
|
|
|
evdev_flush_pending_event(device, time);
|
2012-10-03 22:56:58 +02:00
|
|
|
switch (e->value) {
|
|
|
|
|
case -1:
|
|
|
|
|
/* Scroll down */
|
|
|
|
|
case 1:
|
|
|
|
|
/* Scroll up */
|
2013-11-10 17:55:40 +01:00
|
|
|
pointer_notify_axis(
|
|
|
|
|
base,
|
|
|
|
|
time,
|
|
|
|
|
LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL,
|
|
|
|
|
-1 * e->value * DEFAULT_AXIS_STEP_DISTANCE);
|
2012-10-03 22:56:58 +02:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2012-03-22 10:47:01 -06:00
|
|
|
break;
|
|
|
|
|
case REL_HWHEEL:
|
2013-09-24 12:09:03 +01:00
|
|
|
evdev_flush_pending_event(device, time);
|
2012-10-03 22:56:58 +02:00
|
|
|
switch (e->value) {
|
|
|
|
|
case -1:
|
|
|
|
|
/* Scroll left */
|
|
|
|
|
case 1:
|
|
|
|
|
/* Scroll right */
|
2013-11-10 17:55:40 +01:00
|
|
|
pointer_notify_axis(
|
|
|
|
|
base,
|
|
|
|
|
time,
|
|
|
|
|
LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL,
|
|
|
|
|
e->value * DEFAULT_AXIS_STEP_DISTANCE);
|
2012-10-03 22:56:58 +02:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
2011-09-01 19:00:03 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-21 19:34:09 +02:00
|
|
|
static inline void
|
2013-09-24 12:09:03 +01:00
|
|
|
evdev_process_absolute(struct evdev_device *device,
|
|
|
|
|
struct input_event *e,
|
|
|
|
|
uint32_t time)
|
2011-12-21 19:34:09 +02:00
|
|
|
{
|
2012-05-17 12:18:17 +02:00
|
|
|
if (device->is_mt) {
|
2013-09-24 12:09:03 +01:00
|
|
|
evdev_process_touch(device, e, time);
|
2011-12-21 19:34:09 +02:00
|
|
|
} else {
|
2011-12-21 22:18:36 -05:00
|
|
|
evdev_process_absolute_motion(device, e);
|
2011-12-21 19:34:09 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-17 12:18:16 +02:00
|
|
|
static void
|
|
|
|
|
fallback_process(struct evdev_dispatch *dispatch,
|
2012-08-06 14:57:08 +03:00
|
|
|
struct evdev_device *device,
|
2012-05-17 12:18:16 +02:00
|
|
|
struct input_event *event,
|
|
|
|
|
uint32_t time)
|
|
|
|
|
{
|
|
|
|
|
switch (event->type) {
|
|
|
|
|
case EV_REL:
|
|
|
|
|
evdev_process_relative(device, event, time);
|
|
|
|
|
break;
|
|
|
|
|
case EV_ABS:
|
2013-09-24 12:09:03 +01:00
|
|
|
evdev_process_absolute(device, event, time);
|
2012-05-17 12:18:16 +02:00
|
|
|
break;
|
|
|
|
|
case EV_KEY:
|
|
|
|
|
evdev_process_key(device, event, time);
|
|
|
|
|
break;
|
2013-02-27 15:26:23 -05:00
|
|
|
case EV_SYN:
|
2013-09-24 12:09:03 +01:00
|
|
|
evdev_flush_pending_event(device, time);
|
2013-02-27 15:26:23 -05:00
|
|
|
break;
|
2012-05-17 12:18:16 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
fallback_destroy(struct evdev_dispatch *dispatch)
|
|
|
|
|
{
|
|
|
|
|
free(dispatch);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct evdev_dispatch_interface fallback_interface = {
|
|
|
|
|
fallback_process,
|
|
|
|
|
fallback_destroy
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static struct evdev_dispatch *
|
|
|
|
|
fallback_dispatch_create(void)
|
|
|
|
|
{
|
|
|
|
|
struct evdev_dispatch *dispatch = malloc(sizeof *dispatch);
|
|
|
|
|
if (dispatch == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
dispatch->interface = &fallback_interface;
|
|
|
|
|
|
|
|
|
|
return dispatch;
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-20 19:52:57 -04:00
|
|
|
static void
|
2012-08-06 14:57:08 +03:00
|
|
|
evdev_process_events(struct evdev_device *device,
|
2012-03-20 19:52:57 -04:00
|
|
|
struct input_event *ev, int count)
|
2011-01-14 14:45:42 -05:00
|
|
|
{
|
2012-05-17 12:18:16 +02:00
|
|
|
struct evdev_dispatch *dispatch = device->dispatch;
|
2012-03-20 19:52:57 -04:00
|
|
|
struct input_event *e, *end;
|
2011-12-02 06:39:02 -05:00
|
|
|
uint32_t time = 0;
|
2011-01-14 14:45:42 -05:00
|
|
|
|
|
|
|
|
e = ev;
|
2012-03-20 19:52:57 -04:00
|
|
|
end = e + count;
|
2011-01-14 14:45:42 -05:00
|
|
|
for (e = ev; e < end; e++) {
|
|
|
|
|
time = e->time.tv_sec * 1000 + e->time.tv_usec / 1000;
|
|
|
|
|
|
2012-05-17 12:18:16 +02:00
|
|
|
dispatch->interface->process(dispatch, device, e, time);
|
2011-01-14 14:45:42 -05:00
|
|
|
}
|
2012-03-20 19:52:57 -04:00
|
|
|
}
|
|
|
|
|
|
2013-11-17 11:19:50 +01:00
|
|
|
static void
|
|
|
|
|
evdev_device_dispatch(void *data)
|
2012-03-20 19:52:57 -04:00
|
|
|
{
|
2013-11-17 11:19:50 +01:00
|
|
|
struct evdev_device *device = data;
|
2013-11-10 17:55:40 +01:00
|
|
|
int fd = device->fd;
|
2012-03-20 19:52:57 -04:00
|
|
|
struct input_event ev[32];
|
|
|
|
|
int len;
|
|
|
|
|
|
|
|
|
|
/* If the compositor is repainting, this function is called only once
|
|
|
|
|
* per frame and we have to process all the events available on the
|
|
|
|
|
* fd, otherwise there will be input lag. */
|
|
|
|
|
do {
|
|
|
|
|
if (device->mtdev)
|
|
|
|
|
len = mtdev_get(device->mtdev, fd, ev,
|
|
|
|
|
ARRAY_LENGTH(ev)) *
|
|
|
|
|
sizeof (struct input_event);
|
|
|
|
|
else
|
|
|
|
|
len = read(fd, &ev, sizeof ev);
|
|
|
|
|
|
|
|
|
|
if (len < 0 || len % sizeof ev[0] != 0) {
|
2013-10-15 14:29:56 +02:00
|
|
|
if (len < 0 && errno != EAGAIN && errno != EINTR) {
|
2013-11-17 11:19:50 +01:00
|
|
|
libinput_remove_source(device->base.libinput,
|
|
|
|
|
device->source);
|
|
|
|
|
device->source = NULL;
|
2013-10-15 14:29:56 +02:00
|
|
|
}
|
|
|
|
|
|
2013-11-17 11:19:50 +01:00
|
|
|
return;
|
2012-03-20 19:52:57 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
evdev_process_events(device, ev, len / sizeof ev[0]);
|
|
|
|
|
|
|
|
|
|
} while (len > 0);
|
2011-01-14 14:45:42 -05:00
|
|
|
}
|
|
|
|
|
|
2011-08-19 17:07:40 +03:00
|
|
|
static int
|
2013-02-16 14:29:24 -05:00
|
|
|
evdev_handle_device(struct evdev_device *device)
|
2011-08-19 15:06:20 +03:00
|
|
|
{
|
|
|
|
|
struct input_absinfo absinfo;
|
|
|
|
|
unsigned long ev_bits[NBITS(EV_MAX)];
|
|
|
|
|
unsigned long abs_bits[NBITS(ABS_MAX)];
|
2012-05-30 16:31:48 +01:00
|
|
|
unsigned long rel_bits[NBITS(REL_MAX)];
|
2011-08-19 15:06:20 +03:00
|
|
|
unsigned long key_bits[NBITS(KEY_MAX)];
|
2011-08-19 17:07:40 +03:00
|
|
|
int has_key, has_abs;
|
2012-05-30 16:31:48 +01:00
|
|
|
unsigned int i;
|
2011-08-19 17:07:40 +03:00
|
|
|
|
|
|
|
|
has_key = 0;
|
|
|
|
|
has_abs = 0;
|
2012-05-30 16:31:48 +01:00
|
|
|
device->caps = 0;
|
2011-08-19 15:06:20 +03:00
|
|
|
|
|
|
|
|
ioctl(device->fd, EVIOCGBIT(0, sizeof(ev_bits)), ev_bits);
|
|
|
|
|
if (TEST_BIT(ev_bits, EV_ABS)) {
|
2011-08-19 17:07:40 +03:00
|
|
|
has_abs = 1;
|
2011-11-21 16:39:55 +02:00
|
|
|
|
2011-08-19 15:06:20 +03:00
|
|
|
ioctl(device->fd, EVIOCGBIT(EV_ABS, sizeof(abs_bits)),
|
|
|
|
|
abs_bits);
|
2013-08-13 14:55:39 -07:00
|
|
|
|
|
|
|
|
if (TEST_BIT(abs_bits, ABS_WHEEL) ||
|
|
|
|
|
TEST_BIT(abs_bits, ABS_GAS) ||
|
|
|
|
|
TEST_BIT(abs_bits, ABS_BRAKE) ||
|
|
|
|
|
TEST_BIT(abs_bits, ABS_HAT0X)) {
|
2013-11-10 17:55:40 +01:00
|
|
|
/* Device %s is a joystick, ignoring. */
|
2013-08-13 14:55:39 -07:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-19 15:06:20 +03:00
|
|
|
if (TEST_BIT(abs_bits, ABS_X)) {
|
|
|
|
|
ioctl(device->fd, EVIOCGABS(ABS_X), &absinfo);
|
2011-11-21 16:39:55 +02:00
|
|
|
device->abs.min_x = absinfo.minimum;
|
|
|
|
|
device->abs.max_x = absinfo.maximum;
|
2012-05-30 16:31:48 +01:00
|
|
|
device->caps |= EVDEV_MOTION_ABS;
|
2011-08-19 15:06:20 +03:00
|
|
|
}
|
|
|
|
|
if (TEST_BIT(abs_bits, ABS_Y)) {
|
|
|
|
|
ioctl(device->fd, EVIOCGABS(ABS_Y), &absinfo);
|
2011-11-21 16:39:55 +02:00
|
|
|
device->abs.min_y = absinfo.minimum;
|
|
|
|
|
device->abs.max_y = absinfo.maximum;
|
2012-05-30 16:31:48 +01:00
|
|
|
device->caps |= EVDEV_MOTION_ABS;
|
2011-08-19 15:06:20 +03:00
|
|
|
}
|
2013-08-08 12:03:08 +10:00
|
|
|
/* We only handle the slotted Protocol B in weston.
|
|
|
|
|
Devices with ABS_MT_POSITION_* but not ABS_MT_SLOT
|
|
|
|
|
require mtdev for conversion. */
|
|
|
|
|
if (TEST_BIT(abs_bits, ABS_MT_POSITION_X) &&
|
|
|
|
|
TEST_BIT(abs_bits, ABS_MT_POSITION_Y)) {
|
2012-07-31 13:21:07 +03:00
|
|
|
ioctl(device->fd, EVIOCGABS(ABS_MT_POSITION_X),
|
|
|
|
|
&absinfo);
|
|
|
|
|
device->abs.min_x = absinfo.minimum;
|
|
|
|
|
device->abs.max_x = absinfo.maximum;
|
|
|
|
|
ioctl(device->fd, EVIOCGABS(ABS_MT_POSITION_Y),
|
|
|
|
|
&absinfo);
|
|
|
|
|
device->abs.min_y = absinfo.minimum;
|
|
|
|
|
device->abs.max_y = absinfo.maximum;
|
2011-12-21 19:34:09 +02:00
|
|
|
device->is_mt = 1;
|
2012-05-30 16:31:48 +01:00
|
|
|
device->caps |= EVDEV_TOUCH;
|
2013-08-07 11:04:45 +10:00
|
|
|
|
|
|
|
|
if (!TEST_BIT(abs_bits, ABS_MT_SLOT)) {
|
|
|
|
|
device->mtdev = mtdev_new_open(device->fd);
|
|
|
|
|
if (!device->mtdev) {
|
2013-11-10 17:55:40 +01:00
|
|
|
/* mtdev required but failed to open. */
|
2013-08-07 11:04:45 +10:00
|
|
|
return 0;
|
|
|
|
|
}
|
2013-08-07 11:04:46 +10:00
|
|
|
device->mt.slot = device->mtdev->caps.slot.value;
|
|
|
|
|
} else {
|
|
|
|
|
ioctl(device->fd, EVIOCGABS(ABS_MT_SLOT),
|
|
|
|
|
&absinfo);
|
|
|
|
|
device->mt.slot = absinfo.value;
|
2013-08-07 11:04:45 +10:00
|
|
|
}
|
2011-12-21 19:34:09 +02:00
|
|
|
}
|
2011-08-19 15:06:20 +03:00
|
|
|
}
|
2012-05-30 16:31:48 +01:00
|
|
|
if (TEST_BIT(ev_bits, EV_REL)) {
|
|
|
|
|
ioctl(device->fd, EVIOCGBIT(EV_REL, sizeof(rel_bits)),
|
|
|
|
|
rel_bits);
|
|
|
|
|
if (TEST_BIT(rel_bits, REL_X) || TEST_BIT(rel_bits, REL_Y))
|
|
|
|
|
device->caps |= EVDEV_MOTION_REL;
|
|
|
|
|
}
|
2011-08-19 15:06:20 +03:00
|
|
|
if (TEST_BIT(ev_bits, EV_KEY)) {
|
2011-08-19 17:07:40 +03:00
|
|
|
has_key = 1;
|
2011-08-19 15:06:20 +03:00
|
|
|
ioctl(device->fd, EVIOCGBIT(EV_KEY, sizeof(key_bits)),
|
|
|
|
|
key_bits);
|
|
|
|
|
if (TEST_BIT(key_bits, BTN_TOOL_FINGER) &&
|
2012-05-17 12:18:17 +02:00
|
|
|
!TEST_BIT(key_bits, BTN_TOOL_PEN) &&
|
2013-08-07 11:04:49 +10:00
|
|
|
has_abs) {
|
2012-05-17 12:18:17 +02:00
|
|
|
device->dispatch = evdev_touchpad_create(device);
|
2013-08-07 11:04:49 +10:00
|
|
|
}
|
2012-05-30 16:31:48 +01:00
|
|
|
for (i = KEY_ESC; i < KEY_MAX; i++) {
|
|
|
|
|
if (i >= BTN_MISC && i < KEY_OK)
|
|
|
|
|
continue;
|
|
|
|
|
if (TEST_BIT(key_bits, i)) {
|
|
|
|
|
device->caps |= EVDEV_KEYBOARD;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-10-14 15:46:13 -07:00
|
|
|
if (TEST_BIT(key_bits, BTN_TOUCH)) {
|
|
|
|
|
device->caps |= EVDEV_TOUCH;
|
|
|
|
|
}
|
2013-10-14 15:28:01 -07:00
|
|
|
for (i = BTN_MISC; i < BTN_JOYSTICK; i++) {
|
2012-05-30 16:31:48 +01:00
|
|
|
if (TEST_BIT(key_bits, i)) {
|
|
|
|
|
device->caps |= EVDEV_BUTTON;
|
2013-10-14 15:46:13 -07:00
|
|
|
device->caps &= ~EVDEV_TOUCH;
|
2012-05-30 16:31:48 +01:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-08-19 15:06:20 +03:00
|
|
|
}
|
2012-06-01 12:13:59 +01:00
|
|
|
if (TEST_BIT(ev_bits, EV_LED)) {
|
|
|
|
|
device->caps |= EVDEV_KEYBOARD;
|
|
|
|
|
}
|
2011-08-19 17:07:40 +03:00
|
|
|
|
|
|
|
|
/* This rule tries to catch accelerometer devices and opt out. We may
|
|
|
|
|
* want to adjust the protocol later adding a proper event for dealing
|
|
|
|
|
* with accelerometers and implement here accordingly */
|
2012-08-03 14:39:07 +03:00
|
|
|
if (has_abs && !has_key && !device->is_mt) {
|
2013-02-16 14:29:24 -05:00
|
|
|
return 0;
|
2012-08-03 14:39:07 +03:00
|
|
|
}
|
2011-08-19 17:07:40 +03:00
|
|
|
|
2013-02-16 14:29:24 -05:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
evdev_configure_device(struct evdev_device *device)
|
|
|
|
|
{
|
2013-10-14 15:32:08 -07:00
|
|
|
if ((device->caps & (EVDEV_MOTION_ABS | EVDEV_MOTION_REL)) &&
|
|
|
|
|
(device->caps & EVDEV_BUTTON)) {
|
2013-11-17 16:59:09 +01:00
|
|
|
device_register_capability(&device->base,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_POINTER);
|
2013-11-13 22:11:34 +01:00
|
|
|
device->seat_caps |= EVDEV_DEVICE_POINTER;
|
2012-08-03 14:39:07 +03:00
|
|
|
}
|
|
|
|
|
if ((device->caps & EVDEV_KEYBOARD)) {
|
2013-11-17 16:59:09 +01:00
|
|
|
device_register_capability(&device->base,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_KEYBOARD);
|
2013-11-13 22:11:34 +01:00
|
|
|
device->seat_caps |= EVDEV_DEVICE_KEYBOARD;
|
2012-08-03 14:39:07 +03:00
|
|
|
}
|
|
|
|
|
if ((device->caps & EVDEV_TOUCH)) {
|
2013-11-17 16:59:09 +01:00
|
|
|
device_register_capability(&device->base,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_TOUCH);
|
2013-11-13 22:11:34 +01:00
|
|
|
device->seat_caps |= EVDEV_DEVICE_TOUCH;
|
2012-08-03 14:39:07 +03:00
|
|
|
}
|
2012-05-30 16:32:02 +01:00
|
|
|
|
2011-08-19 17:07:40 +03:00
|
|
|
return 0;
|
2011-08-19 15:06:20 +03:00
|
|
|
}
|
|
|
|
|
|
2013-11-10 17:55:40 +01:00
|
|
|
LIBINPUT_EXPORT struct libinput_device *
|
|
|
|
|
libinput_device_create_evdev(
|
2013-11-17 11:19:50 +01:00
|
|
|
struct libinput *libinput,
|
2013-11-10 17:55:40 +01:00
|
|
|
const char *devnode,
|
|
|
|
|
int fd,
|
|
|
|
|
const struct libinput_device_interface *device_interface,
|
|
|
|
|
void *user_data)
|
2011-01-14 14:45:42 -05:00
|
|
|
{
|
2012-08-06 14:57:08 +03:00
|
|
|
struct evdev_device *device;
|
2012-08-03 14:39:07 +03:00
|
|
|
char devname[256] = "unknown";
|
2011-01-14 14:45:42 -05:00
|
|
|
|
2013-08-08 11:57:05 +10:00
|
|
|
device = zalloc(sizeof *device);
|
2011-01-14 14:45:42 -05:00
|
|
|
if (device == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2013-11-17 11:19:50 +01:00
|
|
|
device->base.libinput = libinput;
|
2013-11-10 17:55:40 +01:00
|
|
|
device->base.device_interface = device_interface;
|
|
|
|
|
device->base.device_interface_data = user_data;
|
2011-09-01 13:25:50 -04:00
|
|
|
|
2013-10-17 23:04:05 +02:00
|
|
|
device->seat_caps = 0;
|
2011-12-21 19:34:09 +02:00
|
|
|
device->is_mt = 0;
|
2012-03-16 17:33:03 -03:00
|
|
|
device->mtdev = NULL;
|
2013-11-10 17:55:40 +01:00
|
|
|
device->devnode = strdup(devnode);
|
2011-12-21 22:18:36 -05:00
|
|
|
device->mt.slot = -1;
|
|
|
|
|
device->rel.dx = 0;
|
|
|
|
|
device->rel.dy = 0;
|
2012-05-17 12:18:16 +02:00
|
|
|
device->dispatch = NULL;
|
2013-11-10 17:55:40 +01:00
|
|
|
device->fd = fd;
|
2013-09-24 12:09:03 +01:00
|
|
|
device->pending_event = EVDEV_NONE;
|
2011-01-14 14:45:42 -05:00
|
|
|
|
2012-08-03 14:39:07 +03:00
|
|
|
ioctl(device->fd, EVIOCGNAME(sizeof(devname)), devname);
|
2013-08-07 11:04:41 +10:00
|
|
|
devname[sizeof(devname) - 1] = '\0';
|
2012-08-03 14:39:07 +03:00
|
|
|
device->devname = strdup(devname);
|
|
|
|
|
|
2013-02-16 14:29:24 -05:00
|
|
|
if (!evdev_handle_device(device)) {
|
2013-08-07 11:04:48 +10:00
|
|
|
evdev_device_destroy(device);
|
2013-11-10 17:55:40 +01:00
|
|
|
return NULL;
|
2013-02-16 14:29:24 -05:00
|
|
|
}
|
|
|
|
|
|
2011-10-28 13:15:25 -04:00
|
|
|
if (evdev_configure_device(device) == -1)
|
2013-08-07 11:04:48 +10:00
|
|
|
goto err;
|
2011-01-14 14:49:46 -05:00
|
|
|
|
2012-05-17 12:18:16 +02:00
|
|
|
/* If the dispatch was not set up use the fallback. */
|
|
|
|
|
if (device->dispatch == NULL)
|
|
|
|
|
device->dispatch = fallback_dispatch_create();
|
|
|
|
|
if (device->dispatch == NULL)
|
2013-08-07 11:04:48 +10:00
|
|
|
goto err;
|
2012-05-17 12:18:16 +02:00
|
|
|
|
2013-11-17 11:19:50 +01:00
|
|
|
device->source =
|
|
|
|
|
libinput_add_fd(libinput, fd, evdev_device_dispatch, device);
|
|
|
|
|
if (!device->source)
|
|
|
|
|
goto err;
|
|
|
|
|
|
2013-11-10 17:55:40 +01:00
|
|
|
return &device->base;
|
2011-10-28 13:15:25 -04:00
|
|
|
|
2013-08-07 11:04:48 +10:00
|
|
|
err:
|
|
|
|
|
evdev_device_destroy(device);
|
2011-10-28 13:15:25 -04:00
|
|
|
return NULL;
|
2011-01-14 14:45:42 -05:00
|
|
|
}
|
|
|
|
|
|
2013-11-10 17:55:40 +01:00
|
|
|
int
|
|
|
|
|
evdev_device_get_keys(struct evdev_device *device, char *keys, size_t size)
|
|
|
|
|
{
|
|
|
|
|
memset(keys, 0, size);
|
|
|
|
|
return ioctl(device->fd, EVIOCGKEY(size), keys);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
evdev_device_calibrate(struct evdev_device *device, float calibration[6])
|
|
|
|
|
{
|
|
|
|
|
device->abs.apply_calibration = 1;
|
|
|
|
|
memcpy(device->abs.calibration, calibration, sizeof calibration);
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-03 14:39:05 +03:00
|
|
|
void
|
2013-11-17 16:59:09 +01:00
|
|
|
evdev_device_terminate(struct evdev_device *device)
|
2012-08-03 14:38:57 +03:00
|
|
|
{
|
2013-11-13 22:11:34 +01:00
|
|
|
if (device->seat_caps & EVDEV_DEVICE_POINTER) {
|
2013-11-17 16:59:09 +01:00
|
|
|
device_unregister_capability(&device->base,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_POINTER);
|
2013-11-10 17:55:40 +01:00
|
|
|
}
|
2013-11-13 22:11:34 +01:00
|
|
|
if (device->seat_caps & EVDEV_DEVICE_KEYBOARD) {
|
2013-11-17 16:59:09 +01:00
|
|
|
device_unregister_capability(&device->base,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_KEYBOARD);
|
2013-11-10 17:55:40 +01:00
|
|
|
}
|
2013-11-13 22:11:34 +01:00
|
|
|
if (device->seat_caps & EVDEV_DEVICE_TOUCH) {
|
2013-11-17 16:59:09 +01:00
|
|
|
device_unregister_capability(&device->base,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_TOUCH);
|
2013-11-10 17:55:40 +01:00
|
|
|
}
|
2013-11-17 16:59:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
evdev_device_destroy(struct evdev_device *device)
|
|
|
|
|
{
|
|
|
|
|
struct evdev_dispatch *dispatch;
|
2013-10-17 23:04:05 +02:00
|
|
|
|
2012-08-03 14:38:57 +03:00
|
|
|
dispatch = device->dispatch;
|
|
|
|
|
if (dispatch)
|
|
|
|
|
dispatch->interface->destroy(dispatch);
|
|
|
|
|
|
|
|
|
|
if (device->mtdev)
|
|
|
|
|
mtdev_close_delete(device->mtdev);
|
|
|
|
|
close(device->fd);
|
2012-08-03 14:39:07 +03:00
|
|
|
free(device->devname);
|
2012-08-03 14:38:57 +03:00
|
|
|
free(device->devnode);
|
|
|
|
|
free(device);
|
|
|
|
|
}
|