diff --git a/firmware/Makefile b/firmware/Makefile index 9bdfe66..660cad2 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -21,6 +21,7 @@ clean: rm -f obj/*.bin rm -f obj/*.map rm -f obj/*.o + rm -f test deploy: dfu-util -d 0471:df55 -c 0 -t 2048 -R -D /usr/local/LPCXpresso/bin/LPCXpressoWIN.enc || : @@ -30,4 +31,4 @@ deploy: crt_emu_lpc11_13_nxp -g -2 -pLPC1343 -wire=winusb -flash-load=obj/$(NAME).axf test: test.c - gcc test.c -o test -lusb-1.0 + gcc test.c -o test -lusb-1.0 -Wall -Werror diff --git a/firmware/test.c b/firmware/test.c index 1983d6f..7c94f38 100644 --- a/firmware/test.c +++ b/firmware/test.c @@ -30,10 +30,6 @@ static const int PRODUCT_ID = 0x0003; // Values for bmRequestType in the Setup transaction's Data packet. -static const int CONTROL_REQUEST_TYPE_IN = LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE; -static const int CONTROL_REQUEST_TYPE_OUT = LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE; - -static const int CONTROL_ENDPOINT_PACKET_SIZE = 16; static const int INTERRUPT_ENDPOINT_PACKET_SIZE = 16; static const int INTERFACE_NUMBER = 0; @@ -43,14 +39,6 @@ static const int INTERRUPT_IN_ENDPOINT = 0x81; static const int INTERRUPT_OUT_ENDPOINT = 0x01; static const int TIMEOUT_MS = 5000; -// From the HID spec: - -static const int HID_GET_REPORT = 0x01; -static const int HID_SET_REPORT = 0x01; -static const int HID_REPORT_TYPE_INPUT = 0x01; -static const int HID_REPORT_TYPE_OUTPUT = 0x02; -static const int HID_REPORT_TYPE_FEATURE = 0x03; - int exchange_input_and_output_reports_via_interrupt_transfers(libusb_device_handle *devh); int main(void) @@ -120,8 +108,8 @@ int main(void) int exchange_input_and_output_reports_via_interrupt_transfers(libusb_device_handle *devh) { int bytes_transferred; - char data_in[INTERRUPT_ENDPOINT_PACKET_SIZE-1]; - char data_out[INTERRUPT_ENDPOINT_PACKET_SIZE-1]; + unsigned char data_in[INTERRUPT_ENDPOINT_PACKET_SIZE-1]; + unsigned char data_out[INTERRUPT_ENDPOINT_PACKET_SIZE-1]; int i = 0;; int result = 0;; @@ -144,7 +132,7 @@ int exchange_input_and_output_reports_via_interrupt_transfers(libusb_device_hand if (result >= 0) { printf("Output report data sent via interrupt transfer:\n"); - for(i = 0; i < CONTROL_ENDPOINT_PACKET_SIZE; i++) + for(i = 0; i < INTERRUPT_ENDPOINT_PACKET_SIZE; i++) { printf("%02x ",data_out[i]); } @@ -165,7 +153,7 @@ int exchange_input_and_output_reports_via_interrupt_transfers(libusb_device_hand if (bytes_transferred == INTERRUPT_ENDPOINT_PACKET_SIZE) { printf("Input report received via interrupt transfer:\n"); - for(i = 0; i < CONTROL_ENDPOINT_PACKET_SIZE; i++) + for(i = 0; i < INTERRUPT_ENDPOINT_PACKET_SIZE; i++) { printf("%02x ",data_in[i]); }