ckb-next  v0.2.8 at branch master
ckb-next driver for corsair devices
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
devnode.h
Go to the documentation of this file.
1 #ifndef DEVNODE_H
2 #define DEVNODE_H
3 
4 #include "includes.h"
5 #include "usb.h"
6 
8 const char *const devpath;
9 
11 extern long gid;
12 
13 // Simple file permissions
14 #define S_READDIR (S_IRWXU | S_IRGRP | S_IROTH | S_IXGRP | S_IXOTH)
15 #define S_READ (S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR)
16 #define S_READWRITE (S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IWOTH)
17 #define S_CUSTOM (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP)
18 #define S_CUSTOM_R (S_IRUSR | S_IWUSR | S_IRGRP)
19 
21 void updateconnected();
22 
24 int mkdevpath(usbdevice* kb);
25 
27 int rmdevpath(usbdevice* kb);
28 
30 int mknotifynode(usbdevice* kb, int notify);
31 
33 int rmnotifynode(usbdevice* kb, int notify);
34 
36 int mkfwnode(usbdevice* kb);
37 
39 typedef struct _readlines_ctx* readlines_ctx;
40 void readlines_ctx_init(readlines_ctx* ctx);
41 void readlines_ctx_free(readlines_ctx ctx);
42 unsigned readlines(int fd, readlines_ctx ctx, const char** input);
43 
44 #endif // DEVNODE_H
int rmdevpath(usbdevice *kb)
Remove the dev path for the keyboard at index. Returns 0 on success.
Definition: devnode.c:275
void updateconnected()
Update the list of connected devices.
Definition: devnode.c:81
struct _readlines_ctx * readlines_ctx
Custom readline is needed for FIFOs. fopen()/getline() will die if the data is sent in too fast...
Definition: devnode.h:39
void readlines_ctx_free(readlines_ctx ctx)
Definition: devnode.c:348
int rmnotifynode(usbdevice *kb, int notify)
Removes a notification node for the specified keyboard.
Definition: devnode.c:129
long gid
Group ID for the control nodes. -1 to give read/write access to everybody.
Definition: devnode.c:16
int mkdevpath(usbdevice *kb)
Create a dev path for the keyboard at index. Returns 0 on success.
Definition: devnode.c:268
int mknotifynode(usbdevice *kb, int notify)
Creates a notification node for the specified keyboard.
Definition: devnode.c:108
void readlines_ctx_init(readlines_ctx *ctx)
Definition: devnode.c:341
unsigned readlines(int fd, readlines_ctx ctx, const char **input)
Definition: devnode.c:353
Definitions for using USB interface.
const char *const devpath
Device path base ("/dev/input/ckb" or "/var/run/ckb")
Definition: devnode.h:8
int mkfwnode(usbdevice *kb)
Writes a keyboard's firmware version and poll rate to its device node.
Definition: devnode.c:299