-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathqlight.h
More file actions
53 lines (47 loc) · 1.06 KB
/
qlight.h
File metadata and controls
53 lines (47 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* Q-Light USB driver v0.0.4
Written by Kenneth Wilke */
#include <libusb-1.0/libusb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
// Function Prototypes
void usage();
void parse_option(int *target, char *option, int lightopt);
void handle_arguments(int argc, char *argv[]);
void init();
void usb_release(void);
void quit(int exitCode);
int set_state(int red, int yellow, int green, int blue, int white, int sound);
// Globals
libusb_context *context;
libusb_device_handle *qlight_handle;
unsigned char *data_template = (unsigned char*) "\x57\x00\x64\x64\x64\x64\x64\x64\x40\x00\x54\xf3\x00\x00\x00\x00";
int red, yellow, blue, green, white, sound;
enum
{ // data index
qlight_red = 2,
qlight_yellow,
qlight_green,
qlight_blue,
qlight_white,
qlight_sound
};
enum
{ // light states
light_off = 0,
light_on,
light_blink,
light_nochange = 0x64
};
enum
{ // sound states
sound_off = 0,
/* these are device speciic */
sound_fire,
sound_emergency,
sound_ambulance,
sound_pipipi,
sound_pi_continue,
sound_nochange = 0x64
};