Skip to content

Commit

Permalink
Fixed warnings & useless dependency
Browse files Browse the repository at this point in the history
Removed dependency on libexplain that got introduced in the last patch (fixes #2)
Worked around an uber strict warning about return value of write() not being used when fortify is enabled (fixes #3)
  • Loading branch information
janoc committed Oct 9, 2015
1 parent d2bef01 commit 503d592
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2015-10-09 Jan Ciger <jan.ciger (at) gmail.com>
* 0.7
- fixed dependency on libexplain that sneaked in in the last version (thanks @techwolf)
- fixed two ueber-strict warnings about return values from write() (thanks @techwolf)

2014-10-20 Jan Ciger <jan.ciger (at) gmail.com>
* 0.6
- merged patch from Ricky Curtice (http://rwcproductions.com/)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CFLAGS=-pipe
CFLAGS=-pipe -Wall -Wunused-result

libndofdev.a: ndofdev.o
$(AR) -r $@ $<
Expand Down
9 changes: 5 additions & 4 deletions ndofdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ int ndof_init_first(NDOF_Device *in_out_dev, void *param)
// Get the actual number of axes for this device.
if (ioctl(fd, EVIOCGBIT(EV_REL, sizeof evtype_mask), evtype_mask) >= 0)
{
printf("getting axis count...\n");
axes_count = 0;

unsigned int index = 0;
Expand All @@ -156,7 +155,7 @@ int ndof_init_first(NDOF_Device *in_out_dev, void *param)
axes_count += (evtype_mask[idx] & (1 << bit)) > 0;
}
} else {
fprintf(stderr, "%s\n", explain_ioctl(fd, EVIOCGBIT(EV_REL, sizeof evtype_mask), evtype_mask));
perror("Failed to obtain the number of axes for device:\n");
}


Expand All @@ -183,7 +182,8 @@ int ndof_init_first(NDOF_Device *in_out_dev, void *param)
led_ev.type = EV_LED;
led_ev.code = LED_MISC;
led_ev.value = 1;
write(spacenav_fd, &led_ev, sizeof(struct input_event));
if(write(spacenav_fd, &led_ev, sizeof(struct input_event)) < 0)
perror("Failed to write LED_ON command:\n");

return 0;

Expand Down Expand Up @@ -226,7 +226,8 @@ void ndof_libcleanup()
led_ev.type = EV_LED;
led_ev.code = LED_MISC;
led_ev.value = 0;
write(spacenav_fd, &led_ev, sizeof(struct input_event));
if(write(spacenav_fd, &led_ev, sizeof(struct input_event)) < 0)
perror("Failed to write LED_OFF command:\n");
}

// FIXME: needs to cleanup the memory
Expand Down

1 comment on commit 503d592

@cnd
Copy link

@cnd cnd commented on 503d592 Oct 10, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Please sign in to comment.