Generic cleanup
This commit is contained in:
@ -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
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user