Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixes for my system #1

Merged
merged 3 commits into from

2 participants

@vi
vi commented

Tried this with my virtual touchscreen and browser plugin - it works.

But there are issues, which I tried to fix.

@olivopaolo olivopaolo merged commit e1e7378 into olivopaolo:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 2, 2012
  1. @vi

    Fix compilation on my system (Debian Wheezy...)

    vi authored
    I'm not sure if it is the right fix.
  2. @vi

    Add .gitignore

    vi authored
Commits on Mar 3, 2012
  1. @vi

    Use select instead of spinning fd in tight loop

    vi authored
    Original version consumes 100% CPU
This page is out of date. Refresh to see the latest.
Showing with 19 additions and 3 deletions.
  1. +2 −0  .gitignore
  2. +17 −3 mtdev2tuio.c
View
2  .gitignore
@@ -0,0 +1,2 @@
+mtdev2tuio
+*.o
View
20 mtdev2tuio.c
@@ -143,7 +143,7 @@ static void send_tuio(struct state_t *s, struct device_t *d) {
// sent bundle
if (lo_send_bundle(s->tuioaddr, bundle) == -1)
printf("OSC error %d: %s\n", lo_address_errno(s->tuioaddr), lo_address_errstr(s->tuioaddr));
- lo_bundle_free_messages(bundle) ;
+ lo_bundle_free(bundle) ;
}
static void process_event(struct state_t *s, struct device_t *d, const struct input_event *ev) {
@@ -271,9 +271,23 @@ int main(int argc, char *argv[]) {
// process all available events
while (1) {
- while (mtdev_get(&device.dev, device.fd, &ev, 1) > 0) {
- process_event(&state, &device, &ev);
+ fd_set rfds;
+ FD_ZERO(&rfds);
+ FD_SET(device.fd, &rfds);
+
+ int retval = select(device.fd+1, &rfds, NULL, NULL, NULL);
+
+ if(retval<0) {
+ perror("select");
+ return 1;
}
+
+ if(FD_ISSET(device.fd, &rfds)) {
+ while (mtdev_get(&device.dev, device.fd, &ev, 1) > 0) {
+ process_event(&state, &device, &ev);
+ }
+ }
+
}
return 0;
}
Something went wrong with that request. Please try again.