-void get_rgb(char* param){
- uint16_t buffer[3];
- int cnt;
- cnt = usb_control_msg(handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, CUSTOM_RQ_GET_RGB, 0, 0, (char*)buffer, 6, 5000);
- if(cnt!=6){
- fprintf(stderr, "ERROR: received %d bytes from device while expecting %d bytes\n", cnt, 6);
- exit(1);
+void press_button(char* param){
+ usb_control_msg(handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, CUSTOM_RQ_PRESS_BUTTON, 0, 0, NULL, 0, 5000);
+}
+
+void set_dbg(char *hex_string){
+ uint8_t buffer[(strlen(hex_string) + 1) / 2];
+ size_t i = 0, length = 0;
+ int8_t t;
+
+ memset(buffer, 0, (strlen(hex_string) + 1) / 2);
+
+ while (hex_string[i]) {
+ t = hex_to_int(hex_string[i]);
+ if (t == -1){
+ break;
+ }
+ if (i & 1) {
+ buffer[length++] |= t;
+ } else {
+ buffer[length] |= t << 4;
+ }