Added error message for invalid color
This commit is contained in:
3
Dockerfile
Normal file
3
Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM gcc
|
||||
COPY . .
|
||||
RUN apt-get -y update && apt-get -y install libusb-1.0 && make
|
2
Makefile
2
Makefile
@ -3,7 +3,7 @@
|
||||
all: ledcontroller
|
||||
|
||||
ledcontroller: main.c
|
||||
gcc -o $@ $^ `pkg-config libusb-1.0 --cflags --libs`
|
||||
gcc -o $@ $^ `pkg-config libusb-1.0 --cflags --libs`
|
||||
|
||||
clean:
|
||||
rm ledcontroller
|
||||
|
5
main.c
5
main.c
@ -43,7 +43,7 @@
|
||||
#include <stdio.h>
|
||||
#include <libusb.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define VID 0x1294
|
||||
#define PID 0x1320
|
||||
@ -108,6 +108,9 @@ int main(int argc,char** argv)
|
||||
else if ( strcmp(argv[1],"white") == 0 )
|
||||
{
|
||||
code = 7;
|
||||
} else {
|
||||
printf("invalid color\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
libusb_init(NULL);
|
||||
|
Reference in New Issue
Block a user