diff options
Diffstat (limited to 'src/mtouch.c')
| -rw-r--r-- | src/mtouch.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/mtouch.c b/src/mtouch.c index ad077b7..959783a 100644 --- a/src/mtouch.c +++ b/src/mtouch.c | |||
| @@ -33,9 +33,9 @@ int configure_mtouch(struct MTouch *mt, int fd) | |||
| 33 | int open_mtouch(struct MTouch *mt, int fd) | 33 | int open_mtouch(struct MTouch *mt, int fd) |
| 34 | { | 34 | { |
| 35 | int rc; | 35 | int rc; |
| 36 | mtdev_init(&mt->dev, &mt->caps); | ||
| 36 | init_iobuf(&mt->buf); | 37 | init_iobuf(&mt->buf); |
| 37 | init_hwdata(&mt->hw); | 38 | init_hwstate(&mt->hs, &mt->caps); |
| 38 | init_hwstate(&mt->hs); | ||
| 39 | init_mtstate(&mt->prev_state); | 39 | init_mtstate(&mt->prev_state); |
| 40 | init_mtstate(&mt->state); | 40 | init_mtstate(&mt->state); |
| 41 | init_memory(&mt->mem); | 41 | init_memory(&mt->mem); |
| @@ -50,18 +50,11 @@ int close_mtouch(struct MTouch *mt, int fd) | |||
| 50 | return rc; | 50 | return rc; |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | int read_synchronized_event(struct MTouch *mt, int fd) | 53 | int parse_event(struct MTouch *mt, const struct input_event *ev) |
| 54 | { | 54 | { |
| 55 | const struct input_event *ev; | 55 | mtdev_push(&mt->dev, &mt->caps, ev); |
| 56 | while (ev = get_iobuf_event(&mt->buf, fd)) | 56 | if (!modify_hwstate(&mt->hs, &mt->dev, &mt->caps)) |
| 57 | if (read_hwdata(&mt->hw, ev)) | 57 | return 0; |
| 58 | return 1; | ||
| 59 | return 0; | ||
| 60 | } | ||
| 61 | |||
| 62 | void parse_event(struct MTouch *mt) | ||
| 63 | { | ||
| 64 | modify_hwstate(&mt->hs, &mt->hw, &mt->caps); | ||
| 65 | extract_mtstate(&mt->state, &mt->hs, &mt->caps); | 58 | extract_mtstate(&mt->state, &mt->hs, &mt->caps); |
| 66 | #if 0 | 59 | #if 0 |
| 67 | output_mtstate(&mt->state); | 60 | output_mtstate(&mt->state); |
| @@ -70,4 +63,5 @@ void parse_event(struct MTouch *mt) | |||
| 70 | #if 0 | 63 | #if 0 |
| 71 | output_memory(&mt->mem); | 64 | output_memory(&mt->mem); |
| 72 | #endif | 65 | #endif |
| 66 | return 1; | ||
| 73 | } | 67 | } |
