ckb-next
v0.2.8 at branch master
ckb-next driver for corsair devices
|
#include "os.h"
#include <ctype.h>
#include <dirent.h>
#include <fcntl.h>
#include <iconv.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/signal.h>
#include <sys/stat.h>
#include <sys/time.h>
#include "structures.h"
Go to the source code of this file.
Macros | |
#define | INDEX_OF(entry, array) (int)(entry - array) |
#define | ckb_s_out stdout |
#define | ckb_s_err stdout |
#define | __FILE_NOPATH__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) |
#define | ckb_fatal_nofile(fmt, args...) fprintf(ckb_s_err, "[F] " fmt, ## args) |
#define | ckb_fatal_fn(fmt, file, line, args...) fprintf(ckb_s_err, "[F] %s (via %s:%d): " fmt, __func__, file, line, ## args) |
#define | ckb_fatal(fmt, args...) fprintf(ckb_s_err, "[F] %s (%s:%d): " fmt, __func__, __FILE_NOPATH__, __LINE__, ## args) |
#define | ckb_err_nofile(fmt, args...) fprintf(ckb_s_err, "[E] " fmt, ## args) |
#define | ckb_err_fn(fmt, file, line, args...) fprintf(ckb_s_err, "[E] %s (via %s:%d): " fmt, __func__, file, line, ## args) |
#define | ckb_err(fmt, args...) fprintf(ckb_s_err, "[E] %s (%s:%d): " fmt, __func__, __FILE_NOPATH__, __LINE__, ## args) |
#define | ckb_warn_nofile(fmt, args...) fprintf(ckb_s_out, "[W] " fmt, ## args) |
#define | ckb_warn_fn(fmt, file, line, args...) fprintf(ckb_s_out, "[W] %s (via %s:%d): " fmt, __func__, file, line, ## args) |
#define | ckb_warn(fmt, args...) fprintf(ckb_s_out, "[W] %s (%s:%d): " fmt, __func__, __FILE_NOPATH__, __LINE__, ## args) |
#define | ckb_info_nofile(fmt, args...) fprintf(ckb_s_out, "[I] " fmt, ## args) |
#define | ckb_info_fn(fmt, file, line, args...) fprintf(ckb_s_out, "[I] " fmt, ## args) |
#define | ckb_info(fmt, args...) fprintf(ckb_s_out, "[I] " fmt, ## args) |
#define | timespec_gt(left, right) ((left).tv_sec > (right).tv_sec || ((left).tv_sec == (right).tv_sec && (left).tv_nsec > (right).tv_nsec)) |
#define | timespec_eq(left, right) ((left).tv_sec == (right).tv_sec && (left).tv_nsec == (right).tv_nsec) |
#define | timespec_ge(left, right) ((left).tv_sec > (right).tv_sec || ((left).tv_sec == (right).tv_sec && (left).tv_nsec >= (right).tv_nsec)) |
#define | timespec_lt(left, right) (!timespec_ge(left, right)) |
#define | timespec_le(left, right) (!timespec_gt(left, right)) |
Typedefs | |
typedef unsigned char | uchar |
typedef unsigned short | ushort |
Functions | |
void | timespec_add (struct timespec *timespec, long nanoseconds) |
#define __FILE_NOPATH__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) |
Definition at line 40 of file includes.h.
#define ckb_err | ( | fmt, | |
args... | |||
) | fprintf(ckb_s_err, "[E] %s (%s:%d): " fmt, __func__, __FILE_NOPATH__, __LINE__, ## args) |
Definition at line 49 of file includes.h.
Referenced by _mkdevpath(), fwupdate(), getfwversion(), loaddpi(), loadrgb_kb(), loadrgb_mouse(), macro_pt_dequeue(), os_inputmain(), os_sendindicators(), os_setupusb(), restart(), setupusb(), uinputopen(), usb_tryreset(), usbadd(), and usbclaim().
#define ckb_err_fn | ( | fmt, | |
file, | |||
line, | |||
args... | |||
) | fprintf(ckb_s_err, "[E] %s (via %s:%d): " fmt, __func__, file, line, ## args) |
Definition at line 48 of file includes.h.
Referenced by _nk95cmd(), _usbrecv(), os_usbrecv(), and os_usbsend().
#define ckb_err_nofile | ( | fmt, | |
args... | |||
) | fprintf(ckb_s_err, "[E] " fmt, ## args) |
Definition at line 47 of file includes.h.
#define ckb_fatal | ( | fmt, | |
args... | |||
) | fprintf(ckb_s_err, "[F] %s (%s:%d): " fmt, __func__, __FILE_NOPATH__, __LINE__, ## args) |
Definition at line 46 of file includes.h.
Referenced by usbmain().
#define ckb_fatal_fn | ( | fmt, | |
file, | |||
line, | |||
args... | |||
) | fprintf(ckb_s_err, "[F] %s (via %s:%d): " fmt, __func__, file, line, ## args) |
Definition at line 45 of file includes.h.
#define ckb_fatal_nofile | ( | fmt, | |
args... | |||
) | fprintf(ckb_s_err, "[F] " fmt, ## args) |
Definition at line 44 of file includes.h.
Referenced by main().
#define ckb_info | ( | fmt, | |
args... | |||
) | fprintf(ckb_s_out, "[I] " fmt, ## args) |
Definition at line 55 of file includes.h.
Referenced by _setupusb(), _start_dev(), closeusb(), cmd_restart(), fwupdate(), os_inputmain(), os_setupusb(), rmdevpath(), usb_tryreset(), usbadd(), and usbclaim().
#define ckb_info_fn | ( | fmt, | |
file, | |||
line, | |||
args... | |||
) | fprintf(ckb_s_out, "[I] " fmt, ## args) |
Definition at line 54 of file includes.h.
#define ckb_info_nofile | ( | fmt, | |
args... | |||
) | fprintf(ckb_s_out, "[I] " fmt, ## args) |
Definition at line 53 of file includes.h.
Referenced by main().
#define ckb_s_err stdout |
Definition at line 36 of file includes.h.
#define ckb_s_out stdout |
Definition at line 35 of file includes.h.
#define ckb_warn | ( | fmt, | |
args... | |||
) | fprintf(ckb_s_out, "[W] %s (%s:%d): " fmt, __func__, __FILE_NOPATH__, __LINE__, ## args) |
Definition at line 52 of file includes.h.
Referenced by _mkdevpath(), _mknotifynode(), _start_dev(), _updateconnected(), getfwversion(), hid_kb_translate(), isync(), mkfwnode(), os_inputclose(), os_keypress(), os_mousemove(), readlines(), rmdevpath(), uinputopen(), and usbmain().
#define ckb_warn_fn | ( | fmt, | |
file, | |||
line, | |||
args... | |||
) | fprintf(ckb_s_out, "[W] %s (via %s:%d): " fmt, __func__, file, line, ## args) |
Definition at line 51 of file includes.h.
Referenced by os_usbrecv(), and os_usbsend().
#define ckb_warn_nofile | ( | fmt, | |
args... | |||
) | fprintf(ckb_s_out, "[W] " fmt, ## args) |
Definition at line 50 of file includes.h.
Referenced by main().
#define INDEX_OF | ( | entry, | |
array | |||
) | (int)(entry - array) |
Definition at line 27 of file includes.h.
Referenced by _mkdevpath(), _mknotifynode(), _rmnotifynode(), _setupusb(), closeusb(), mkfwnode(), nprintf(), os_closeusb(), os_inputmain(), os_inputopen(), os_setupusb(), readcmd(), and rmdevpath().
#define timespec_eq | ( | left, | |
right | |||
) | ((left).tv_sec == (right).tv_sec && (left).tv_nsec == (right).tv_nsec) |
Definition at line 60 of file includes.h.
#define timespec_ge | ( | left, | |
right | |||
) | ((left).tv_sec > (right).tv_sec || ((left).tv_sec == (right).tv_sec && (left).tv_nsec >= (right).tv_nsec)) |
Definition at line 61 of file includes.h.
#define timespec_gt | ( | left, | |
right | |||
) | ((left).tv_sec > (right).tv_sec || ((left).tv_sec == (right).tv_sec && (left).tv_nsec > (right).tv_nsec)) |
Definition at line 59 of file includes.h.
#define timespec_le | ( | left, | |
right | |||
) | (!timespec_gt(left, right)) |
Definition at line 63 of file includes.h.
#define timespec_lt | ( | left, | |
right | |||
) | (!timespec_ge(left, right)) |
Definition at line 62 of file includes.h.
typedef unsigned char uchar |
Definition at line 24 of file includes.h.
typedef unsigned short ushort |
Definition at line 25 of file includes.h.