Commit 0907768ba5280aad723293f507e4c06348a1eef9

Authored by henyxia
1 parent 3679f03b

Displaying some color

Showing 1 changed file with 22 additions and 4 deletions   Show diff stats
1 #include <stdio.h> 1 #include <stdio.h>
2 #include <stdbool.h> 2 #include <stdbool.h>
  3 +#include <unistd.h>
3 #include <libusb-1.0/libusb.h> 4 #include <libusb-1.0/libusb.h>
4 5
5 -#define VENDOR_ID 0xfccf  
6 -#define PRODUCT_ID 0xa001 6 +#define VENDOR_ID 0xfccf
  7 +#define PRODUCT_ID 0xa001
  8 +#define ENDPOINT_OUT 0x01
  9 +#define MAX_SIZE_OUT 64
  10 +
  11 +libusb_device_handle* screenHandle;
7 12
8 bool initUI(void) 13 bool initUI(void)
9 { 14 {
10 int ret; 15 int ret;
11 16
12 - libusb_device_handle* screenHandle;  
13 -  
14 ret = libusb_init(NULL); 17 ret = libusb_init(NULL);
15 if(ret != 0) 18 if(ret != 0)
16 { 19 {
@@ -96,8 +99,23 @@ bool initUI(void) @@ -96,8 +99,23 @@ bool initUI(void)
96 99
97 int main(void) 100 int main(void)
98 { 101 {
  102 + int transfered;
  103 +
99 if(!initUI()) 104 if(!initUI())
  105 + {
100 printf("Unable to initialize the UI\n"); 106 printf("Unable to initialize the UI\n");
  107 + return 1;
  108 + }
  109 +
  110 + printf("Screen Initialized\n");
  111 +
  112 + sleep(2);
  113 +
  114 + printf("Sending command\n");
  115 +
  116 + //libusb_bulk_transfer(screenHandle, ENDPOINT_OUT, data, MAX_SIZE_OUT, &transfered, 0);
  117 + unsigned char data[] = {0x81, 0x07, 0xFF};
  118 + libusb_bulk_transfer(screenHandle, ENDPOINT_OUT, data, 3, &transfered, 0);
101 119
102 return 0; 120 return 0;
103 } 121 }