mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2025-12-23 23:37:48 -05:00
Remove OpenRazer/OpenRazer-Win32 support as it is unmaintained and replaced by RazerController
This commit is contained in:
@@ -74,7 +74,6 @@ CODEOWNERS @Calcprogrammer1
|
||||
/Controllers/NZXTHue2Controller/
|
||||
/Controllers/NZXTHuePlusController/
|
||||
/Controllers/NZXTKrakenController/
|
||||
/Controllers/OpenRazerController/
|
||||
/Controllers/PNYGPUController/
|
||||
/Controllers/PatriotViperController/
|
||||
/Controllers/PhilipsHueController/
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
#include "Detector.h"
|
||||
#include "LogManager.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_OpenRazer.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectOpenRazerControllers *
|
||||
* *
|
||||
* Detect devices supported by the OpenRazer kernel drivers *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectOpenRazerControllers()
|
||||
{
|
||||
char driver_path[512];
|
||||
DIR *dir;
|
||||
struct dirent *ent;
|
||||
bool done = false;
|
||||
int driver_to_read = 0;
|
||||
|
||||
while(driver_to_read < 8)
|
||||
{
|
||||
switch(driver_to_read)
|
||||
{
|
||||
case 0:
|
||||
strcpy(driver_path, "/sys/bus/hid/drivers/razerkbd/");
|
||||
break;
|
||||
|
||||
case 1:
|
||||
strcpy(driver_path, "/sys/bus/hid/drivers/razermouse/");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
strcpy(driver_path, "/sys/bus/hid/drivers/razerfirefly/");
|
||||
break;
|
||||
|
||||
case 3:
|
||||
strcpy(driver_path, "/sys/bus/hid/drivers/razermug/");
|
||||
break;
|
||||
|
||||
case 4:
|
||||
strcpy(driver_path, "/sys/bus/hid/drivers/razercore/");
|
||||
break;
|
||||
|
||||
case 5:
|
||||
strcpy(driver_path, "/sys/bus/hid/drivers/razerkraken/");
|
||||
break;
|
||||
|
||||
case 6:
|
||||
strcpy(driver_path, "/sys/bus/hid/drivers/razermousemat/");
|
||||
break;
|
||||
|
||||
case 7:
|
||||
strcpy(driver_path, "/sys/bus/hid/drivers/razeraccessory/");
|
||||
break;
|
||||
}
|
||||
|
||||
done = false;
|
||||
|
||||
dir = opendir(driver_path);
|
||||
|
||||
LOG_DEBUG("[OpenRazer] Folder %s is %s", driver_path, (dir == NULL)?"not found":"found look for driver..." );
|
||||
|
||||
if(dir == NULL)
|
||||
{
|
||||
driver_to_read++;
|
||||
continue;
|
||||
}
|
||||
|
||||
ent = readdir(dir);
|
||||
|
||||
while(ent != NULL)
|
||||
{
|
||||
if(ent->d_type == DT_DIR || ent->d_type == DT_LNK)
|
||||
{
|
||||
if(!strcmp(ent->d_name, "."))
|
||||
{
|
||||
if(done == false)
|
||||
{
|
||||
done = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(!strcmp(ent->d_name, "..") || !strcmp(ent->d_name, "module"))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
char device_string[1024];
|
||||
strcpy(device_string, driver_path);
|
||||
strcat(device_string, ent->d_name);
|
||||
|
||||
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(device_string);
|
||||
|
||||
if(razer_rgb->device_index != -1)
|
||||
{
|
||||
ResourceManager::get()->RegisterRGBController(razer_rgb);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DEBUG("[OpenRazer] Device index is not -1 delete controller");
|
||||
delete razer_rgb;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ent = readdir(dir);
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
|
||||
driver_to_read++;
|
||||
}
|
||||
|
||||
} /* DetectOpenRazerControllers() */
|
||||
|
||||
REGISTER_DETECTOR("OpenRazer", DetectOpenRazerControllers);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,293 +0,0 @@
|
||||
#include "Detector.h"
|
||||
#include "LogManager.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_OpenRazerWindows.h"
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <Windows.h>
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/hid.h>
|
||||
|
||||
#ifdef _WIN64
|
||||
#define OPENRAZERDLL "OpenRazer64.dll"
|
||||
#elif WIN32
|
||||
#define OPENRAZERDLL "OpenRazer.dll"
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct device_attribute* dev_attr_list[44];
|
||||
} device_fn_list_type;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| This is a table of device attribute names. It should |
|
||||
| always match the order of the entries in the structure |
|
||||
\*---------------------------------------------------------*/
|
||||
static const char* device_fn_names[] =
|
||||
{
|
||||
"device_type",
|
||||
"device_serial",
|
||||
"firmware_version",
|
||||
|
||||
"matrix_custom_frame",
|
||||
"matrix_brightness",
|
||||
|
||||
"matrix_effect_custom",
|
||||
"matrix_effect_none",
|
||||
"matrix_effect_static",
|
||||
"matrix_effect_breath",
|
||||
"matrix_effect_spectrum",
|
||||
"matrix_effect_reactive",
|
||||
"matrix_effect_wave",
|
||||
|
||||
"logo_led_brightness",
|
||||
"logo_matrix_effect_none",
|
||||
"logo_matrix_effect_static",
|
||||
"logo_matrix_effect_breath",
|
||||
"logo_matrix_effect_spectrum",
|
||||
"logo_matrix_effect_reactive",
|
||||
|
||||
"scroll_led_brightness",
|
||||
"scroll_matrix_effect_none",
|
||||
"scroll_matrix_effect_static",
|
||||
"scroll_matrix_effect_breath",
|
||||
"scroll_matrix_effect_spectrum",
|
||||
"scroll_matrix_effect_reactive",
|
||||
|
||||
"left_led_brightness",
|
||||
"left_matrix_effect_none",
|
||||
"left_matrix_effect_static",
|
||||
"left_matrix_effect_breath",
|
||||
"left_matrix_effect_spectrum",
|
||||
"left_matrix_effect_reactive",
|
||||
"left_matrix_effect_wave",
|
||||
|
||||
"right_led_brightness",
|
||||
"right_matrix_effect_none",
|
||||
"right_matrix_effect_static",
|
||||
"right_matrix_effect_breath",
|
||||
"right_matrix_effect_spectrum",
|
||||
"right_matrix_effect_reactive",
|
||||
"right_matrix_effect_wave",
|
||||
|
||||
"logo_led_effect",
|
||||
"logo_led_rgb",
|
||||
"logo_led_state",
|
||||
|
||||
"scroll_led_effect",
|
||||
"scroll_led_rgb",
|
||||
"scroll_led_state"
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| This function searches the device attribute list of a |
|
||||
| given device to fill in a device_fn_type structure |
|
||||
\*---------------------------------------------------------*/
|
||||
static void load_device_fn(device_fn_type* device_fn, device* dev)
|
||||
{
|
||||
memset(device_fn, 0, sizeof(device_fn_type));
|
||||
|
||||
for (int table_idx = 0; table_idx < 44; table_idx++)
|
||||
{
|
||||
for (int list_idx = 0; list_idx < dev->attr_count; list_idx++)
|
||||
{
|
||||
if (strcmp(device_fn_names[table_idx], dev->attr_list[list_idx]->name) == 0)
|
||||
{
|
||||
((device_fn_list_type*)device_fn)->dev_attr_list[table_idx] = dev->attr_list[list_idx];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectOpenRazerControllers *
|
||||
* *
|
||||
* Detect devices supported by the OpenRazer kernel drivers *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
void DetectOpenRazerControllers()
|
||||
{
|
||||
static HMODULE module = LoadLibrary(OPENRAZERDLL);
|
||||
|
||||
LOG_DEBUG("[OpenRazerWindows] The %s is %s", OPENRAZERDLL, (module == nullptr)?"not found":"found" );
|
||||
|
||||
if(module == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Map DLL functions |
|
||||
\*---------------------------------------------------------*/
|
||||
typedef unsigned int(*INITRAZERDRIVER)(struct hid_device** hdev);
|
||||
|
||||
INITRAZERDRIVER init_razer_kbd_driver = reinterpret_cast<INITRAZERDRIVER>(GetProcAddress(module, "init_razer_kbd_driver"));
|
||||
INITRAZERDRIVER init_razer_mousemat_driver = reinterpret_cast<INITRAZERDRIVER>(GetProcAddress(module, "init_razer_mousemat_driver"));
|
||||
INITRAZERDRIVER init_razer_mouse_driver = reinterpret_cast<INITRAZERDRIVER>(GetProcAddress(module, "init_razer_mouse_driver"));
|
||||
INITRAZERDRIVER init_razer_accessory_driver = reinterpret_cast<INITRAZERDRIVER>(GetProcAddress(module, "init_razer_accessory_driver"));
|
||||
INITRAZERDRIVER init_razer_kraken_driver = reinterpret_cast<INITRAZERDRIVER>(GetProcAddress(module, "init_razer_kraken_driver"));
|
||||
INITRAZERDRIVER init_razer_core_driver = reinterpret_cast<INITRAZERDRIVER>(GetProcAddress(module, "init_razer_core_driver"));
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Initialize all OpenRazer driver modules and store devices |
|
||||
\*---------------------------------------------------------*/
|
||||
struct hid_device* hdev;
|
||||
unsigned int num;
|
||||
|
||||
if(init_razer_kbd_driver != NULL)
|
||||
{
|
||||
hdev = NULL;
|
||||
num = init_razer_kbd_driver(&hdev);
|
||||
for (unsigned int i = 0; i < num; i++)
|
||||
{
|
||||
if (hdev[i].dev.attr_count < 1) continue;
|
||||
|
||||
device_fn_type* device_fn = new device_fn_type;
|
||||
load_device_fn(device_fn, &hdev[i].dev);
|
||||
|
||||
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(&hdev[i].dev, device_fn);
|
||||
|
||||
if(razer_rgb->device_index != -1)
|
||||
{
|
||||
ResourceManager::get()->RegisterRGBController(razer_rgb);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete razer_rgb;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(init_razer_mouse_driver != NULL)
|
||||
{
|
||||
hdev = NULL;
|
||||
num = init_razer_mouse_driver(&hdev);
|
||||
for (unsigned int i = 0; i < num; i++)
|
||||
{
|
||||
if (hdev[i].dev.attr_count < 1) continue;
|
||||
|
||||
device_fn_type* device_fn = new device_fn_type;
|
||||
load_device_fn(device_fn, &hdev[i].dev);
|
||||
|
||||
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(&hdev[i].dev, device_fn);
|
||||
|
||||
if(razer_rgb->device_index != -1)
|
||||
{
|
||||
ResourceManager::get()->RegisterRGBController(razer_rgb);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DEBUG("[OpenRazerWindows] Device index is not -1 delete controller");
|
||||
delete razer_rgb;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(init_razer_mousemat_driver != NULL)
|
||||
{
|
||||
hdev = NULL;
|
||||
num = init_razer_mousemat_driver(&hdev);
|
||||
for (unsigned int i = 0; i < num; i++)
|
||||
{
|
||||
if (hdev[i].dev.attr_count < 1) continue;
|
||||
|
||||
device_fn_type* device_fn = new device_fn_type;
|
||||
load_device_fn(device_fn, &hdev[i].dev);
|
||||
|
||||
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(&hdev[i].dev, device_fn);
|
||||
|
||||
if(razer_rgb->device_index != -1)
|
||||
{
|
||||
ResourceManager::get()->RegisterRGBController(razer_rgb);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DEBUG("[OpenRazerWindows] Device index is not -1 delete controller");
|
||||
delete razer_rgb;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(init_razer_accessory_driver != NULL)
|
||||
{
|
||||
hdev = NULL;
|
||||
num = init_razer_accessory_driver(&hdev);
|
||||
for (unsigned int i = 0; i < num; i++)
|
||||
{
|
||||
if (hdev[i].dev.attr_count < 1) continue;
|
||||
|
||||
device_fn_type* device_fn = new device_fn_type;
|
||||
load_device_fn(device_fn, &hdev[i].dev);
|
||||
|
||||
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(&hdev[i].dev, device_fn);
|
||||
|
||||
if(razer_rgb->device_index != -1)
|
||||
{
|
||||
ResourceManager::get()->RegisterRGBController(razer_rgb);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DEBUG("[OpenRazerWindows] Device index is not -1 delete controller");
|
||||
delete razer_rgb;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(init_razer_kraken_driver != NULL)
|
||||
{
|
||||
hdev = NULL;
|
||||
num = init_razer_kraken_driver(&hdev);
|
||||
for (unsigned int i = 0; i < num; i++)
|
||||
{
|
||||
if (hdev[i].dev.attr_count < 1) continue;
|
||||
|
||||
device_fn_type* device_fn = new device_fn_type;
|
||||
load_device_fn(device_fn, &hdev[i].dev);
|
||||
|
||||
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(&hdev[i].dev, device_fn);
|
||||
|
||||
if(razer_rgb->device_index != -1)
|
||||
{
|
||||
ResourceManager::get()->RegisterRGBController(razer_rgb);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DEBUG("[OpenRazerWindows] Device index is not -1 delete controller");
|
||||
delete razer_rgb;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(init_razer_core_driver != NULL)
|
||||
{
|
||||
hdev = NULL;
|
||||
num = init_razer_core_driver(&hdev);
|
||||
for (unsigned int i = 0; i < num; i++)
|
||||
{
|
||||
if (hdev[i].dev.attr_count < 1) continue;
|
||||
|
||||
device_fn_type* device_fn = new device_fn_type;
|
||||
load_device_fn(device_fn, &hdev[i].dev);
|
||||
|
||||
RGBController_OpenRazer * razer_rgb = new RGBController_OpenRazer(&hdev[i].dev, device_fn);
|
||||
|
||||
if(razer_rgb->device_index != -1)
|
||||
{
|
||||
ResourceManager::get()->RegisterRGBController(razer_rgb);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DEBUG("[OpenRazerWindows] Device index is not -1 delete controller");
|
||||
delete razer_rgb;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} /* DetectOpenRazerControllers() */
|
||||
|
||||
REGISTER_DETECTOR("OpenRazer-Win32", DetectOpenRazerControllers);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,124 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_OpenRazer.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRazer |
|
||||
| kernel drivers for Chroma peripherals |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/15/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
class RGBController_OpenRazer : public RGBController
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
OPEN_RAZER_MODE_CUSTOM,
|
||||
OPEN_RAZER_MODE_OFF,
|
||||
OPEN_RAZER_MODE_STATIC,
|
||||
OPEN_RAZER_MODE_BREATHING,
|
||||
OPEN_RAZER_MODE_SPECTRUM_CYCLE,
|
||||
OPEN_RAZER_MODE_WAVE,
|
||||
OPEN_RAZER_MODE_REACTIVE,
|
||||
OPEN_RAZER_MODE_FLASHING,
|
||||
OPEN_RAZER_NUM_MODES
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
OPEN_RAZER_TYPE_MATRIX_FRAME,
|
||||
OPEN_RAZER_TYPE_MATRIX_NOFRAME,
|
||||
OPEN_RAZER_TYPE_MATRIX_STATIC,
|
||||
OPEN_RAZER_TYPE_NOMATRIX,
|
||||
OPEN_RAZER_NUM_TYPES
|
||||
};
|
||||
|
||||
public:
|
||||
RGBController_OpenRazer(std::string dev_path);
|
||||
~RGBController_OpenRazer();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
int device_index;
|
||||
|
||||
private:
|
||||
void SetupMatrixDevice(unsigned int rows, unsigned int cols);
|
||||
void SetupNonMatrixDevice();
|
||||
|
||||
unsigned int matrix_type;
|
||||
unsigned int matrix_rows;
|
||||
unsigned int matrix_cols;
|
||||
|
||||
void OpenFunctions(std::string dev_path);
|
||||
|
||||
std::ifstream device_type;
|
||||
std::ifstream device_serial;
|
||||
std::ifstream firmware_version;
|
||||
|
||||
std::ofstream matrix_custom_frame;
|
||||
std::ofstream matrix_brightness;
|
||||
|
||||
std::ofstream matrix_effect_custom;
|
||||
std::ofstream matrix_effect_none;
|
||||
std::ofstream matrix_effect_static;
|
||||
std::ofstream matrix_effect_breath;
|
||||
std::ofstream matrix_effect_spectrum;
|
||||
std::ofstream matrix_effect_reactive;
|
||||
std::ofstream matrix_effect_wave;
|
||||
|
||||
std::ofstream logo_led_brightness;
|
||||
std::ofstream logo_matrix_effect_none;
|
||||
std::ofstream logo_matrix_effect_static;
|
||||
std::ofstream logo_matrix_effect_breath;
|
||||
std::ofstream logo_matrix_effect_spectrum;
|
||||
std::ofstream logo_matrix_effect_reactive;
|
||||
|
||||
std::ofstream scroll_led_brightness;
|
||||
std::ofstream scroll_matrix_effect_none;
|
||||
std::ofstream scroll_matrix_effect_static;
|
||||
std::ofstream scroll_matrix_effect_breath;
|
||||
std::ofstream scroll_matrix_effect_spectrum;
|
||||
std::ofstream scroll_matrix_effect_reactive;
|
||||
|
||||
std::ofstream left_led_brightness;
|
||||
std::ofstream left_matrix_effect_none;
|
||||
std::ofstream left_matrix_effect_static;
|
||||
std::ofstream left_matrix_effect_breath;
|
||||
std::ofstream left_matrix_effect_spectrum;
|
||||
std::ofstream left_matrix_effect_reactive;
|
||||
std::ofstream left_matrix_effect_wave;
|
||||
|
||||
std::ofstream right_led_brightness;
|
||||
std::ofstream right_matrix_effect_none;
|
||||
std::ofstream right_matrix_effect_static;
|
||||
std::ofstream right_matrix_effect_breath;
|
||||
std::ofstream right_matrix_effect_spectrum;
|
||||
std::ofstream right_matrix_effect_reactive;
|
||||
std::ofstream right_matrix_effect_wave;
|
||||
|
||||
std::ofstream backlight_led_effect;
|
||||
std::ofstream backlight_led_rgb;
|
||||
std::ofstream backlight_led_state;
|
||||
|
||||
std::ofstream logo_led_effect;
|
||||
std::ofstream logo_led_rgb;
|
||||
std::ofstream logo_led_state;
|
||||
|
||||
std::ofstream scroll_led_effect;
|
||||
std::ofstream scroll_led_rgb;
|
||||
std::ofstream scroll_led_state;
|
||||
};
|
||||
@@ -1,965 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_OpenRazer.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRazer |
|
||||
| kernel drivers for Chroma peripherals |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/15/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_OpenRazerWindows.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <string.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/hid.h>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
void RGBController_OpenRazer::DeviceUpdateLEDs()
|
||||
{
|
||||
switch(matrix_type)
|
||||
{
|
||||
case OPEN_RAZER_TYPE_MATRIX_FRAME:
|
||||
case OPEN_RAZER_TYPE_MATRIX_NOFRAME:
|
||||
case OPEN_RAZER_TYPE_MATRIX_STATIC:
|
||||
{
|
||||
char update_value = 1;
|
||||
|
||||
for (unsigned int row = 0; row < matrix_rows; row++)
|
||||
{
|
||||
unsigned int output_array_size;
|
||||
unsigned int output_offset;
|
||||
unsigned int row_offset = (row * matrix_cols);
|
||||
|
||||
if(matrix_type == OPEN_RAZER_TYPE_MATRIX_FRAME)
|
||||
{
|
||||
output_array_size = 3 + (matrix_cols* 3);
|
||||
output_offset = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
output_array_size = 3;
|
||||
output_offset = 0;
|
||||
}
|
||||
|
||||
char* output_array = new char[output_array_size];
|
||||
|
||||
if(matrix_type == OPEN_RAZER_TYPE_MATRIX_FRAME)
|
||||
{
|
||||
output_array[0] = row;
|
||||
output_array[1] = 0;
|
||||
output_array[2] = matrix_cols - 1;
|
||||
}
|
||||
|
||||
for(unsigned int col = 0; col < matrix_cols; col++)
|
||||
{
|
||||
unsigned int color_idx = col + row_offset;
|
||||
output_array[(col * 3) + 0 + output_offset] = (char)RGBGetRValue(colors[color_idx]);
|
||||
output_array[(col * 3) + 1 + output_offset] = (char)RGBGetGValue(colors[color_idx]);
|
||||
output_array[(col * 3) + 2 + output_offset] = (char)RGBGetBValue(colors[color_idx]);
|
||||
}
|
||||
|
||||
if(matrix_type == OPEN_RAZER_TYPE_MATRIX_FRAME)
|
||||
{
|
||||
open_razer_functions->matrix_custom_frame->store(open_razer_device, NULL, output_array, output_array_size);
|
||||
}
|
||||
else if(matrix_type == OPEN_RAZER_TYPE_MATRIX_NOFRAME)
|
||||
{
|
||||
open_razer_functions->matrix_effect_custom->store(open_razer_device, NULL, output_array, output_array_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
open_razer_functions->matrix_effect_static->store(open_razer_device, NULL, output_array, output_array_size);
|
||||
}
|
||||
|
||||
delete[] output_array;
|
||||
|
||||
std::this_thread::sleep_for(1ms);
|
||||
}
|
||||
|
||||
if(matrix_type == OPEN_RAZER_TYPE_MATRIX_FRAME)
|
||||
{
|
||||
open_razer_functions->matrix_effect_custom->store(open_razer_device, NULL, &update_value, 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case OPEN_RAZER_TYPE_NOMATRIX:
|
||||
{
|
||||
DeviceUpdateMode();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::SetupMatrixDevice(device_fn_type* open_razer_functions, unsigned int rows, unsigned int cols)
|
||||
{
|
||||
if(!open_razer_functions->matrix_custom_frame)
|
||||
{
|
||||
if(!open_razer_functions->matrix_effect_custom)
|
||||
{
|
||||
matrix_type = OPEN_RAZER_TYPE_MATRIX_STATIC;
|
||||
}
|
||||
else
|
||||
{
|
||||
matrix_type = OPEN_RAZER_TYPE_MATRIX_NOFRAME;
|
||||
}
|
||||
|
||||
matrix_rows = 1;
|
||||
matrix_cols = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
matrix_type = OPEN_RAZER_TYPE_MATRIX_FRAME;
|
||||
|
||||
matrix_rows = rows;
|
||||
matrix_cols = cols;
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::SetupNonMatrixDevice()
|
||||
{
|
||||
matrix_type = OPEN_RAZER_TYPE_NOMATRIX;
|
||||
}
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Openrazer Windows
|
||||
@category Keyboard,Mouse,Mousemat,HeadsetStand
|
||||
@type USB
|
||||
@save :x:
|
||||
@direct :white_check_mark:
|
||||
@effects :white_check_mark:
|
||||
@detectors DetectOpenRazerControllers
|
||||
@comment The Openrazer controller has been deprecated in favour of
|
||||
the in built Razer controller.
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
RGBController_OpenRazer::RGBController_OpenRazer(device * open_razer_device, device_fn_type* open_razer_functions)
|
||||
{
|
||||
char string_buf[1024];
|
||||
|
||||
this->open_razer_device = open_razer_device;
|
||||
this->open_razer_functions = open_razer_functions;
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Start device at -1. This indicates the device was not detected |
|
||||
\*-----------------------------------------------------------------*/
|
||||
device_index = -1;
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Get the device name from the OpenRazer driver |
|
||||
\*-----------------------------------------------------------------*/
|
||||
open_razer_functions->device_type->show(open_razer_device, NULL, string_buf);
|
||||
name = string_buf;
|
||||
name.erase(std::remove(name.begin(), name.end(), '\n'), name.end());
|
||||
name.erase(std::remove(name.begin(), name.end(), '\r'), name.end());
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Set the description to indicate this is an OpenRazer device |
|
||||
\*-----------------------------------------------------------------*/
|
||||
description = "OpenRazer Device";
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Set the device path as the location |
|
||||
\*-----------------------------------------------------------------*/
|
||||
location = "";
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Get the serial number from the dev path |
|
||||
\*-----------------------------------------------------------------*/
|
||||
open_razer_functions->device_serial->show(open_razer_device, NULL, string_buf);
|
||||
serial = string_buf;
|
||||
serial.erase(std::remove(serial.begin(), serial.end(), '\n'), serial.end());
|
||||
serial.erase(std::remove(serial.begin(), serial.end(), '\r'), serial.end());
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Get the firmware version from the dev path |
|
||||
\*-----------------------------------------------------------------*/
|
||||
open_razer_functions->firmware_version->show(open_razer_device, NULL, string_buf);
|
||||
version = string_buf;
|
||||
version.erase(std::remove(version.begin(), version.end(), '\n'), version.end());
|
||||
version.erase(std::remove(version.begin(), version.end(), '\r'), version.end());
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Vendor is always Razer |
|
||||
\*-----------------------------------------------------------------*/
|
||||
vendor = "Razer";
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Loop through all known devices to look for a name match |
|
||||
\*-----------------------------------------------------------------*/
|
||||
for (unsigned int i = 0; i < OPEN_RAZER_NUM_DEVICES; i++)
|
||||
{
|
||||
if (device_list[i]->name == name)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Set device ID |
|
||||
\*---------------------------------------------------------*/
|
||||
device_index = i;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set device type |
|
||||
\*---------------------------------------------------------*/
|
||||
type = device_list[i]->type;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Device has Direct mode if matrix_custom_frame exists |
|
||||
\*---------------------------------------------------------*/
|
||||
if(open_razer_functions->matrix_effect_custom)
|
||||
{
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = OPEN_RAZER_MODE_CUSTOM;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Device has Off mode if any _effect_none or any _state |
|
||||
| exists |
|
||||
\*---------------------------------------------------------*/
|
||||
if( open_razer_functions->matrix_effect_none
|
||||
|| open_razer_functions->logo_matrix_effect_none
|
||||
|| open_razer_functions->scroll_matrix_effect_none
|
||||
|| open_razer_functions->left_matrix_effect_none
|
||||
|| open_razer_functions->right_matrix_effect_none
|
||||
/*|| open_razer_functions->backlight_led_state*/
|
||||
|| open_razer_functions->logo_led_state
|
||||
|| open_razer_functions->scroll_led_state)
|
||||
{
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = OPEN_RAZER_MODE_OFF;
|
||||
Off.flags = 0;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Device has Static mode if any _effect_static or any |
|
||||
| _effect exists |
|
||||
\*---------------------------------------------------------*/
|
||||
if( open_razer_functions->matrix_effect_static
|
||||
|| open_razer_functions->logo_matrix_effect_static
|
||||
|| open_razer_functions->scroll_matrix_effect_static
|
||||
|| open_razer_functions->left_matrix_effect_static
|
||||
|| open_razer_functions->right_matrix_effect_static
|
||||
/*|| open_razer_functions->backlight_led_effect*/
|
||||
|| open_razer_functions->logo_led_effect
|
||||
|| open_razer_functions->scroll_led_effect)
|
||||
{
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = OPEN_RAZER_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Static.colors_min = 1;
|
||||
Static.colors_max = 1;
|
||||
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Static.colors.resize(1);
|
||||
modes.push_back(Static);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Device has Breathing mode if any _effect_breath exists |
|
||||
\*---------------------------------------------------------*/
|
||||
if( open_razer_functions->matrix_effect_breath
|
||||
|| open_razer_functions->logo_matrix_effect_breath
|
||||
|| open_razer_functions->scroll_matrix_effect_breath
|
||||
|| open_razer_functions->left_matrix_effect_breath
|
||||
|| open_razer_functions->right_matrix_effect_breath)
|
||||
{
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = OPEN_RAZER_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Breathing.colors_min = 1;
|
||||
Breathing.colors_max = 2;
|
||||
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathing.colors.resize(2);
|
||||
modes.push_back(Breathing);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Device has limited Breathing mode if any _effect exists |
|
||||
\*---------------------------------------------------------*/
|
||||
if( /*open_razer_functions->backlight_led_effect ||*/
|
||||
open_razer_functions->logo_led_effect
|
||||
|| open_razer_functions->scroll_led_effect)
|
||||
{
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = OPEN_RAZER_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Breathing.colors_min = 1;
|
||||
Breathing.colors_max = 1;
|
||||
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathing.colors.resize(1);
|
||||
modes.push_back(Breathing);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Device has Flashing mode if any _effect exists |
|
||||
\*---------------------------------------------------------*/
|
||||
if( /*open_razer_functions->backlight_led_effect ||*/
|
||||
open_razer_functions->logo_led_effect
|
||||
|| open_razer_functions->scroll_led_effect)
|
||||
{
|
||||
mode Flashing;
|
||||
Flashing.name = "Flashing";
|
||||
Flashing.value = OPEN_RAZER_MODE_FLASHING;
|
||||
Flashing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
||||
Flashing.colors_min = 1;
|
||||
Flashing.colors_max = 1;
|
||||
Flashing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Flashing.colors.resize(1);
|
||||
modes.push_back(Flashing);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Device has Spectrum Cycle mode if any _effect_spectrum or |
|
||||
| _effect exists |
|
||||
\*---------------------------------------------------------*/
|
||||
if( open_razer_functions->matrix_effect_spectrum
|
||||
|| open_razer_functions->logo_matrix_effect_spectrum
|
||||
|| open_razer_functions->scroll_matrix_effect_spectrum
|
||||
|| open_razer_functions->left_matrix_effect_spectrum
|
||||
|| open_razer_functions->right_matrix_effect_spectrum
|
||||
/*|| open_razer_functions->backlight_led_effect*/
|
||||
|| open_razer_functions->logo_led_effect
|
||||
|| open_razer_functions->scroll_led_effect)
|
||||
{
|
||||
mode SpectrumCycle;
|
||||
SpectrumCycle.name = "Spectrum Cycle";
|
||||
SpectrumCycle.value = OPEN_RAZER_MODE_SPECTRUM_CYCLE;
|
||||
SpectrumCycle.flags = 0;
|
||||
SpectrumCycle.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(SpectrumCycle);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Device has Wave mode if any _effect_wave exists |
|
||||
\*---------------------------------------------------------*/
|
||||
if( open_razer_functions->matrix_effect_wave
|
||||
|| open_razer_functions->left_matrix_effect_wave
|
||||
|| open_razer_functions->right_matrix_effect_wave)
|
||||
{
|
||||
mode Wave;
|
||||
Wave.name = "Wave";
|
||||
Wave.value = OPEN_RAZER_MODE_WAVE;
|
||||
Wave.flags = MODE_FLAG_HAS_DIRECTION_LR;
|
||||
Wave.direction = MODE_DIRECTION_RIGHT;
|
||||
Wave.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Wave);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Device has Reactive mode if any _effect_reactive exists |
|
||||
\*---------------------------------------------------------*/
|
||||
if( open_razer_functions->matrix_effect_reactive
|
||||
|| open_razer_functions->logo_matrix_effect_reactive
|
||||
|| open_razer_functions->scroll_matrix_effect_reactive
|
||||
|| open_razer_functions->left_matrix_effect_reactive
|
||||
|| open_razer_functions->right_matrix_effect_reactive)
|
||||
{
|
||||
mode Reactive;
|
||||
Reactive.name = "Reactive";
|
||||
Reactive.value = OPEN_RAZER_MODE_REACTIVE;
|
||||
Reactive.flags = 0;
|
||||
Reactive.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Reactive);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Initialize file descriptors |
|
||||
\*---------------------------------------------------------*/
|
||||
if(device_list[i]->matrix_type == true)
|
||||
{
|
||||
SetupMatrixDevice(open_razer_functions, device_list[i]->rows, device_list[i]->cols);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetupNonMatrixDevice();
|
||||
}
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RGBController_OpenRazer::~RGBController_OpenRazer()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Delete the matrix map |
|
||||
\*---------------------------------------------------------*/
|
||||
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
|
||||
{
|
||||
if(zones[zone_index].matrix_map != NULL)
|
||||
{
|
||||
if(zones[zone_index].matrix_map->map != NULL)
|
||||
{
|
||||
delete zones[zone_index].matrix_map->map;
|
||||
}
|
||||
|
||||
delete zones[zone_index].matrix_map;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::SetupZones()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Fill in zone information based on device table |
|
||||
\*---------------------------------------------------------*/
|
||||
for(unsigned int zone_id = 0; zone_id < OPEN_RAZER_MAX_ZONES; zone_id++)
|
||||
{
|
||||
if(device_list[device_index]->zones[zone_id] != NULL)
|
||||
{
|
||||
zone new_zone;
|
||||
|
||||
new_zone.name = device_list[device_index]->zones[zone_id]->name;
|
||||
new_zone.type = device_list[device_index]->zones[zone_id]->type;
|
||||
|
||||
new_zone.leds_count = device_list[device_index]->zones[zone_id]->rows * device_list[device_index]->zones[zone_id]->cols;
|
||||
new_zone.leds_min = new_zone.leds_count;
|
||||
new_zone.leds_max = new_zone.leds_count;
|
||||
|
||||
if(new_zone.type == ZONE_TYPE_MATRIX)
|
||||
{
|
||||
matrix_map_type * new_map = new matrix_map_type;
|
||||
new_zone.matrix_map = new_map;
|
||||
|
||||
new_map->height = device_list[device_index]->zones[zone_id]->rows;
|
||||
new_map->width = device_list[device_index]->zones[zone_id]->cols;
|
||||
|
||||
new_map->map = new unsigned int[new_map->height * new_map->width];
|
||||
|
||||
for(unsigned int y = 0; y < new_map->height; y++)
|
||||
{
|
||||
for(unsigned int x = 0; x < new_map->width; x++)
|
||||
{
|
||||
new_map->map[(y * new_map->width) + x] = (y * new_map->width) + x;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new_zone.matrix_map = NULL;
|
||||
}
|
||||
|
||||
zones.push_back(new_zone);
|
||||
}
|
||||
}
|
||||
|
||||
for(unsigned int zone_id = 0; zone_id < zones.size(); zone_id++)
|
||||
{
|
||||
for (unsigned int row_id = 0; row_id < device_list[device_index]->zones[zone_id]->rows; row_id++)
|
||||
{
|
||||
for (unsigned int col_id = 0; col_id < device_list[device_index]->zones[zone_id]->cols; col_id++)
|
||||
{
|
||||
led* new_led = new led();
|
||||
|
||||
new_led->name = device_list[device_index]->zones[zone_id]->name;
|
||||
|
||||
if(zones[zone_id].leds_count > 1)
|
||||
{
|
||||
new_led->name.append(" LED ");
|
||||
new_led->name.append(std::to_string(col_id + 1));
|
||||
}
|
||||
|
||||
if(device_list[device_index]->keymap != NULL)
|
||||
{
|
||||
for(unsigned int i = 0; i < device_list[device_index]->keymap_size; i++)
|
||||
{
|
||||
if(zone_id == device_list[device_index]->keymap[i].zone &&
|
||||
row_id == device_list[device_index]->keymap[i].row &&
|
||||
col_id == device_list[device_index]->keymap[i].col)
|
||||
{
|
||||
new_led->name = device_list[device_index]->keymap[i].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
leds.push_back(*new_led);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::SetCustomMode()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| If device supports custom mode, it will be mode index 0 |
|
||||
\*---------------------------------------------------------*/
|
||||
if(modes[0].value == OPEN_RAZER_MODE_CUSTOM)
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
/*---------------------------------------------------------*\
|
||||
| If not, use static mode. |
|
||||
\*---------------------------------------------------------*/
|
||||
else
|
||||
{
|
||||
for(unsigned int i = 0; i < modes.size(); i++)
|
||||
{
|
||||
if(modes[i].value == OPEN_RAZER_MODE_STATIC)
|
||||
{
|
||||
active_mode = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_OpenRazer::DeviceUpdateMode()
|
||||
{
|
||||
char update_value[6];
|
||||
char effect_value[1];
|
||||
|
||||
update_value[0] = 1;
|
||||
|
||||
switch(modes[active_mode].value)
|
||||
{
|
||||
case OPEN_RAZER_MODE_CUSTOM:
|
||||
if(open_razer_functions->matrix_effect_custom)
|
||||
{
|
||||
open_razer_functions->matrix_effect_custom->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case OPEN_RAZER_MODE_OFF:
|
||||
if(open_razer_functions->matrix_effect_none)
|
||||
{
|
||||
open_razer_functions->matrix_effect_none->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->logo_matrix_effect_none)
|
||||
{
|
||||
open_razer_functions->logo_matrix_effect_none->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->scroll_matrix_effect_none)
|
||||
{
|
||||
open_razer_functions->scroll_matrix_effect_none->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->left_matrix_effect_none)
|
||||
{
|
||||
open_razer_functions->left_matrix_effect_none->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->right_matrix_effect_none)
|
||||
{
|
||||
open_razer_functions->right_matrix_effect_none->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
//if(open_razer_functions->backlight_led_state)
|
||||
//{
|
||||
// update_value[0] = '0';
|
||||
// open_razer_functions->backlight_led_state->store(open_razer_device, NULL, update_value, 1);
|
||||
//}
|
||||
|
||||
if(open_razer_functions->logo_led_state)
|
||||
{
|
||||
update_value[0] = '0';
|
||||
open_razer_functions->logo_led_state->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->scroll_led_state)
|
||||
{
|
||||
update_value[0] = '0';
|
||||
open_razer_functions->scroll_led_state->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case OPEN_RAZER_MODE_STATIC:
|
||||
effect_value[0] = '0';
|
||||
|
||||
//if(open_razer_functions->backlight_led_state)
|
||||
//{
|
||||
// update_value[0] = '1';
|
||||
// open_razer_functions->backlight_led_state->store(open_razer_device, NULL, update_value, 1);
|
||||
//}
|
||||
|
||||
if(open_razer_functions->logo_led_state)
|
||||
{
|
||||
update_value[0] = '1';
|
||||
open_razer_functions->logo_led_state->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->scroll_led_state)
|
||||
{
|
||||
update_value[0] = '1';
|
||||
open_razer_functions->scroll_led_state->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
update_value[0] = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
update_value[1] = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
update_value[2] = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
|
||||
if(open_razer_functions->matrix_effect_static)
|
||||
{
|
||||
open_razer_functions->matrix_effect_static->store(open_razer_device, NULL, update_value, 3);
|
||||
}
|
||||
|
||||
if(open_razer_functions->logo_matrix_effect_static)
|
||||
{
|
||||
open_razer_functions->logo_matrix_effect_static->store(open_razer_device, NULL, update_value, 3);
|
||||
}
|
||||
|
||||
if(open_razer_functions->scroll_matrix_effect_static)
|
||||
{
|
||||
open_razer_functions->scroll_matrix_effect_static->store(open_razer_device, NULL, update_value, 3);
|
||||
}
|
||||
|
||||
if(open_razer_functions->left_matrix_effect_static)
|
||||
{
|
||||
open_razer_functions->left_matrix_effect_static->store(open_razer_device, NULL, update_value, 3);
|
||||
}
|
||||
|
||||
if(open_razer_functions->right_matrix_effect_static)
|
||||
{
|
||||
open_razer_functions->right_matrix_effect_static->store(open_razer_device, NULL, update_value, 3);
|
||||
}
|
||||
|
||||
//if(open_razer_functions->backlight_led_effect && open_razer_functions->backlight_led_rgb)
|
||||
//{
|
||||
// open_razer_functions->backlight_led_rgb->store(open_razer_device, NULL, update_value, 3);
|
||||
// open_razer_functions->backlight_led_effect->store(open_razer_device, NULL, effect_value, 1);
|
||||
//}
|
||||
|
||||
if(open_razer_functions->logo_led_effect && open_razer_functions->logo_led_rgb)
|
||||
{
|
||||
open_razer_functions->logo_led_rgb->store(open_razer_device, NULL, update_value, 3);
|
||||
open_razer_functions->logo_led_effect->store(open_razer_device, NULL, effect_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->scroll_led_effect && open_razer_functions->scroll_led_rgb)
|
||||
{
|
||||
open_razer_functions->scroll_led_rgb->store(open_razer_device, NULL, update_value, 3);
|
||||
open_razer_functions->scroll_led_effect->store(open_razer_device, NULL, effect_value, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case OPEN_RAZER_MODE_FLASHING:
|
||||
effect_value[0] = '1';
|
||||
|
||||
//if(open_razer_functions->backlight_led_state)
|
||||
//{
|
||||
// update_value[0] = '1';
|
||||
// open_razer_functions->backlight_led_state->store(open_razer_device, NULL, update_value, 1);
|
||||
//}
|
||||
|
||||
if(open_razer_functions->logo_led_state)
|
||||
{
|
||||
update_value[0] = '1';
|
||||
open_razer_functions->logo_led_state->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->scroll_led_state)
|
||||
{
|
||||
update_value[0] = '1';
|
||||
open_razer_functions->scroll_led_state->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
update_value[0] = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
update_value[1] = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
update_value[2] = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
|
||||
//if(open_razer_functions->backlight_led_effect && open_razer_functions->backlight_led_rgb)
|
||||
//{
|
||||
// open_razer_functions->backlight_led_rgb->store(open_razer_device, NULL, update_value, 3);
|
||||
// open_razer_functions->backlight_led_effect->store(open_razer_device, NULL, effect_value, 1);
|
||||
//}
|
||||
|
||||
if(open_razer_functions->logo_led_effect && open_razer_functions->logo_led_rgb)
|
||||
{
|
||||
open_razer_functions->logo_led_rgb->store(open_razer_device, NULL, update_value, 3);
|
||||
open_razer_functions->logo_led_effect->store(open_razer_device, NULL, effect_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->scroll_led_effect && open_razer_functions->scroll_led_rgb)
|
||||
{
|
||||
open_razer_functions->scroll_led_rgb->store(open_razer_device, NULL, update_value, 3);
|
||||
open_razer_functions->scroll_led_effect->store(open_razer_device, NULL, effect_value, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case OPEN_RAZER_MODE_BREATHING:
|
||||
effect_value[0] = '2';
|
||||
|
||||
switch(modes[active_mode].color_mode)
|
||||
{
|
||||
case MODE_COLORS_MODE_SPECIFIC:
|
||||
//if(open_razer_functions->backlight_led_state)
|
||||
//{
|
||||
// update_value[0] = '1';
|
||||
// open_razer_functions->backlight_led_state->store(open_razer_device, NULL, update_value, 1);
|
||||
//}
|
||||
|
||||
if(open_razer_functions->logo_led_state)
|
||||
{
|
||||
update_value[0] = '1';
|
||||
open_razer_functions->logo_led_state->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->scroll_led_state)
|
||||
{
|
||||
update_value[0] = '1';
|
||||
open_razer_functions->scroll_led_state->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
update_value[0] = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
update_value[1] = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
update_value[2] = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
|
||||
if(modes[active_mode].colors.size() == 2)
|
||||
{
|
||||
update_value[3] = RGBGetRValue(modes[active_mode].colors[1]);
|
||||
update_value[4] = RGBGetGValue(modes[active_mode].colors[1]);
|
||||
update_value[5] = RGBGetBValue(modes[active_mode].colors[1]);
|
||||
|
||||
if(open_razer_functions->matrix_effect_breath)
|
||||
{
|
||||
open_razer_functions->matrix_effect_breath->store(open_razer_device, NULL, update_value, 6);
|
||||
}
|
||||
|
||||
if(open_razer_functions->logo_matrix_effect_breath)
|
||||
{
|
||||
open_razer_functions->logo_matrix_effect_breath->store(open_razer_device, NULL, update_value, 6);
|
||||
}
|
||||
|
||||
if(open_razer_functions->scroll_matrix_effect_breath)
|
||||
{
|
||||
open_razer_functions->scroll_matrix_effect_breath->store(open_razer_device, NULL, update_value, 6);
|
||||
}
|
||||
|
||||
if(open_razer_functions->left_matrix_effect_breath)
|
||||
{
|
||||
open_razer_functions->left_matrix_effect_breath->store(open_razer_device, NULL, update_value, 6);
|
||||
}
|
||||
|
||||
if(open_razer_functions->right_matrix_effect_breath)
|
||||
{
|
||||
open_razer_functions->right_matrix_effect_breath->store(open_razer_device, NULL, update_value, 6);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(open_razer_functions->matrix_effect_breath)
|
||||
{
|
||||
open_razer_functions->matrix_effect_breath->store(open_razer_device, NULL, update_value, 3);
|
||||
}
|
||||
|
||||
if(open_razer_functions->logo_matrix_effect_breath)
|
||||
{
|
||||
open_razer_functions->logo_matrix_effect_breath->store(open_razer_device, NULL, update_value, 3);
|
||||
}
|
||||
|
||||
if(open_razer_functions->scroll_matrix_effect_breath)
|
||||
{
|
||||
open_razer_functions->scroll_matrix_effect_breath->store(open_razer_device, NULL, update_value, 3);
|
||||
}
|
||||
|
||||
if(open_razer_functions->left_matrix_effect_breath)
|
||||
{
|
||||
open_razer_functions->left_matrix_effect_breath->store(open_razer_device, NULL, update_value, 3);
|
||||
}
|
||||
|
||||
if(open_razer_functions->right_matrix_effect_breath)
|
||||
{
|
||||
open_razer_functions->right_matrix_effect_breath->store(open_razer_device, NULL, update_value, 3);
|
||||
}
|
||||
|
||||
//if(open_razer_functions->backlight_led_effect && open_razer_functions->backlight_led_rgb)
|
||||
//{
|
||||
// open_razer_functions->backlight_led_rgb->store(open_razer_device, NULL, update_value, 3);
|
||||
// open_razer_functions->backlight_led_effect->store(open_razer_device, NULL, effect_value, 1);
|
||||
//}
|
||||
|
||||
if(open_razer_functions->logo_led_effect && open_razer_functions->logo_led_rgb)
|
||||
{
|
||||
open_razer_functions->logo_led_rgb->store(open_razer_device, NULL, update_value, 3);
|
||||
open_razer_functions->logo_led_effect->store(open_razer_device, NULL, effect_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->scroll_led_effect && open_razer_functions->scroll_led_rgb)
|
||||
{
|
||||
open_razer_functions->scroll_led_rgb->store(open_razer_device, NULL, update_value, 3);
|
||||
open_razer_functions->scroll_led_effect->store(open_razer_device, NULL, effect_value, 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MODE_COLORS_RANDOM:
|
||||
if(open_razer_functions->matrix_effect_breath)
|
||||
{
|
||||
open_razer_functions->matrix_effect_breath->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->logo_matrix_effect_breath)
|
||||
{
|
||||
open_razer_functions->logo_matrix_effect_breath->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->scroll_matrix_effect_breath)
|
||||
{
|
||||
open_razer_functions->scroll_matrix_effect_breath->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->left_matrix_effect_breath)
|
||||
{
|
||||
open_razer_functions->left_matrix_effect_breath->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->right_matrix_effect_breath)
|
||||
{
|
||||
open_razer_functions->right_matrix_effect_breath->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case OPEN_RAZER_MODE_SPECTRUM_CYCLE:
|
||||
effect_value[0] = '4';
|
||||
|
||||
//if(open_razer_functions->backlight_led_state)
|
||||
//{
|
||||
// update_value[0] = '1';
|
||||
// open_razer_functions->backlight_led_state->store(open_razer_device, NULL, update_value, 1);
|
||||
//}
|
||||
|
||||
if(open_razer_functions->logo_led_state)
|
||||
{
|
||||
update_value[0] = '1';
|
||||
open_razer_functions->logo_led_state->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->scroll_led_state)
|
||||
{
|
||||
update_value[0] = '1';
|
||||
open_razer_functions->scroll_led_state->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->matrix_effect_spectrum)
|
||||
{
|
||||
open_razer_functions->matrix_effect_spectrum->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->logo_matrix_effect_spectrum)
|
||||
{
|
||||
open_razer_functions->logo_matrix_effect_spectrum->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->scroll_matrix_effect_spectrum)
|
||||
{
|
||||
open_razer_functions->scroll_matrix_effect_spectrum->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->left_matrix_effect_spectrum)
|
||||
{
|
||||
open_razer_functions->left_matrix_effect_spectrum->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->right_matrix_effect_spectrum)
|
||||
{
|
||||
open_razer_functions->right_matrix_effect_spectrum->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
//if(open_razer_functions->backlight_led_effect)
|
||||
//{
|
||||
// open_razer_functions->backlight_led_effect->store(open_razer_device, NULL, effect_value, 1);
|
||||
//}
|
||||
|
||||
if(open_razer_functions->logo_led_effect)
|
||||
{
|
||||
open_razer_functions->logo_led_effect->store(open_razer_device, NULL, effect_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->scroll_led_effect)
|
||||
{
|
||||
open_razer_functions->scroll_led_effect->store(open_razer_device, NULL, effect_value, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case OPEN_RAZER_MODE_WAVE:
|
||||
switch(modes[active_mode].direction)
|
||||
{
|
||||
case MODE_DIRECTION_LEFT:
|
||||
update_value[0] = '2';
|
||||
break;
|
||||
|
||||
default:
|
||||
update_value[0] = '1';
|
||||
break;
|
||||
}
|
||||
|
||||
if(open_razer_functions->matrix_effect_wave)
|
||||
{
|
||||
open_razer_functions->matrix_effect_wave->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->left_matrix_effect_wave)
|
||||
{
|
||||
open_razer_functions->left_matrix_effect_wave->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->right_matrix_effect_wave)
|
||||
{
|
||||
open_razer_functions->right_matrix_effect_wave->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case OPEN_RAZER_MODE_REACTIVE:
|
||||
if(open_razer_functions->matrix_effect_reactive)
|
||||
{
|
||||
open_razer_functions->matrix_effect_reactive->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->logo_matrix_effect_reactive)
|
||||
{
|
||||
open_razer_functions->logo_matrix_effect_reactive->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->scroll_matrix_effect_reactive)
|
||||
{
|
||||
open_razer_functions->scroll_matrix_effect_reactive->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->left_matrix_effect_reactive)
|
||||
{
|
||||
open_razer_functions->left_matrix_effect_reactive->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
|
||||
if(open_razer_functions->right_matrix_effect_reactive)
|
||||
{
|
||||
open_razer_functions->right_matrix_effect_reactive->store(open_razer_device, NULL, update_value, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(20ms);
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_OpenRazerWindows.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRazer |
|
||||
| kernel drivers for Chroma peripherals |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 6/15/2019 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "OpenRazerDevices.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/hid.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct device_attribute* device_type;
|
||||
struct device_attribute* device_serial;
|
||||
struct device_attribute* firmware_version;
|
||||
|
||||
struct device_attribute* matrix_custom_frame;
|
||||
struct device_attribute* matrix_brightness;
|
||||
|
||||
struct device_attribute* matrix_effect_custom;
|
||||
struct device_attribute* matrix_effect_none;
|
||||
struct device_attribute* matrix_effect_static;
|
||||
struct device_attribute* matrix_effect_breath;
|
||||
struct device_attribute* matrix_effect_spectrum;
|
||||
struct device_attribute* matrix_effect_reactive;
|
||||
struct device_attribute* matrix_effect_wave;
|
||||
|
||||
struct device_attribute* logo_led_brightness;
|
||||
struct device_attribute* logo_matrix_effect_none;
|
||||
struct device_attribute* logo_matrix_effect_static;
|
||||
struct device_attribute* logo_matrix_effect_breath;
|
||||
struct device_attribute* logo_matrix_effect_spectrum;
|
||||
struct device_attribute* logo_matrix_effect_reactive;
|
||||
|
||||
struct device_attribute* scroll_led_brightness;
|
||||
struct device_attribute* scroll_matrix_effect_none;
|
||||
struct device_attribute* scroll_matrix_effect_static;
|
||||
struct device_attribute* scroll_matrix_effect_breath;
|
||||
struct device_attribute* scroll_matrix_effect_spectrum;
|
||||
struct device_attribute* scroll_matrix_effect_reactive;
|
||||
|
||||
struct device_attribute* left_led_brightness;
|
||||
struct device_attribute* left_matrix_effect_none;
|
||||
struct device_attribute* left_matrix_effect_static;
|
||||
struct device_attribute* left_matrix_effect_breath;
|
||||
struct device_attribute* left_matrix_effect_spectrum;
|
||||
struct device_attribute* left_matrix_effect_reactive;
|
||||
struct device_attribute* left_matrix_effect_wave;
|
||||
|
||||
struct device_attribute* right_led_brightness;
|
||||
struct device_attribute* right_matrix_effect_none;
|
||||
struct device_attribute* right_matrix_effect_static;
|
||||
struct device_attribute* right_matrix_effect_breath;
|
||||
struct device_attribute* right_matrix_effect_spectrum;
|
||||
struct device_attribute* right_matrix_effect_reactive;
|
||||
struct device_attribute* right_matrix_effect_wave;
|
||||
|
||||
struct device_attribute* logo_led_effect;
|
||||
struct device_attribute* logo_led_rgb;
|
||||
struct device_attribute* logo_led_state;
|
||||
|
||||
struct device_attribute* scroll_led_effect;
|
||||
struct device_attribute* scroll_led_rgb;
|
||||
struct device_attribute* scroll_led_state;
|
||||
} device_fn_type;
|
||||
|
||||
class RGBController_OpenRazer : public RGBController
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
OPEN_RAZER_MODE_CUSTOM,
|
||||
OPEN_RAZER_MODE_OFF,
|
||||
OPEN_RAZER_MODE_STATIC,
|
||||
OPEN_RAZER_MODE_BREATHING,
|
||||
OPEN_RAZER_MODE_SPECTRUM_CYCLE,
|
||||
OPEN_RAZER_MODE_WAVE,
|
||||
OPEN_RAZER_MODE_REACTIVE,
|
||||
OPEN_RAZER_MODE_FLASHING,
|
||||
OPEN_RAZER_NUM_MODES
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
OPEN_RAZER_TYPE_MATRIX_FRAME,
|
||||
OPEN_RAZER_TYPE_MATRIX_NOFRAME,
|
||||
OPEN_RAZER_TYPE_MATRIX_STATIC,
|
||||
OPEN_RAZER_TYPE_NOMATRIX,
|
||||
OPEN_RAZER_NUM_TYPES
|
||||
};
|
||||
|
||||
public:
|
||||
RGBController_OpenRazer(device * open_razer_device, device_fn_type* open_razer_functions);
|
||||
~RGBController_OpenRazer();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
int device_index;
|
||||
|
||||
private:
|
||||
void SetupMatrixDevice(device_fn_type* open_razer_functions, unsigned int rows, unsigned int cols);
|
||||
void SetupNonMatrixDevice();
|
||||
|
||||
unsigned int matrix_type;
|
||||
unsigned int matrix_rows;
|
||||
unsigned int matrix_cols;
|
||||
|
||||
device* open_razer_device;
|
||||
device_fn_type* open_razer_functions;
|
||||
|
||||
//OpenRazer Sysfs Entries for Matrix Devices
|
||||
std::ofstream matrix_custom_frame;
|
||||
std::ofstream matrix_effect_custom;
|
||||
std::ofstream matrix_effect_breath;
|
||||
std::ofstream matrix_effect_none;
|
||||
std::ofstream matrix_effect_reactive;
|
||||
std::ofstream matrix_effect_spectrum;
|
||||
std::ofstream matrix_effect_static;
|
||||
std::ofstream matrix_effect_wave;
|
||||
|
||||
//OpenRazer Sysfs Entries for Non-Matrix Devices
|
||||
std::ofstream logo_led_effect;
|
||||
std::ofstream logo_led_rgb;
|
||||
std::ofstream scroll_led_effect;
|
||||
std::ofstream scroll_led_rgb;
|
||||
};
|
||||
@@ -14,9 +14,6 @@
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
static bool openrazer_checked = false;
|
||||
static bool openrazer_enabled = false;
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* DetectRazerControllers *
|
||||
@@ -29,52 +26,6 @@ void DetectRazerControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the OpenRazer/OpenRazer-Win32 controller is |
|
||||
| enabled, don't use this controller. |
|
||||
\*-------------------------------------------------*/
|
||||
if(!openrazer_checked)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Open device disable list and read in disabled |
|
||||
| device strings |
|
||||
\*-------------------------------------------------*/
|
||||
json detector_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("Detectors");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Check for OpenRazer and OpenRazer-Win32 enable |
|
||||
\*-------------------------------------------------*/
|
||||
if(detector_settings.contains("detectors"))
|
||||
{
|
||||
if(detector_settings["detectors"].contains("OpenRazer"))
|
||||
{
|
||||
if(detector_settings["detectors"]["OpenRazer"] == true)
|
||||
{
|
||||
openrazer_enabled = true;
|
||||
}
|
||||
}
|
||||
if(detector_settings["detectors"].contains("OpenRazer-Win32"))
|
||||
{
|
||||
if(detector_settings["detectors"]["OpenRazer-Win32"] == true)
|
||||
{
|
||||
openrazer_enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set OpenRazer checked flag to prevent having to do|
|
||||
| the settings lookup multiple times |
|
||||
\*-------------------------------------------------*/
|
||||
openrazer_checked = true;
|
||||
}
|
||||
|
||||
if(openrazer_enabled)
|
||||
{
|
||||
LOG_INFO("[RazerController]: OpenRazer controller currently enabled. Ignoring %s", name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if(dev)
|
||||
{
|
||||
RazerController* controller = new RazerController(dev, dev, info->path, info->product_id, name);
|
||||
@@ -185,52 +136,6 @@ void DetectRazerKrakenControllers(hid_device_info* info, const std::string& name
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| If the OpenRazer/OpenRazer-Win32 controller is |
|
||||
| enabled, don't use this controller. |
|
||||
\*-------------------------------------------------*/
|
||||
if(!openrazer_checked)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Open device disable list and read in disabled |
|
||||
| device strings |
|
||||
\*-------------------------------------------------*/
|
||||
json detector_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("Detectors");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Check for OpenRazer and OpenRazer-Win32 enable |
|
||||
\*-------------------------------------------------*/
|
||||
if(detector_settings.contains("detectors"))
|
||||
{
|
||||
if(detector_settings["detectors"].contains("OpenRazer"))
|
||||
{
|
||||
if(detector_settings["detectors"]["OpenRazer"] == true)
|
||||
{
|
||||
openrazer_enabled = true;
|
||||
}
|
||||
}
|
||||
if(detector_settings["detectors"].contains("OpenRazer-Win32"))
|
||||
{
|
||||
if(detector_settings["detectors"]["OpenRazer-Win32"] == true)
|
||||
{
|
||||
openrazer_enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Set OpenRazer checked flag to prevent having to do|
|
||||
| the settings lookup multiple times |
|
||||
\*-------------------------------------------------*/
|
||||
openrazer_checked = true;
|
||||
}
|
||||
|
||||
if(openrazer_enabled)
|
||||
{
|
||||
LOG_INFO("[RazerController]: OpenRazer controller currently enabled. Ignoring %s", name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if(dev)
|
||||
{
|
||||
RazerKrakenController* controller = new RazerKrakenController(dev, info->path, info->product_id, name);
|
||||
|
||||
14
OpenRGB.pro
14
OpenRGB.pro
@@ -197,7 +197,6 @@ INCLUDEPATH +=
|
||||
Controllers/NZXTHue2Controller/ \
|
||||
Controllers/NZXTHuePlusController/ \
|
||||
Controllers/NZXTKrakenController/ \
|
||||
Controllers/OpenRazerController/ \
|
||||
Controllers/PatriotViperController/ \
|
||||
Controllers/PatriotViperSteelController/ \
|
||||
Controllers/PhilipsHueController/ \
|
||||
@@ -666,7 +665,6 @@ HEADERS +=
|
||||
Controllers/NZXTHuePlusController/RGBController_NZXTHuePlus.h \
|
||||
Controllers/NZXTKrakenController/NZXTKrakenController.h \
|
||||
Controllers/NZXTKrakenController/RGBController_NZXTKraken.h \
|
||||
Controllers/OpenRazerController/OpenRazerDevices.h \
|
||||
Controllers/OKSController/OKSKeyboardController.h \
|
||||
Controllers/OKSController/RGBController_OKSKeyboard.h \
|
||||
Controllers/PalitGPUController/PalitGPUController.h \
|
||||
@@ -1622,7 +1620,6 @@ win32:INCLUDEPATH +=
|
||||
dependencies/libusb-1.0.22/include \
|
||||
dependencies/mbedtls-2.24.0/include \
|
||||
dependencies/NVFC \
|
||||
dependencies/openrazer-win32 \
|
||||
wmi/ \
|
||||
Controllers/AsusTUFLaptopController \
|
||||
Controllers/HYTEMousematController/HYTEMousematController_serial \
|
||||
@@ -1737,8 +1734,6 @@ win32:SOURCES +=
|
||||
Controllers/NVIDIAIlluminationController/NVIDIAIlluminationV1Controller.cpp \
|
||||
Controllers/NVIDIAIlluminationController/NVIDIAIlluminationControllerDetect.cpp \
|
||||
Controllers/NVIDIAIlluminationController/RGBController_NVIDIAIllumination.cpp \
|
||||
Controllers/OpenRazerController/OpenRazerWindowsDetect.cpp \
|
||||
Controllers/OpenRazerController/RGBController_OpenRazerWindows.cpp \
|
||||
|
||||
win32:HEADERS += \
|
||||
dependencies/display-library/include/adl_defines.h \
|
||||
@@ -1760,7 +1755,6 @@ win32:HEADERS +=
|
||||
Controllers/NVIDIAIlluminationController/nvapi_accessor.h \
|
||||
Controllers/NVIDIAIlluminationController/NVIDIAIlluminationV1Controller.h \
|
||||
Controllers/NVIDIAIlluminationController/RGBController_NVIDIAIllumination.h \
|
||||
Controllers/OpenRazerController/RGBController_OpenRazerWindows.h \
|
||||
|
||||
win32:contains(QMAKE_TARGET.arch, x86_64) {
|
||||
LIBS += \
|
||||
@@ -1815,7 +1809,6 @@ win32:UI_DIR = _intermediate_$$DESTDIR/.ui
|
||||
#-----------------------------------------------------------------------------------------------#
|
||||
|
||||
win32:contains(QMAKE_TARGET.arch, x86_64) {
|
||||
copydata.commands = $(COPY_FILE) \"$$shell_path($$PWD/dependencies/openrazer-win32/OpenRazer64.dll )\" \"$$shell_path($$DESTDIR)\" $$escape_expand(\n\t)
|
||||
copydata.commands += $(COPY_FILE) \"$$shell_path($$PWD/dependencies/winring0/x64/WinRing0x64.dll )\" \"$$shell_path($$DESTDIR)\" $$escape_expand(\n\t)
|
||||
copydata.commands += $(COPY_FILE) \"$$shell_path($$PWD/dependencies/winring0/x64/WinRing0x64.sys )\" \"$$shell_path($$DESTDIR)\" $$escape_expand(\n\t)
|
||||
copydata.commands += $(COPY_FILE) \"$$shell_path($$PWD/dependencies/libusb-1.0.22/MS64/dll/libusb-1.0.dll)\" \"$$shell_path($$DESTDIR)\" $$escape_expand(\n\t)
|
||||
@@ -1827,7 +1820,6 @@ win32:contains(QMAKE_TARGET.arch, x86_64) {
|
||||
}
|
||||
|
||||
win32:contains(QMAKE_TARGET.arch, x86) {
|
||||
copydata.commands = $(COPY_FILE) \"$$shell_path($$PWD/dependencies/openrazer-win32/OpenRazer.dll )\" \"$$shell_path($$DESTDIR)\" $$escape_expand(\n\t)
|
||||
copydata.commands += $(COPY_FILE) \"$$shell_path($$PWD/dependencies/winring0/Win32/WinRing0.dll )\" \"$$shell_path($$DESTDIR)\" $$escape_expand(\n\t)
|
||||
copydata.commands += $(COPY_FILE) \"$$shell_path($$PWD/dependencies/winring0/Win32/WinRing0.sys )\" \"$$shell_path($$DESTDIR)\" $$escape_expand(\n\t)
|
||||
copydata.commands += $(COPY_FILE) \"$$shell_path($$PWD/dependencies/winring0/x64/WinRing0x64.sys )\" \"$$shell_path($$DESTDIR)\" $$escape_expand(\n\t)
|
||||
@@ -1862,7 +1854,6 @@ contains(QMAKE_PLATFORM, linux) {
|
||||
Controllers/HYTEMousematController/RGBController_HYTEMousemat.h \
|
||||
Controllers/LinuxLEDController/LinuxLEDController.h \
|
||||
Controllers/LinuxLEDController/RGBController_LinuxLED.h \
|
||||
Controllers/OpenRazerController/RGBController_OpenRazer.h \
|
||||
|
||||
LIBS += \
|
||||
-lusb-1.0 \
|
||||
@@ -1919,8 +1910,6 @@ contains(QMAKE_PLATFORM, linux) {
|
||||
Controllers/LinuxLEDController/LinuxLEDController.cpp \
|
||||
Controllers/LinuxLEDController/LinuxLEDControllerDetect.cpp \
|
||||
Controllers/LinuxLEDController/RGBController_LinuxLED.cpp \
|
||||
Controllers/OpenRazerController/OpenRazerDetect.cpp \
|
||||
Controllers/OpenRazerController/RGBController_OpenRazer.cpp \
|
||||
|
||||
#-------------------------------------------------------------------------------------------#
|
||||
# Set up install paths #
|
||||
@@ -1988,7 +1977,6 @@ contains(QMAKE_PLATFORM, freebsd) {
|
||||
Controllers/FaustusController/RGBController_Faustus.h \
|
||||
Controllers/LinuxLEDController/LinuxLEDController.h \
|
||||
Controllers/LinuxLEDController/RGBController_LinuxLED.h \
|
||||
Controllers/OpenRazerController/RGBController_OpenRazer.h \
|
||||
|
||||
LIBS += \
|
||||
-lusb \
|
||||
@@ -2034,8 +2022,6 @@ contains(QMAKE_PLATFORM, freebsd) {
|
||||
Controllers/LinuxLEDController/LinuxLEDController.cpp \
|
||||
Controllers/LinuxLEDController/LinuxLEDControllerDetect.cpp \
|
||||
Controllers/LinuxLEDController/RGBController_LinuxLED.cpp \
|
||||
Controllers/OpenRazerController/OpenRazerDetect.cpp \
|
||||
Controllers/OpenRazerController/RGBController_OpenRazer.cpp \
|
||||
|
||||
#-------------------------------------------------------------------------------------------#
|
||||
# Set up install paths #
|
||||
|
||||
@@ -323,8 +323,6 @@ There have been two instances of hardware damage in OpenRGB's development and we
|
||||
* hidapi: https://github.com/libusb/hidapi
|
||||
* libe131: https://github.com/hhromic/libe131
|
||||
* NVFC: https://github.com/graphitemaster/NVFC
|
||||
* OpenRazer: https://github.com/openrazer/openrazer
|
||||
* OpenRazer-Win32: https://github.com/CalcProgrammer1/openrazer-win32
|
||||
* Qt-Plus (ColorWheel): https://github.com/liuyanghejerry/Qt-Plus
|
||||
* AMD ADL Libraries: https://github.com/GPUOpen-LibrariesAndSDKs/display-library
|
||||
* libcmmk: https://github.com/chmod222/libcmmk
|
||||
@@ -337,6 +335,8 @@ There have been two instances of hardware damage in OpenRGB's development and we
|
||||
|
||||
While no code from these projects directly made its way into OpenRGB, these projects have been invaluable resources for protocol information.
|
||||
|
||||
* OpenRazer: https://github.com/openrazer/openrazer
|
||||
* OpenRazer-Win32: https://github.com/CalcProgrammer1/openrazer-win32
|
||||
* ckb-next: https://github.com/ckb-next/ckb-next
|
||||
* linux_thermaltake_riing: https://github.com/chestm007/linux_thermaltake_riing
|
||||
* Aura Addressable Header Controller: https://gitlab.com/cneil02/aura-addressable-header-controller
|
||||
|
||||
@@ -1548,18 +1548,7 @@ void ResourceManager::UpdateDetectorSettings()
|
||||
|
||||
if(!(detector_settings.contains("detectors") && detector_settings["detectors"].contains(detection_string)))
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Default the OpenRazer detector to disabled, as it |
|
||||
| overrides RazerController when enabled |
|
||||
\*-------------------------------------------------*/
|
||||
if(strcmp(detection_string, "OpenRazer") == 0 || strcmp(detection_string, "OpenRazer-Win32") == 0)
|
||||
{
|
||||
detector_settings["detectors"][detection_string] = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
detector_settings["detectors"][detection_string] = true;
|
||||
}
|
||||
detector_settings["detectors"][detection_string] = true;
|
||||
save_settings = true;
|
||||
}
|
||||
}
|
||||
|
||||
1
debian/control
vendored
1
debian/control
vendored
@@ -22,7 +22,6 @@ Depends:
|
||||
${misc:Depends},
|
||||
udev,
|
||||
Recommends:
|
||||
openrazer-driver-dkms,
|
||||
openrgb-dkms-drivers,
|
||||
Conflicts:
|
||||
openrgb-udev,
|
||||
|
||||
BIN
dependencies/openrazer-win32/OpenRazer.dll
vendored
BIN
dependencies/openrazer-win32/OpenRazer.dll
vendored
Binary file not shown.
BIN
dependencies/openrazer-win32/OpenRazer64.dll
vendored
BIN
dependencies/openrazer-win32/OpenRazer64.dll
vendored
Binary file not shown.
31
dependencies/openrazer-win32/linux/dmi.h
vendored
31
dependencies/openrazer-win32/linux/dmi.h
vendored
@@ -1,31 +0,0 @@
|
||||
#ifndef DMI_H_
|
||||
#define DMI_H_
|
||||
|
||||
enum dmi_field {
|
||||
DMI_NONE,
|
||||
DMI_BIOS_VENDOR,
|
||||
DMI_BIOS_VERSION,
|
||||
DMI_BIOS_DATE,
|
||||
DMI_SYS_VENDOR,
|
||||
DMI_PRODUCT_NAME,
|
||||
DMI_PRODUCT_VERSION,
|
||||
DMI_PRODUCT_SERIAL,
|
||||
DMI_PRODUCT_UUID,
|
||||
DMI_BOARD_VENDOR,
|
||||
DMI_BOARD_NAME,
|
||||
DMI_BOARD_VERSION,
|
||||
DMI_BOARD_SERIAL,
|
||||
DMI_BOARD_ASSET_TAG,
|
||||
DMI_CHASSIS_VENDOR,
|
||||
DMI_CHASSIS_TYPE,
|
||||
DMI_CHASSIS_VERSION,
|
||||
DMI_CHASSIS_SERIAL,
|
||||
DMI_CHASSIS_ASSET_TAG,
|
||||
DMI_STRING_MAX,
|
||||
};
|
||||
|
||||
static inline char* dmi_get_system_info(int x) {
|
||||
return "BLADESERIAL";
|
||||
}
|
||||
|
||||
#endif /* DMI_H_ */
|
||||
402
dependencies/openrazer-win32/linux/hid.h
vendored
402
dependencies/openrazer-win32/linux/hid.h
vendored
@@ -1,402 +0,0 @@
|
||||
#ifndef HID_H_
|
||||
#define HID_H_
|
||||
|
||||
#include <SetupAPI.h>
|
||||
#include <cfgmgr32.h>
|
||||
#include <Winusb.h>
|
||||
|
||||
#pragma comment(lib, "setupapi.lib")
|
||||
#pragma comment(lib, "Winusb.lib")
|
||||
|
||||
#define HID_STAT_ADDED 1
|
||||
#define HID_STAT_PARSED 2
|
||||
|
||||
#define HID_CONNECT_HIDINPUT 0x01
|
||||
#define HID_CONNECT_HIDRAW 0x04
|
||||
#define HID_CONNECT_HIDDEV 0x08
|
||||
#define HID_CONNECT_FF 0x20
|
||||
#define HID_CONNECT_DEFAULT (HID_CONNECT_HIDINPUT|HID_CONNECT_HIDRAW| HID_CONNECT_HIDDEV|HID_CONNECT_FF)
|
||||
|
||||
#define HID_GD_WHEEL 0x00010038
|
||||
|
||||
#define HID_REQ_GET_REPORT 0x01
|
||||
#define HID_REQ_SET_REPORT 0x09
|
||||
|
||||
//#define USB_INTERFACE_PROTOCOL_KEYBOARD 1
|
||||
//#define USB_INTERFACE_PROTOCOL_MOUSE 2
|
||||
|
||||
//Hack to make detection work without having to install WinUSB on the correct interface
|
||||
#define USB_INTERFACE_PROTOCOL_KEYBOARD 0
|
||||
#define USB_INTERFACE_PROTOCOL_MOUSE 0
|
||||
|
||||
static const GUID GUID_DEVINTERFACE = { 0xDEE824EF, 0x729B, 0x4A0E, 0x9C, 0x14, 0xB7, 0x11, 0x7D, 0x33, 0xA8, 0x17 };
|
||||
|
||||
typedef enum
|
||||
{
|
||||
HID_TYPE_OTHER,
|
||||
HID_TYPE_USBMOUSE,
|
||||
HID_TYPE_USBNONE
|
||||
} hid_type;
|
||||
|
||||
struct hid_input {
|
||||
struct input_dev *input;
|
||||
};
|
||||
|
||||
struct hid_field {
|
||||
struct hid_input *hidinput; /* associated input structure */
|
||||
};
|
||||
|
||||
struct hid_usage {
|
||||
unsigned hid;
|
||||
__u16 code; /* input driver code */
|
||||
__u8 type; /* input driver type */
|
||||
};
|
||||
|
||||
struct hid_driver {
|
||||
char *name;
|
||||
const struct hid_device_id *id_table;
|
||||
int (*probe)(struct hid_device *dev, const struct hid_device_id *id);
|
||||
void (*remove)(struct hid_device *dev);
|
||||
int (*raw_event)(struct hid_device *hdev, struct hid_report *report, u8 *data, int size);
|
||||
int (*event)(struct hid_device *hdev, struct hid_field *field, struct hid_usage *usage, __s32 value);
|
||||
int (*input_configured)(struct hid_device *hdev,
|
||||
struct hid_input *hidinput);
|
||||
int (*input_mapping)(struct hid_device *hdev,
|
||||
struct hid_input *hidinput, struct hid_field *field,
|
||||
struct hid_usage *usage, unsigned long **bit, int *max);
|
||||
};
|
||||
|
||||
struct hid_device_id {
|
||||
__u16 bus;
|
||||
__u32 vendor;
|
||||
__u32 product;
|
||||
};
|
||||
|
||||
struct hid_device {
|
||||
__u16 product;
|
||||
enum hid_type type;
|
||||
struct device dev;
|
||||
struct hid_ll_driver *ll_driver;
|
||||
unsigned int status;
|
||||
struct hid_driver *driver;
|
||||
};
|
||||
|
||||
struct hid_ll_driver {
|
||||
int (*start)(struct hid_device *hdev);
|
||||
void (*stop)(struct hid_device *hdev);
|
||||
int (*parse)(struct hid_device *hdev);
|
||||
};
|
||||
|
||||
inline int ll_start(struct hid_device *hdev) {
|
||||
printf("ll_start\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline void ll_stop(struct hid_device *hdev) {
|
||||
printf("ll_stop\n");
|
||||
}
|
||||
|
||||
inline int ll_parse(struct hid_device *hdev) {
|
||||
printf("ll_parse\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline void dev_err(struct device** dev, const char* msg) {
|
||||
printf("dev_err device=%s msg=%s", (*dev)->init_name, msg);
|
||||
}
|
||||
|
||||
inline void dev_info(struct device** dev, const char* msg) {
|
||||
printf("dev_err device=%s msg=%s", (*dev)->init_name, msg);
|
||||
}
|
||||
|
||||
inline void *dev_get_drvdata(const struct device *dev) {
|
||||
return dev->driver_data;
|
||||
}
|
||||
|
||||
inline void dev_set_drvdata(struct device *dev, void *data) {
|
||||
dev->driver_data = data;
|
||||
}
|
||||
|
||||
inline int hid_connect(struct hid_device *hdev, unsigned int connect_mask) {
|
||||
printf("hid_connect\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int hid_parse(struct hid_device *hdev) {
|
||||
int ret;
|
||||
|
||||
if (hdev->status & HID_STAT_PARSED)
|
||||
return 0;
|
||||
|
||||
ret = hdev->ll_driver->parse(hdev);
|
||||
if (!ret)
|
||||
hdev->status |= HID_STAT_PARSED;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline void *hid_get_drvdata(struct hid_device *hdev) {
|
||||
return dev_get_drvdata(&hdev->dev);
|
||||
}
|
||||
|
||||
inline void hid_set_drvdata(struct hid_device *hdev, void *data) {
|
||||
dev_set_drvdata(&hdev->dev, data);
|
||||
}
|
||||
|
||||
inline int hid_hw_start(struct hid_device *hdev, unsigned int connect_mask) {
|
||||
int ret = hdev->ll_driver->start(hdev);
|
||||
if (ret || !connect_mask)
|
||||
return ret;
|
||||
ret = hid_connect(hdev, connect_mask);
|
||||
if (ret)
|
||||
hdev->ll_driver->stop(hdev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline void hid_hw_stop(struct hid_device *hdev) {
|
||||
hdev->ll_driver->stop(hdev);
|
||||
}
|
||||
|
||||
inline void hid_err(struct hid_device *hdev, const char* msg, ...) {
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
printf("hid_err device=%s", hdev->dev.init_name);
|
||||
printf(msg, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
inline void hid_map_usage(struct hid_input* hidinput,
|
||||
struct hid_usage* usage, unsigned long** bit, int* max,
|
||||
__u8 type, __u16 c)
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
#define container_of(ptr, type, member) (type*)((char*)(ptr)-(char*)&((type *)0)->member)
|
||||
|
||||
inline void close(struct device* dev) {
|
||||
printf("close %04X\n", (to_usb_device(dev))->descriptor.idProduct);
|
||||
struct usb_interface *intf = to_usb_interface(dev->parent);
|
||||
struct usb_device *usb_dev = interface_to_usbdev(intf);
|
||||
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
|
||||
free(hdev->ll_driver);
|
||||
free(usb_dev);
|
||||
free(intf->cur_altsetting);
|
||||
free(intf);
|
||||
free(hdev);
|
||||
//TODO:cleanup malloc memory, move this function into DLL
|
||||
}
|
||||
|
||||
inline void openChromaDevice(struct hid_device** hdev, unsigned int* numHdev, struct hid_driver hdr) {
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Loop through all vendor IDs in ID table of header |
|
||||
\*-----------------------------------------------------------------*/
|
||||
for (unsigned int i = 0; hdr.id_table[i].vendor != 0; i++)
|
||||
{
|
||||
/*-------------------------------------------------------------*\
|
||||
| Get device information set |
|
||||
\*-------------------------------------------------------------*/
|
||||
HDEVINFO hDevInfo = SetupDiGetClassDevs(&GUID_DEVINTERFACE, 0, 0, DIGCF_DEVICEINTERFACE);
|
||||
|
||||
if (hDevInfo == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("SetupDiGetClassDevs failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
SP_DEVINFO_DATA deviceData = { 0 };
|
||||
deviceData.cbSize = sizeof(SP_DEVINFO_DATA);
|
||||
|
||||
/*-------------------------------------------------------------*\
|
||||
| Loop through all device information entries in set |
|
||||
\*-------------------------------------------------------------*/
|
||||
for (unsigned int j = 0; SetupDiEnumDeviceInfo(hDevInfo, j, &deviceData); ++j)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Get device ID string from device information |
|
||||
\*---------------------------------------------------------*/
|
||||
char deviceID[MAX_DEVICE_ID_LEN];
|
||||
|
||||
if (CM_Get_Device_ID(deviceData.DevInst, deviceID, MAX_DEVICE_ID_LEN, 0))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Parse USB VID out of device ID string |
|
||||
| Move on to the next device if the VID does not match |
|
||||
\*---------------------------------------------------------*/
|
||||
char* vid = strstr(deviceID, "VID_");
|
||||
|
||||
if (!vid || hdr.id_table[i].vendor != strtoul(vid + 4, NULL, 16))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Parse USB PID out of device ID string |
|
||||
| Move on to the next device if the PID does not match |
|
||||
\*---------------------------------------------------------*/
|
||||
char* pid = strstr(deviceID, "PID_");
|
||||
|
||||
if (!pid || hdr.id_table[i].product != strtoul(pid + 4, NULL, 16))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Enumerate device interface data for this device |
|
||||
\*---------------------------------------------------------*/
|
||||
SP_INTERFACE_DEVICE_DATA interfaceData = { 0 };
|
||||
interfaceData.cbSize = sizeof(SP_INTERFACE_DEVICE_DATA);
|
||||
|
||||
if (!SetupDiEnumDeviceInterfaces(hDevInfo, &deviceData, &GUID_DEVINTERFACE, 0, &interfaceData))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Get device interface detail size |
|
||||
\*---------------------------------------------------------*/
|
||||
DWORD dwRequiredSize = 0;
|
||||
SetupDiGetDeviceInterfaceDetail(hDevInfo, &interfaceData, 0, 0, &dwRequiredSize, 0);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Create a buffer of required size and load the device |
|
||||
| interface detail information into the buffer |
|
||||
\*---------------------------------------------------------*/
|
||||
SP_INTERFACE_DEVICE_DETAIL_DATA* pData = (SP_INTERFACE_DEVICE_DETAIL_DATA*)malloc(dwRequiredSize);
|
||||
pData->cbSize = sizeof(SP_INTERFACE_DEVICE_DETAIL_DATA);
|
||||
|
||||
if (!SetupDiGetDeviceInterfaceDetail(hDevInfo, &interfaceData, pData, dwRequiredSize, 0, 0))
|
||||
{
|
||||
free(pData);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Open a handle to the device |
|
||||
\*---------------------------------------------------------*/
|
||||
HANDLE hDevice = CreateFile(pData->DevicePath
|
||||
, GENERIC_READ | GENERIC_WRITE
|
||||
, FILE_SHARE_READ | FILE_SHARE_WRITE
|
||||
, 0
|
||||
, OPEN_EXISTING
|
||||
, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED
|
||||
, 0);
|
||||
|
||||
if (hDevice == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
free(pData);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Open a WinUSB handle from the device handle |
|
||||
\*---------------------------------------------------------*/
|
||||
WINUSB_INTERFACE_HANDLE hWinUSBHandle;
|
||||
|
||||
if (!WinUsb_Initialize(hDevice, &hWinUSBHandle))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Delete the device information set |
|
||||
\*---------------------------------------------------------*/
|
||||
SetupDiDestroyDeviceInfoList(hDevInfo);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Print debug message indicating device is opened |
|
||||
\*---------------------------------------------------------*/
|
||||
printf("CM_Get_Device_ID (%s)\n", deviceID);
|
||||
printf("device %04X:%04X opened!\n", hdr.id_table[i].vendor, hdr.id_table[i].product);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Create or resize HID device struct buffer |
|
||||
\*---------------------------------------------------------*/
|
||||
*hdev = (struct hid_device*)realloc(*hdev, (*numHdev+1) * sizeof(struct hid_device));
|
||||
|
||||
if (!*hdev)
|
||||
{
|
||||
printf("out of memory\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| If there are hdev entries from previous loop iterations, |
|
||||
| copy the data from the previous location to the new. |
|
||||
\*---------------------------------------------------------*/
|
||||
if (*numHdev > 0)
|
||||
{
|
||||
for (int old_dev = 0; old_dev < *numHdev; old_dev++)
|
||||
{
|
||||
(*hdev)[old_dev].dev.parent = &((*hdev)[old_dev].dev);
|
||||
(*hdev)[old_dev].dev.parent_usb_interface->dev = &((*hdev)[old_dev].dev);
|
||||
(*hdev)[old_dev].dev.parent_usb_interface->parent_usb_device->dev = &((*hdev)[old_dev].dev);
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Allocate buffer for USB interface and USB host interface |
|
||||
| structures |
|
||||
\*---------------------------------------------------------*/
|
||||
struct usb_interface* intf = (struct usb_interface*)malloc(sizeof(struct usb_interface));
|
||||
intf->cur_altsetting = (struct usb_host_interface*)malloc(sizeof(struct usb_host_interface));
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set the interface protocol for this device |
|
||||
| Get this information from the interface descriptor |
|
||||
\*---------------------------------------------------------*/
|
||||
//USB_INTERFACE_DESCRIPTOR interface_descriptor;
|
||||
//WinUsb_QueryInterfaceSettings(hWinUSBHandle, 0, &interface_descriptor);
|
||||
|
||||
intf->cur_altsetting->desc.bInterfaceProtocol = 0;// interface_descriptor.bInterfaceProtocol;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Allocate buffer for USB device structure |
|
||||
\*---------------------------------------------------------*/
|
||||
struct usb_device *usbdevice = (struct usb_device*)malloc(sizeof(struct usb_device));
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Set up USB device and interface structures |
|
||||
\*---------------------------------------------------------*/
|
||||
usbdevice->descriptor.idVendor = hdr.id_table[i].vendor;
|
||||
usbdevice->descriptor.idProduct = hdr.id_table[i].product;
|
||||
|
||||
intf->parent_usb_device = usbdevice;
|
||||
|
||||
(*hdev)[*numHdev].product = hdr.id_table[i].product;
|
||||
(*hdev)[*numHdev].dev.parent = &((*hdev)[*numHdev].dev);
|
||||
(*hdev)[*numHdev].dev.driver_data;
|
||||
(*hdev)[*numHdev].dev.p = hWinUSBHandle;
|
||||
(*hdev)[*numHdev].dev.parent_usb_interface = intf;
|
||||
(*hdev)[*numHdev].dev.init_name = hdr.name;
|
||||
(*hdev)[*numHdev].dev.attr_count = 0;
|
||||
|
||||
usbdevice->dev = &((*hdev)[*numHdev].dev);
|
||||
intf->dev = &((*hdev)[*numHdev].dev);
|
||||
|
||||
(*hdev)[*numHdev].status = 2;
|
||||
(*hdev)[*numHdev].driver = &hdr;
|
||||
(*hdev)[*numHdev].ll_driver = (struct hid_ll_driver*)malloc(sizeof(struct hid_ll_driver));
|
||||
(*hdev)[*numHdev].ll_driver->parse = ll_parse;
|
||||
(*hdev)[*numHdev].ll_driver->start = ll_start;
|
||||
(*hdev)[*numHdev].ll_driver->stop = ll_stop;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Call the OpenRazer driver probe function |
|
||||
\*---------------------------------------------------------*/
|
||||
(*hdev)[*numHdev].driver->probe(&((*hdev)[*numHdev]), &(hdr.id_table[i]));
|
||||
|
||||
(*numHdev)++;
|
||||
}
|
||||
if (!numHdev)
|
||||
{
|
||||
printf("device %04X:%04X NOT opened!\n", hdr.id_table[i].vendor, hdr.id_table[i].product);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HID_H_ */
|
||||
38
dependencies/openrazer-win32/linux/init.h
vendored
38
dependencies/openrazer-win32/linux/init.h
vendored
@@ -1,38 +0,0 @@
|
||||
#ifndef INIT_H_
|
||||
#define INIT_H_
|
||||
|
||||
#define KERN_WARNING
|
||||
#define KERN_ALERT
|
||||
#define KERN_CRIT
|
||||
|
||||
#define printk printf
|
||||
|
||||
inline unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base) {
|
||||
return strtoul(cp, endp, base);
|
||||
}
|
||||
|
||||
inline void usleep(__int64 usec) {
|
||||
HANDLE timer;
|
||||
LARGE_INTEGER ft;
|
||||
|
||||
ft.QuadPart = -(10 * usec); // Convert to 100 nanosecond interval, negative value indicates relative time
|
||||
|
||||
timer = CreateWaitableTimer(NULL, TRUE, NULL);
|
||||
SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0);
|
||||
WaitForSingleObject(timer, INFINITE);
|
||||
CloseHandle(timer);
|
||||
}
|
||||
|
||||
inline void msleep(__int64 msec) {
|
||||
usleep(1000 * msec);
|
||||
}
|
||||
|
||||
inline void usleep_range(__int64 usec1, __int64 usec2) {
|
||||
usleep((usec1 + usec2) / 2);
|
||||
}
|
||||
|
||||
inline unsigned short eflip(unsigned short val) {
|
||||
return (val & 0xff) * 0xFF + (val >> 8);
|
||||
}
|
||||
|
||||
#endif /* INIT_H_ */
|
||||
98
dependencies/openrazer-win32/linux/kernel.h
vendored
98
dependencies/openrazer-win32/linux/kernel.h
vendored
@@ -1,98 +0,0 @@
|
||||
#ifndef KERNEL_H_
|
||||
#define KERNEL_H_
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define DLL_INTERNAL __declspec( dllexport )
|
||||
|
||||
#define u8 unsigned char
|
||||
#define u16 unsigned short
|
||||
#define u32 unsigned int
|
||||
#define u64 unsigned long
|
||||
|
||||
#define __u8 unsigned char
|
||||
#define __u16 unsigned short
|
||||
#define __u32 unsigned int
|
||||
#define __u64 unsigned long
|
||||
#define uint8_t unsigned char
|
||||
#define uint16_t unsigned short
|
||||
#define uint32_t unsigned int
|
||||
#define uint64_t unsigned long
|
||||
#define __le8 unsigned char
|
||||
#define __le16 unsigned short
|
||||
#define __le32 unsigned int
|
||||
#define __le64 unsigned long
|
||||
#define __s8 signed char
|
||||
#define __s16 signed short
|
||||
#define __s32 signed int
|
||||
#define __s64 signed long
|
||||
#define uint unsigned int
|
||||
#define ulong unsigned long
|
||||
|
||||
#define socklen_t int
|
||||
|
||||
#define bool int
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#define size_t SIZE_T
|
||||
#define ssize_t SSIZE_T
|
||||
|
||||
struct mutex {
|
||||
CRITICAL_SECTION lock;
|
||||
};
|
||||
|
||||
inline void mutex_init(struct mutex* mutex) {
|
||||
InitializeCriticalSection(&mutex->lock);
|
||||
}
|
||||
|
||||
inline void mutex_lock(struct mutex* mutex) {
|
||||
EnterCriticalSection(&mutex->lock);
|
||||
}
|
||||
|
||||
inline void mutex_unlock(struct mutex* mutex) {
|
||||
LeaveCriticalSection(&mutex->lock);
|
||||
}
|
||||
|
||||
inline int mutex_trylock(struct mutex* mutex) {
|
||||
return TryEnterCriticalSection(&mutex->lock);
|
||||
}
|
||||
|
||||
inline int mutex_is_locked(struct mutex* mutex) {
|
||||
if (mutex_trylock(mutex)) {
|
||||
mutex_unlock(mutex);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline void set_bit(int nr, volatile unsigned long *addr) {
|
||||
int *a = (int *)addr;
|
||||
int mask;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
*a |= mask;
|
||||
}
|
||||
#define __set_bit set_bit
|
||||
|
||||
inline void clear_bit(int nr, volatile unsigned long *addr) {
|
||||
int *a = (int *)addr;
|
||||
int mask;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
*a &= ~mask;
|
||||
}
|
||||
|
||||
inline int test_bit(int nr, const void *addr) {
|
||||
int *a = (int *)addr;
|
||||
int mask;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
return ((mask & *a) != 0);
|
||||
}
|
||||
|
||||
#endif /* KERNEL_H_ */
|
||||
170
dependencies/openrazer-win32/linux/module.h
vendored
170
dependencies/openrazer-win32/linux/module.h
vendored
@@ -1,170 +0,0 @@
|
||||
#ifndef MODULE_H_
|
||||
#define MODULE_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <Winusb.h>
|
||||
|
||||
#define MODULE_AUTHOR( __Declaration__ )
|
||||
#define MODULE_DESCRIPTION( __Declaration__ )
|
||||
#define MODULE_VERSION( __Declaration__ )
|
||||
#define MODULE_LICENSE( __Declaration__ )
|
||||
|
||||
#define USB_CTRL_SET_TIMEOUT 5000
|
||||
|
||||
#define USB_DIR_OUT 0
|
||||
#define USB_DIR_IN 0x80
|
||||
|
||||
#define USB_TYPE_CLASS (0x01 << 5)
|
||||
#define USB_RECIP_INTERFACE 0x01
|
||||
|
||||
#define usb_sndctrlpipe(u,d) 0
|
||||
#define usb_rcvctrlpipe(u,d) 0
|
||||
|
||||
#define PATH_MAX 512
|
||||
|
||||
struct usb_interface_descriptor {
|
||||
unsigned char bInterfaceProtocol;
|
||||
};
|
||||
|
||||
struct usb_host_interface {
|
||||
struct usb_interface_descriptor desc;
|
||||
};
|
||||
|
||||
struct device {
|
||||
struct device *parent;
|
||||
void *p;
|
||||
const char *init_name;
|
||||
struct bus_type* bus;
|
||||
void *driver_data;
|
||||
unsigned int attr_count;
|
||||
struct device_attribute * attr_list[64];
|
||||
struct usb_interface *parent_usb_interface;
|
||||
};
|
||||
|
||||
struct usb_interface {
|
||||
struct device* dev;
|
||||
int num_altsetting;
|
||||
struct usb_host_interface *cur_altsetting;
|
||||
struct usb_device *parent_usb_device;
|
||||
};
|
||||
|
||||
struct usb_device_descriptor {
|
||||
unsigned short idVendor;
|
||||
unsigned short idProduct;
|
||||
};
|
||||
|
||||
struct usb_device {
|
||||
struct device* dev;
|
||||
struct usb_device_descriptor descriptor;
|
||||
};
|
||||
|
||||
inline int usb_control_msg(
|
||||
struct usb_device *usb_dev
|
||||
, int usb_pipe
|
||||
, unsigned int request
|
||||
, unsigned int request_type
|
||||
, unsigned int value
|
||||
, unsigned int report_index
|
||||
, unsigned char* buf, unsigned int size
|
||||
, unsigned int timeout)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Copy Linux API arguments into WinUSB format message |
|
||||
\*---------------------------------------------------------*/
|
||||
WINUSB_SETUP_PACKET packet;
|
||||
packet.RequestType = request_type;
|
||||
packet.Request = request;
|
||||
packet.Value = value;
|
||||
packet.Index = report_index;
|
||||
packet.Length = size;
|
||||
ULONG cbSent = 0;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Perform WinUSB USB control transfer |
|
||||
\*---------------------------------------------------------*/
|
||||
if (!WinUsb_ControlTransfer(usb_dev->dev->p, packet, buf, size, &cbSent, 0))
|
||||
{
|
||||
printf("WinUsb_ControlTransfer failed\n");
|
||||
}
|
||||
|
||||
return cbSent;
|
||||
}
|
||||
|
||||
inline struct usb_interface *to_usb_interface(struct device *dev) {
|
||||
return dev->parent_usb_interface;
|
||||
}
|
||||
|
||||
inline struct usb_device *to_usb_device(struct device *dev) {
|
||||
return dev->parent_usb_interface->parent_usb_device;
|
||||
}
|
||||
|
||||
inline struct usb_device *interface_to_usbdev(struct usb_interface *intf) {
|
||||
return to_usb_device(intf->dev->parent);
|
||||
}
|
||||
|
||||
inline void usb_disable_autosuspend(struct usb_device *usb_dev) {
|
||||
printf("usb_disable_autosuspend\n");
|
||||
}
|
||||
|
||||
struct device_attribute {
|
||||
const char* name;
|
||||
ssize_t(*show)(struct device *dev, struct device_attribute *attr, char *buf);
|
||||
ssize_t(*store)(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
|
||||
};
|
||||
|
||||
inline int device_create_file(struct device *device, struct device_attribute *entry)
|
||||
{
|
||||
if (device->attr_count < 64)
|
||||
{
|
||||
printf("device_create_file - Adding %s to list\n", entry->name);
|
||||
device->attr_list[device->attr_count] = entry;
|
||||
device->attr_count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("device_create_file - List is full\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline void device_remove_file(struct device *device, struct device_attribute *entry) {
|
||||
printf("device_remove_file %s\n", entry->name);
|
||||
}
|
||||
|
||||
#define HID_USB_DEVICE(ven, prod) \
|
||||
.vendor = (ven) \
|
||||
, .product = (prod)
|
||||
|
||||
|
||||
#define __stringify(x) #x
|
||||
|
||||
// Hack to turn Linux device macros into API calls
|
||||
#define DEVICE_ATTR1(_device,_name, _mode, _show, _store) \
|
||||
struct device_attribute dev_attr_##_name = { \
|
||||
.name = __stringify(_name) \
|
||||
, .show = _show \
|
||||
, .store = _store \
|
||||
}; \
|
||||
DLL_INTERNAL struct device_attribute dev##_device##_attr_##_name = { \
|
||||
.name = __stringify(_name) \
|
||||
, .show = _show \
|
||||
, .store = _store \
|
||||
};
|
||||
|
||||
#define MODULE_DEVICE_TABLE(type, name)
|
||||
|
||||
/*typedef struct hid_device_array_tag {
|
||||
unsigned int count;
|
||||
struct hid_device* hdev[];
|
||||
} hid_device_array;*/
|
||||
|
||||
#define module_hid_driver(hdr) \
|
||||
DLL_INTERNAL unsigned int init_##hdr## (struct hid_device** hdevo) { \
|
||||
unsigned int numHdevs = 0; \
|
||||
struct hid_device* hdev = NULL; \
|
||||
openChromaDevice(&hdev, &numHdevs, hdr); \
|
||||
*hdevo = hdev; \
|
||||
return numHdevs; \
|
||||
}
|
||||
|
||||
#endif /* MODULE_H_ */
|
||||
16
dependencies/openrazer-win32/linux/random.h
vendored
16
dependencies/openrazer-win32/linux/random.h
vendored
@@ -1,16 +0,0 @@
|
||||
#ifndef RANDOM_H_
|
||||
#define RANDOM_H_
|
||||
|
||||
static inline void get_random_bytes(void* rand_ptr, unsigned int rand_size) {
|
||||
char failed = 0;
|
||||
static HCRYPTPROV prov = 0;
|
||||
if (prov == 0) {
|
||||
if (!CryptAcquireContext(&prov, NULL, NULL, PROV_RSA_FULL, 0))
|
||||
failed = 1;
|
||||
}
|
||||
if (!failed && !CryptGenRandom(prov, rand_size, (unsigned char*)rand_ptr))
|
||||
printf("get_random_bytes failed\n");
|
||||
}
|
||||
|
||||
|
||||
#endif /* RANDOM_H_ */
|
||||
31
dependencies/openrazer-win32/linux/slab.h
vendored
31
dependencies/openrazer-win32/linux/slab.h
vendored
@@ -1,31 +0,0 @@
|
||||
#ifndef SLAB_H_
|
||||
#define SLAB_H_
|
||||
|
||||
typedef enum {
|
||||
GFP_KERNEL,
|
||||
GFP_ATOMIC,
|
||||
__GFP_HIGHMEM,
|
||||
__GFP_HIGH
|
||||
} gfp_t;
|
||||
|
||||
static inline void *kzalloc(size_t s, gfp_t gfp) {
|
||||
void *p = malloc(s);
|
||||
|
||||
memset(p, 0, s);
|
||||
return p;
|
||||
}
|
||||
|
||||
inline void *kmemdup(const void *src, size_t len, gfp_t gfp) {
|
||||
void *p;
|
||||
p = malloc(len);
|
||||
if (p)
|
||||
memcpy(p, src, len);
|
||||
return p;
|
||||
}
|
||||
|
||||
static inline void kfree(const void* p) {
|
||||
free((void*)p);
|
||||
}
|
||||
|
||||
|
||||
#endif /* SLAB_H_ */
|
||||
539
dependencies/openrazer-win32/linux/usb/input.h
vendored
539
dependencies/openrazer-win32/linux/usb/input.h
vendored
@@ -1,539 +0,0 @@
|
||||
#ifndef INPUT_H_
|
||||
#define INPUT_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define uint unsigned int
|
||||
#define ulong unsigned long
|
||||
#define u8 unsigned char
|
||||
#define u16 unsigned short
|
||||
#define u32 unsigned int
|
||||
#define u64 unsigned long
|
||||
|
||||
#define ABS_VOLUME 0x20
|
||||
|
||||
//input-event-codes.h
|
||||
#define KEY_RESERVED 0
|
||||
#define KEY_ESC 1
|
||||
#define KEY_1 2
|
||||
#define KEY_2 3
|
||||
#define KEY_3 4
|
||||
#define KEY_4 5
|
||||
#define KEY_5 6
|
||||
#define KEY_6 7
|
||||
#define KEY_7 8
|
||||
#define KEY_8 9
|
||||
#define KEY_9 10
|
||||
#define KEY_0 11
|
||||
#define KEY_MINUS 12
|
||||
#define KEY_EQUAL 13
|
||||
#define KEY_BACKSPACE 14
|
||||
#define KEY_TAB 15
|
||||
#define KEY_Q 16
|
||||
#define KEY_W 17
|
||||
#define KEY_E 18
|
||||
#define KEY_R 19
|
||||
#define KEY_T 20
|
||||
#define KEY_Y 21
|
||||
#define KEY_U 22
|
||||
#define KEY_I 23
|
||||
#define KEY_O 24
|
||||
#define KEY_P 25
|
||||
#define KEY_LEFTBRACE 26
|
||||
#define KEY_RIGHTBRACE 27
|
||||
#define KEY_ENTER 28
|
||||
#define KEY_LEFTCTRL 29
|
||||
#define KEY_A 30
|
||||
#define KEY_S 31
|
||||
#define KEY_D 32
|
||||
#define KEY_F 33
|
||||
#define KEY_G 34
|
||||
#define KEY_H 35
|
||||
#define KEY_J 36
|
||||
#define KEY_K 37
|
||||
#define KEY_L 38
|
||||
#define KEY_SEMICOLON 39
|
||||
#define KEY_APOSTROPHE 40
|
||||
#define KEY_GRAVE 41
|
||||
#define KEY_LEFTSHIFT 42
|
||||
#define KEY_BACKSLASH 43
|
||||
#define KEY_Z 44
|
||||
#define KEY_X 45
|
||||
#define KEY_C 46
|
||||
#define KEY_V 47
|
||||
#define KEY_B 48
|
||||
#define KEY_N 49
|
||||
#define KEY_M 50
|
||||
#define KEY_COMMA 51
|
||||
#define KEY_DOT 52
|
||||
#define KEY_SLASH 53
|
||||
#define KEY_RIGHTSHIFT 54
|
||||
#define KEY_KPASTERISK 55
|
||||
#define KEY_LEFTALT 56
|
||||
#define KEY_SPACE 57
|
||||
#define KEY_CAPSLOCK 58
|
||||
#define KEY_F1 59
|
||||
#define KEY_F2 60
|
||||
#define KEY_F3 61
|
||||
#define KEY_F4 62
|
||||
#define KEY_F5 63
|
||||
#define KEY_F6 64
|
||||
#define KEY_F7 65
|
||||
#define KEY_F8 66
|
||||
#define KEY_F9 67
|
||||
#define KEY_F10 68
|
||||
#define KEY_NUMLOCK 69
|
||||
#define KEY_SCROLLLOCK 70
|
||||
#define KEY_KP7 71
|
||||
#define KEY_KP8 72
|
||||
#define KEY_KP9 73
|
||||
#define KEY_KPMINUS 74
|
||||
#define KEY_KP4 75
|
||||
#define KEY_KP5 76
|
||||
#define KEY_KP6 77
|
||||
#define KEY_KPPLUS 78
|
||||
#define KEY_KP1 79
|
||||
#define KEY_KP2 80
|
||||
#define KEY_KP3 81
|
||||
#define KEY_KP0 82
|
||||
#define KEY_KPDOT 83
|
||||
|
||||
#define KEY_ZENKAKUHANKAKU 85
|
||||
#define KEY_102ND 86
|
||||
#define KEY_F11 87
|
||||
#define KEY_F12 88
|
||||
#define KEY_RO 89
|
||||
#define KEY_KATAKANA 90
|
||||
#define KEY_HIRAGANA 91
|
||||
#define KEY_HENKAN 92
|
||||
#define KEY_KATAKANAHIRAGANA 93
|
||||
#define KEY_MUHENKAN 94
|
||||
#define KEY_KPJPCOMMA 95
|
||||
#define KEY_KPENTER 96
|
||||
#define KEY_RIGHTCTRL 97
|
||||
#define KEY_KPSLASH 98
|
||||
#define KEY_SYSRQ 99
|
||||
#define KEY_RIGHTALT 100
|
||||
#define KEY_LINEFEED 101
|
||||
#define KEY_HOME 102
|
||||
#define KEY_UP 103
|
||||
#define KEY_PAGEUP 104
|
||||
#define KEY_LEFT 105
|
||||
#define KEY_RIGHT 106
|
||||
#define KEY_END 107
|
||||
#define KEY_DOWN 108
|
||||
#define KEY_PAGEDOWN 109
|
||||
#define KEY_INSERT 110
|
||||
#define KEY_DELETE 111
|
||||
#define KEY_MACRO 112
|
||||
#define KEY_MUTE 113
|
||||
#define KEY_VOLUMEDOWN 114
|
||||
#define KEY_VOLUMEUP 115
|
||||
#define KEY_POWER 116 /* SC System Power Down */
|
||||
#define KEY_KPEQUAL 117
|
||||
#define KEY_KPPLUSMINUS 118
|
||||
#define KEY_PAUSE 119
|
||||
#define KEY_SCALE 120 /* AL Compiz Scale (Expose) */
|
||||
|
||||
#define KEY_KPCOMMA 121
|
||||
#define KEY_HANGEUL 122
|
||||
#define KEY_HANGUEL KEY_HANGEUL
|
||||
#define KEY_HANJA 123
|
||||
#define KEY_YEN 124
|
||||
#define KEY_LEFTMETA 125
|
||||
#define KEY_RIGHTMETA 126
|
||||
#define KEY_COMPOSE 127
|
||||
|
||||
#define KEY_STOP 128 /* AC Stop */
|
||||
#define KEY_AGAIN 129
|
||||
#define KEY_PROPS 130 /* AC Properties */
|
||||
#define KEY_UNDO 131 /* AC Undo */
|
||||
#define KEY_FRONT 132
|
||||
#define KEY_COPY 133 /* AC Copy */
|
||||
#define KEY_OPEN 134 /* AC Open */
|
||||
#define KEY_PASTE 135 /* AC Paste */
|
||||
#define KEY_FIND 136 /* AC Search */
|
||||
#define KEY_CUT 137 /* AC Cut */
|
||||
#define KEY_HELP 138 /* AL Integrated Help Center */
|
||||
#define KEY_MENU 139 /* Menu (show menu) */
|
||||
#define KEY_CALC 140 /* AL Calculator */
|
||||
#define KEY_SETUP 141
|
||||
#define KEY_SLEEP 142 /* SC System Sleep */
|
||||
#define KEY_WAKEUP 143 /* System Wake Up */
|
||||
#define KEY_FILE 144 /* AL Local Machine Browser */
|
||||
#define KEY_SENDFILE 145
|
||||
#define KEY_DELETEFILE 146
|
||||
#define KEY_XFER 147
|
||||
#define KEY_PROG1 148
|
||||
#define KEY_PROG2 149
|
||||
#define KEY_WWW 150 /* AL Internet Browser */
|
||||
#define KEY_MSDOS 151
|
||||
#define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */
|
||||
#define KEY_SCREENLOCK KEY_COFFEE
|
||||
#define KEY_DIRECTION 153
|
||||
#define KEY_CYCLEWINDOWS 154
|
||||
#define KEY_MAIL 155
|
||||
#define KEY_BOOKMARKS 156 /* AC Bookmarks */
|
||||
#define KEY_COMPUTER 157
|
||||
#define KEY_BACK 158 /* AC Back */
|
||||
#define KEY_FORWARD 159 /* AC Forward */
|
||||
#define KEY_CLOSECD 160
|
||||
#define KEY_EJECTCD 161
|
||||
#define KEY_EJECTCLOSECD 162
|
||||
#define KEY_NEXTSONG 163
|
||||
#define KEY_PLAYPAUSE 164
|
||||
#define KEY_PREVIOUSSONG 165
|
||||
#define KEY_STOPCD 166
|
||||
#define KEY_RECORD 167
|
||||
#define KEY_REWIND 168
|
||||
#define KEY_PHONE 169 /* Media Select Telephone */
|
||||
#define KEY_ISO 170
|
||||
#define KEY_CONFIG 171 /* AL Consumer Control Configuration */
|
||||
#define KEY_HOMEPAGE 172 /* AC Home */
|
||||
#define KEY_REFRESH 173 /* AC Refresh */
|
||||
#define KEY_EXIT 174 /* AC Exit */
|
||||
#define KEY_MOVE 175
|
||||
#define KEY_EDIT 176
|
||||
#define KEY_SCROLLUP 177
|
||||
#define KEY_SCROLLDOWN 178
|
||||
#define KEY_KPLEFTPAREN 179
|
||||
#define KEY_KPRIGHTPAREN 180
|
||||
#define KEY_NEW 181 /* AC New */
|
||||
#define KEY_REDO 182 /* AC Redo/Repeat */
|
||||
|
||||
#define KEY_F13 183
|
||||
#define KEY_F14 184
|
||||
#define KEY_F15 185
|
||||
#define KEY_F16 186
|
||||
#define KEY_F17 187
|
||||
#define KEY_F18 188
|
||||
#define KEY_F19 189
|
||||
#define KEY_F20 190
|
||||
#define KEY_F21 191
|
||||
#define KEY_F22 192
|
||||
#define KEY_F23 193
|
||||
#define KEY_F24 194
|
||||
|
||||
#define KEY_PLAYCD 200
|
||||
#define KEY_PAUSECD 201
|
||||
#define KEY_PROG3 202
|
||||
#define KEY_PROG4 203
|
||||
#define KEY_DASHBOARD 204 /* AL Dashboard */
|
||||
#define KEY_SUSPEND 205
|
||||
#define KEY_CLOSE 206 /* AC Close */
|
||||
#define KEY_PLAY 207
|
||||
#define KEY_FASTFORWARD 208
|
||||
#define KEY_BASSBOOST 209
|
||||
#define KEY_PRINT 210 /* AC Print */
|
||||
#define KEY_HP 211
|
||||
#define KEY_CAMERA 212
|
||||
#define KEY_SOUND 213
|
||||
#define KEY_QUESTION 214
|
||||
#define KEY_EMAIL 215
|
||||
#define KEY_CHAT 216
|
||||
#define KEY_SEARCH 217
|
||||
#define KEY_CONNECT 218
|
||||
#define KEY_FINANCE 219 /* AL Checkbook/Finance */
|
||||
#define KEY_SPORT 220
|
||||
#define KEY_SHOP 221
|
||||
#define KEY_ALTERASE 222
|
||||
#define KEY_CANCEL 223 /* AC Cancel */
|
||||
#define KEY_BRIGHTNESSDOWN 224
|
||||
#define KEY_BRIGHTNESSUP 225
|
||||
#define KEY_MEDIA 226
|
||||
|
||||
#define KEY_SWITCHVIDEOMODE 227 /* Cycle between available video
|
||||
outputs (Monitor/LCD/TV-out/etc) */
|
||||
#define KEY_KBDILLUMTOGGLE 228
|
||||
#define KEY_KBDILLUMDOWN 229
|
||||
#define KEY_KBDILLUMUP 230
|
||||
|
||||
#define KEY_SEND 231 /* AC Send */
|
||||
#define KEY_REPLY 232 /* AC Reply */
|
||||
#define KEY_FORWARDMAIL 233 /* AC Forward Msg */
|
||||
#define KEY_SAVE 234 /* AC Save */
|
||||
#define KEY_DOCUMENTS 235
|
||||
|
||||
#define KEY_BATTERY 236
|
||||
|
||||
#define KEY_BLUETOOTH 237
|
||||
#define KEY_WLAN 238
|
||||
#define KEY_UWB 239
|
||||
|
||||
#define KEY_UNKNOWN 240
|
||||
|
||||
#define KEY_VIDEO_NEXT 241 /* drive next video source */
|
||||
#define KEY_VIDEO_PREV 242 /* drive previous video source */
|
||||
#define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */
|
||||
#define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */
|
||||
#define KEY_DISPLAY_OFF 245 /* display device to off state */
|
||||
|
||||
#define KEY_WIMAX 246
|
||||
|
||||
/* Range 248 - 255 is reserved for special needs of AT keyboard driver */
|
||||
|
||||
#define BTN_MISC 0x100
|
||||
#define BTN_0 0x100
|
||||
#define BTN_1 0x101
|
||||
#define BTN_2 0x102
|
||||
#define BTN_3 0x103
|
||||
#define BTN_4 0x104
|
||||
#define BTN_5 0x105
|
||||
#define BTN_6 0x106
|
||||
#define BTN_7 0x107
|
||||
#define BTN_8 0x108
|
||||
#define BTN_9 0x109
|
||||
|
||||
#define BTN_MOUSE 0x110
|
||||
#define BTN_LEFT 0x110
|
||||
#define BTN_RIGHT 0x111
|
||||
#define BTN_MIDDLE 0x112
|
||||
#define BTN_SIDE 0x113
|
||||
#define BTN_EXTRA 0x114
|
||||
#define BTN_FORWARD 0x115
|
||||
#define BTN_BACK 0x116
|
||||
#define BTN_TASK 0x117
|
||||
|
||||
#define BTN_JOYSTICK 0x120
|
||||
#define BTN_TRIGGER 0x120
|
||||
#define BTN_THUMB 0x121
|
||||
#define BTN_THUMB2 0x122
|
||||
#define BTN_TOP 0x123
|
||||
#define BTN_TOP2 0x124
|
||||
#define BTN_PINKIE 0x125
|
||||
#define BTN_BASE 0x126
|
||||
#define BTN_BASE2 0x127
|
||||
#define BTN_BASE3 0x128
|
||||
#define BTN_BASE4 0x129
|
||||
#define BTN_BASE5 0x12a
|
||||
#define BTN_BASE6 0x12b
|
||||
#define BTN_DEAD 0x12f
|
||||
|
||||
#define BTN_GAMEPAD 0x130
|
||||
#define BTN_A 0x130
|
||||
#define BTN_B 0x131
|
||||
#define BTN_C 0x132
|
||||
#define BTN_X 0x133
|
||||
#define BTN_Y 0x134
|
||||
#define BTN_Z 0x135
|
||||
#define BTN_TL 0x136
|
||||
#define BTN_TR 0x137
|
||||
#define BTN_TL2 0x138
|
||||
#define BTN_TR2 0x139
|
||||
#define BTN_SELECT 0x13a
|
||||
#define BTN_START 0x13b
|
||||
#define BTN_MODE 0x13c
|
||||
#define BTN_THUMBL 0x13d
|
||||
#define BTN_THUMBR 0x13e
|
||||
|
||||
#define BTN_DIGI 0x140
|
||||
#define BTN_TOOL_PEN 0x140
|
||||
#define BTN_TOOL_RUBBER 0x141
|
||||
#define BTN_TOOL_BRUSH 0x142
|
||||
#define BTN_TOOL_PENCIL 0x143
|
||||
#define BTN_TOOL_AIRBRUSH 0x144
|
||||
#define BTN_TOOL_FINGER 0x145
|
||||
#define BTN_TOOL_MOUSE 0x146
|
||||
#define BTN_TOOL_LENS 0x147
|
||||
#define BTN_TOUCH 0x14a
|
||||
#define BTN_STYLUS 0x14b
|
||||
#define BTN_STYLUS2 0x14c
|
||||
#define BTN_TOOL_DOUBLETAP 0x14d
|
||||
#define BTN_TOOL_TRIPLETAP 0x14e
|
||||
#define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */
|
||||
|
||||
#define BTN_WHEEL 0x150
|
||||
#define BTN_GEAR_DOWN 0x150
|
||||
#define BTN_GEAR_UP 0x151
|
||||
|
||||
#define KEY_OK 0x160
|
||||
#define KEY_SELECT 0x161
|
||||
#define KEY_GOTO 0x162
|
||||
#define KEY_CLEAR 0x163
|
||||
#define KEY_POWER2 0x164
|
||||
#define KEY_OPTION 0x165
|
||||
#define KEY_INFO 0x166 /* AL OEM Features/Tips/Tutorial */
|
||||
#define KEY_TIME 0x167
|
||||
#define KEY_VENDOR 0x168
|
||||
#define KEY_ARCHIVE 0x169
|
||||
#define KEY_PROGRAM 0x16a /* Media Select Program Guide */
|
||||
#define KEY_CHANNEL 0x16b
|
||||
#define KEY_FAVORITES 0x16c
|
||||
#define KEY_EPG 0x16d
|
||||
#define KEY_PVR 0x16e /* Media Select Home */
|
||||
#define KEY_MHP 0x16f
|
||||
#define KEY_LANGUAGE 0x170
|
||||
#define KEY_TITLE 0x171
|
||||
#define KEY_SUBTITLE 0x172
|
||||
#define KEY_ANGLE 0x173
|
||||
#define KEY_ZOOM 0x174
|
||||
#define KEY_MODE 0x175
|
||||
#define KEY_KEYBOARD 0x176
|
||||
#define KEY_SCREEN 0x177
|
||||
#define KEY_PC 0x178 /* Media Select Computer */
|
||||
#define KEY_TV 0x179 /* Media Select TV */
|
||||
#define KEY_TV2 0x17a /* Media Select Cable */
|
||||
#define KEY_VCR 0x17b /* Media Select VCR */
|
||||
#define KEY_VCR2 0x17c /* VCR Plus */
|
||||
#define KEY_SAT 0x17d /* Media Select Satellite */
|
||||
#define KEY_SAT2 0x17e
|
||||
#define KEY_CD 0x17f /* Media Select CD */
|
||||
#define KEY_TAPE 0x180 /* Media Select Tape */
|
||||
#define KEY_RADIO 0x181
|
||||
#define KEY_TUNER 0x182 /* Media Select Tuner */
|
||||
#define KEY_PLAYER 0x183
|
||||
#define KEY_TEXT 0x184
|
||||
#define KEY_DVD 0x185 /* Media Select DVD */
|
||||
#define KEY_AUX 0x186
|
||||
#define KEY_MP3 0x187
|
||||
#define KEY_AUDIO 0x188
|
||||
#define KEY_VIDEO 0x189
|
||||
#define KEY_DIRECTORY 0x18a
|
||||
#define KEY_LIST 0x18b
|
||||
#define KEY_MEMO 0x18c /* Media Select Messages */
|
||||
#define KEY_CALENDAR 0x18d
|
||||
#define KEY_RED 0x18e
|
||||
#define KEY_GREEN 0x18f
|
||||
#define KEY_YELLOW 0x190
|
||||
#define KEY_BLUE 0x191
|
||||
#define KEY_CHANNELUP 0x192 /* Channel Increment */
|
||||
#define KEY_CHANNELDOWN 0x193 /* Channel Decrement */
|
||||
#define KEY_FIRST 0x194
|
||||
#define KEY_LAST 0x195 /* Recall Last */
|
||||
#define KEY_AB 0x196
|
||||
#define KEY_NEXT 0x197
|
||||
#define KEY_RESTART 0x198
|
||||
#define KEY_SLOW 0x199
|
||||
#define KEY_SHUFFLE 0x19a
|
||||
#define KEY_BREAK 0x19b
|
||||
#define KEY_PREVIOUS 0x19c
|
||||
#define KEY_DIGITS 0x19d
|
||||
#define KEY_TEEN 0x19e
|
||||
#define KEY_TWEN 0x19f
|
||||
#define KEY_VIDEOPHONE 0x1a0 /* Media Select Video Phone */
|
||||
#define KEY_GAMES 0x1a1 /* Media Select Games */
|
||||
#define KEY_ZOOMIN 0x1a2 /* AC Zoom In */
|
||||
#define KEY_ZOOMOUT 0x1a3 /* AC Zoom Out */
|
||||
#define KEY_ZOOMRESET 0x1a4 /* AC Zoom */
|
||||
#define KEY_WORDPROCESSOR 0x1a5 /* AL Word Processor */
|
||||
#define KEY_EDITOR 0x1a6 /* AL Text Editor */
|
||||
#define KEY_SPREADSHEET 0x1a7 /* AL Spreadsheet */
|
||||
#define KEY_GRAPHICSEDITOR 0x1a8 /* AL Graphics Editor */
|
||||
#define KEY_PRESENTATION 0x1a9 /* AL Presentation App */
|
||||
#define KEY_DATABASE 0x1aa /* AL Database App */
|
||||
#define KEY_NEWS 0x1ab /* AL Newsreader */
|
||||
#define KEY_VOICEMAIL 0x1ac /* AL Voicemail */
|
||||
#define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */
|
||||
#define KEY_MESSENGER 0x1ae /* AL Instant Messaging */
|
||||
#define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */
|
||||
#define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */
|
||||
#define KEY_LOGOFF 0x1b1 /* AL Logoff */
|
||||
|
||||
#define KEY_DOLLAR 0x1b2
|
||||
#define KEY_EURO 0x1b3
|
||||
|
||||
#define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */
|
||||
#define KEY_FRAMEFORWARD 0x1b5
|
||||
#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */
|
||||
#define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */
|
||||
|
||||
#define KEY_DEL_EOL 0x1c0
|
||||
#define KEY_DEL_EOS 0x1c1
|
||||
#define KEY_INS_LINE 0x1c2
|
||||
#define KEY_DEL_LINE 0x1c3
|
||||
|
||||
#define KEY_FN 0x1d0
|
||||
#define KEY_FN_ESC 0x1d1
|
||||
#define KEY_FN_F1 0x1d2
|
||||
#define KEY_FN_F2 0x1d3
|
||||
#define KEY_FN_F3 0x1d4
|
||||
#define KEY_FN_F4 0x1d5
|
||||
#define KEY_FN_F5 0x1d6
|
||||
#define KEY_FN_F6 0x1d7
|
||||
#define KEY_FN_F7 0x1d8
|
||||
#define KEY_FN_F8 0x1d9
|
||||
#define KEY_FN_F9 0x1da
|
||||
#define KEY_FN_F10 0x1db
|
||||
#define KEY_FN_F11 0x1dc
|
||||
#define KEY_FN_F12 0x1dd
|
||||
#define KEY_FN_1 0x1de
|
||||
#define KEY_FN_2 0x1df
|
||||
#define KEY_FN_D 0x1e0
|
||||
#define KEY_FN_E 0x1e1
|
||||
#define KEY_FN_F 0x1e2
|
||||
#define KEY_FN_S 0x1e3
|
||||
#define KEY_FN_B 0x1e4
|
||||
|
||||
#define KEY_BRL_DOT1 0x1f1
|
||||
#define KEY_BRL_DOT2 0x1f2
|
||||
#define KEY_BRL_DOT3 0x1f3
|
||||
#define KEY_BRL_DOT4 0x1f4
|
||||
#define KEY_BRL_DOT5 0x1f5
|
||||
#define KEY_BRL_DOT6 0x1f6
|
||||
#define KEY_BRL_DOT7 0x1f7
|
||||
#define KEY_BRL_DOT8 0x1f8
|
||||
#define KEY_BRL_DOT9 0x1f9
|
||||
#define KEY_BRL_DOT10 0x1fa
|
||||
|
||||
#define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */
|
||||
#define KEY_NUMERIC_1 0x201 /* and other keypads */
|
||||
#define KEY_NUMERIC_2 0x202
|
||||
#define KEY_NUMERIC_3 0x203
|
||||
#define KEY_NUMERIC_4 0x204
|
||||
#define KEY_NUMERIC_5 0x205
|
||||
#define KEY_NUMERIC_6 0x206
|
||||
#define KEY_NUMERIC_7 0x207
|
||||
#define KEY_NUMERIC_8 0x208
|
||||
#define KEY_NUMERIC_9 0x209
|
||||
#define KEY_NUMERIC_STAR 0x20a
|
||||
#define KEY_NUMERIC_POUND 0x20b
|
||||
|
||||
/* We avoid low common keys in module aliases so they don't get huge. */
|
||||
#define KEY_MIN_INTERESTING KEY_MUTE
|
||||
#define KEY_MAX 0x2ff
|
||||
#define KEY_CNT (KEY_MAX+1)
|
||||
|
||||
#define EV_SYN 0x00
|
||||
#define EV_KEY 0x01
|
||||
#define EV_REL 0x02
|
||||
#define EV_ABS 0x03
|
||||
#define EV_MSC 0x04
|
||||
#define EV_SW 0x05
|
||||
#define EV_LED 0x11
|
||||
#define EV_SND 0x12
|
||||
#define EV_REP 0x14
|
||||
#define EV_FF 0x15
|
||||
#define EV_PWR 0x16
|
||||
#define EV_FF_STATUS 0x17
|
||||
#define EV_MAX 0x1f
|
||||
#define EV_CNT (EV_MAX+1)
|
||||
|
||||
#define SYN_REPORT 0
|
||||
|
||||
#define BITS_PER_BYTE 8
|
||||
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
|
||||
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
|
||||
#define DECLARE_BITMAP(name,bits) unsigned long name[BITS_TO_LONGS(bits)]
|
||||
|
||||
struct input_dev {
|
||||
const char *name;
|
||||
const char *phys;
|
||||
unsigned long evbit[BITS_TO_LONGS(EV_CNT)];
|
||||
unsigned long keybit[BITS_TO_LONGS(KEY_CNT)];
|
||||
};
|
||||
|
||||
static inline void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) {
|
||||
printf("input_event\n");
|
||||
}
|
||||
|
||||
static inline void input_report_key(struct input_dev *dev, unsigned int code, int value) {
|
||||
input_event(dev, EV_KEY, code, value);
|
||||
}
|
||||
|
||||
static inline void input_sync(struct input_dev *dev) {
|
||||
input_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||
}
|
||||
|
||||
|
||||
#endif /* INPUT_H_ */
|
||||
Reference in New Issue
Block a user