Generic cleanup
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
Jens True 2019-04-01 10:45:25 +02:00
parent 4fe12dfc27
commit 1ded64275f
2 changed files with 8 additions and 7 deletions

@ -1,3 +1,4 @@
[![Build Status](https://build.jcktrue.dk/api/badges/jct/ledcontroller-3bit/status.svg)](https://build.jcktrue.dk/jct/ledcontroller-3bit)
# ledcontroller-3bit # # ledcontroller-3bit #
A Linux command line utility to control usb mail notifiers identified as: A Linux command line utility to control usb mail notifiers identified as:
@ -27,9 +28,8 @@ For example the script `mled-cputemp` will make it respond to your CPU's tempera
$ sudo rm /usr/bin/ledcontroller $ sudo rm /usr/bin/ledcontroller
### Have fun: ### ### Have fun ###
Take a look inside the _scripts_ directory.
## Requisites: ## ## Requisites: ##

11
main.c

@ -97,22 +97,22 @@ int main(int argc, char **argv)
} else if (strcmp(argv[1], "white") == 0) { } else if (strcmp(argv[1], "white") == 0) {
code = 7; code = 7;
} else { } else {
printf("invalid color\n"); puts("Invalid color");
return -1; return -1;
} }
libusb_init(NULL); libusb_init(NULL);
devh = libusb_open_device_with_vid_pid(NULL, VID, PID); devh = libusb_open_device_with_vid_pid(NULL, VID, PID);
if (devh == NULL) { if (devh == NULL) {
printf("not found\n"); puts("Device not found");
return -1; return -1;
} }
if (libusb_kernel_driver_active(devh, 0)) { if (libusb_kernel_driver_active(devh, 0)) {
printf("detach from kernel\n"); puts("Detach driver from kernel");
ret = libusb_detach_kernel_driver(devh, 0); ret = libusb_detach_kernel_driver(devh, 0);
if (ret < 0) { if (ret < 0) {
printf("can't detach\n"); puts("Could not detach driver");
return -1; return -1;
} }
} }
@ -128,7 +128,8 @@ int main(int argc, char **argv)
libusb_claim_interface(devh, 0); libusb_claim_interface(devh, 0);
ret = libusb_interrupt_transfer(devh, 0x2, data, 5, &dummy, 0); ret = libusb_interrupt_transfer(devh, 0x2, data, 5, &dummy, 0);
if (ret < 0) { if (ret < 0) {
perror("error"); perror("libusb error");
return -1;
} }