├── .gitmodules ├── CHANGES.md ├── OpenRazer.sln ├── OpenRazer.vcxproj ├── README.md ├── dependencies ├── hidapi-win │ ├── x64 │ │ ├── hidapi.dll │ │ └── hidapi.lib │ └── x86 │ │ ├── hidapi.dll │ │ └── hidapi.lib └── hidapi │ └── hidapi │ └── hidapi.h ├── linux ├── dmi.h ├── hid.h ├── hrtimer.h ├── init.h ├── kernel.h ├── module.h ├── random.h ├── slab.h └── usb │ └── input.h ├── winprojectexampledll ├── ChromaExampleDLL.vcxproj ├── ChromaExampleDLL.vcxproj.user ├── defines.h └── main.cpp └── winprojectexamplenodll ├── ChromaExampleNoDLL.vcxproj └── defines.h /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "openrazer"] 2 | path = openrazer 3 | url = https://github.com/CalcProgrammer1/openrazer 4 | -------------------------------------------------------------------------------- /CHANGES.md: -------------------------------------------------------------------------------- 1 | Changes that are from the Linux driver via WIN32 and WIN64 defines 2 | 3 | (1) Update (literal array terminator): 4 | ``` 5 | // C2059: syntax error: '}' 6 | #if defined(WIN32) || defined(_WIN64) 7 | { 0 } 8 | #else 9 | { } 10 | #endif 11 | ``` 12 | Applied to: 13 | ``` 14 | static const struct hid_device_id razer_devices[] = { 15 | static const struct razer_key_translation chroma_keys[] = { 16 | ``` 17 | in file(s): 18 | ``` 19 | razer*_driver.c 20 | ``` 21 | 22 | (2) Update (static for duplicate functions): 23 | ``` 24 | //LNK2005 already defined in razer*_driver.obj 25 | #if defined(WIN32) || defined(_WIN64) 26 | static 27 | #endif 28 | ``` 29 | Applied to: 30 | ``` 31 | struct razer_report razer_send_payload( 32 | int razer_get_report( 33 | void razer_set_device_mode( 34 | ``` 35 | in file(s): 36 | ``` 37 | razer*_driver.c 38 | ``` 39 | 40 | (3) Update (union cast): 41 | ``` 42 | //C2440 'type cast': cannot convert from 'unsigned char' to 43 | 'razer_kraken_effect_byte' 44 | #if defined(WIN32) || defined(_WIN64) 45 | unsigned char effect_byte1 = get_current_effect(dev); 46 | union razer_kraken_effect_byte effect_byte; 47 | memcpy(&effect_byte, &effect_byte1, sizeof(unsigned char)); 48 | #else 49 | union razer_kraken_effect_byte effect_byte = (union 50 | razer_kraken_effect_byte)get_current_effect(dev); 51 | #endif 52 | ``` 53 | Applied to: 54 | ``` 55 | static ssize_t razer_attr_read_mode_breath( 56 | ``` 57 | in file(s): 58 | ``` 59 | razerkraken_driver.c 60 | ``` 61 | 62 | (4) Update (device macro repurpose to DLL API calls): 63 | ``` 64 | #if defined(WIN32) || defined(_WIN64) 65 | #undef DEVICE_ATTR 66 | #define DEVICE_ATTR(_name, _mode, _show, _store) DEVICE_ATTR1(*, _name, 67 | _mode, _show, _store) 68 | #endif 69 | ``` 70 | Applied to: 71 | ``` 72 | static DEVICE_ATTR( 73 | ``` 74 | in file(s): 75 | ``` 76 | razer*_driver.c 77 | ``` 78 | -------------------------------------------------------------------------------- /OpenRazer.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29709.97 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenRazerExampleDLL", "winprojectexampledll\ChromaExampleDLL.vcxproj", "{720FE38F-432B-422C-AC23-00855B10313F}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {5D63D1FD-5530-4FA9-9B76-014C4235A690} = {5D63D1FD-5530-4FA9-9B76-014C4235A690} 9 | EndProjectSection 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenRazerExampleNoDLL", "winprojectexamplenodll\ChromaExampleNoDLL.vcxproj", "{72A1DC9D-32A9-423C-9638-EE544FE573BB}" 12 | EndProject 13 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenRazer", "OpenRazer.vcxproj", "{5D63D1FD-5530-4FA9-9B76-014C4235A690}" 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|x64 = Debug|x64 18 | Debug|x86 = Debug|x86 19 | Release|x64 = Release|x64 20 | Release|x86 = Release|x86 21 | EndGlobalSection 22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 23 | {720FE38F-432B-422C-AC23-00855B10313F}.Debug|x64.ActiveCfg = Debug|x64 24 | {720FE38F-432B-422C-AC23-00855B10313F}.Debug|x64.Build.0 = Debug|x64 25 | {720FE38F-432B-422C-AC23-00855B10313F}.Debug|x86.ActiveCfg = Debug|Win32 26 | {720FE38F-432B-422C-AC23-00855B10313F}.Debug|x86.Build.0 = Debug|Win32 27 | {720FE38F-432B-422C-AC23-00855B10313F}.Release|x64.ActiveCfg = Release|x64 28 | {720FE38F-432B-422C-AC23-00855B10313F}.Release|x64.Build.0 = Release|x64 29 | {720FE38F-432B-422C-AC23-00855B10313F}.Release|x86.ActiveCfg = Release|Win32 30 | {720FE38F-432B-422C-AC23-00855B10313F}.Release|x86.Build.0 = Release|Win32 31 | {72A1DC9D-32A9-423C-9638-EE544FE573BB}.Debug|x64.ActiveCfg = Debug|x64 32 | {72A1DC9D-32A9-423C-9638-EE544FE573BB}.Debug|x64.Build.0 = Debug|x64 33 | {72A1DC9D-32A9-423C-9638-EE544FE573BB}.Debug|x86.ActiveCfg = Debug|Win32 34 | {72A1DC9D-32A9-423C-9638-EE544FE573BB}.Debug|x86.Build.0 = Debug|Win32 35 | {72A1DC9D-32A9-423C-9638-EE544FE573BB}.Release|x64.ActiveCfg = Release|x64 36 | {72A1DC9D-32A9-423C-9638-EE544FE573BB}.Release|x64.Build.0 = Release|x64 37 | {72A1DC9D-32A9-423C-9638-EE544FE573BB}.Release|x86.ActiveCfg = Release|Win32 38 | {72A1DC9D-32A9-423C-9638-EE544FE573BB}.Release|x86.Build.0 = Release|Win32 39 | {5D63D1FD-5530-4FA9-9B76-014C4235A690}.Debug|x64.ActiveCfg = Debug|x64 40 | {5D63D1FD-5530-4FA9-9B76-014C4235A690}.Debug|x64.Build.0 = Debug|x64 41 | {5D63D1FD-5530-4FA9-9B76-014C4235A690}.Debug|x86.ActiveCfg = Debug|Win32 42 | {5D63D1FD-5530-4FA9-9B76-014C4235A690}.Debug|x86.Build.0 = Debug|Win32 43 | {5D63D1FD-5530-4FA9-9B76-014C4235A690}.Release|x64.ActiveCfg = Release|x64 44 | {5D63D1FD-5530-4FA9-9B76-014C4235A690}.Release|x64.Build.0 = Release|x64 45 | {5D63D1FD-5530-4FA9-9B76-014C4235A690}.Release|x86.ActiveCfg = Release|Win32 46 | {5D63D1FD-5530-4FA9-9B76-014C4235A690}.Release|x86.Build.0 = Release|Win32 47 | EndGlobalSection 48 | GlobalSection(SolutionProperties) = preSolution 49 | HideSolutionNode = FALSE 50 | EndGlobalSection 51 | GlobalSection(ExtensibilityGlobals) = postSolution 52 | SolutionGuid = {92822624-E6FE-4153-BB47-D7F5CF78BA37} 53 | EndGlobalSection 54 | EndGlobal 55 | -------------------------------------------------------------------------------- /OpenRazer.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {5D63D1FD-5530-4FA9-9B76-014C4235A690} 23 | Win32Proj 24 | 10.0 25 | OpenRazer 26 | 27 | 28 | 29 | DynamicLibrary 30 | true 31 | v142 32 | 33 | 34 | DynamicLibrary 35 | false 36 | v142 37 | 38 | 39 | DynamicLibrary 40 | true 41 | v142 42 | 43 | 44 | DynamicLibrary 45 | false 46 | v142 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | true 68 | $(Platform)\$(Configuration)\ 69 | $(SolutionDir) 70 | 71 | 72 | true 73 | $(Platform)\$(Configuration)\ 74 | $(SolutionDir) 75 | 76 | 77 | $(ProjectName)64 78 | $(SolutionDir) 79 | 80 | 81 | $(ProjectName)64 82 | $(SolutionDir) 83 | 84 | 85 | 86 | WIN32;_DEBUG;_WINDOWS;_USRDLL;CHROMADLL_EXPORTS;%(PreprocessorDefinitions) 87 | MultiThreadedDebugDLL 88 | Level3 89 | ProgramDatabase 90 | Disabled 91 | $(ProjectDir);dependencies\hidapi;%(AdditionalIncludeDirectories) 92 | true 93 | 94 | 95 | MachineX86 96 | true 97 | Windows 98 | %(AdditionalDependencies) 99 | $(ProjectDir)$(TargetName)$(TargetExt) 100 | dependencies\hidapi-win\x86;%(AdditionalLibraryDirectories) 101 | 102 | 103 | 104 | 105 | WIN32;NDEBUG;_WINDOWS;_USRDLL;CHROMADLL_EXPORTS;%(PreprocessorDefinitions) 106 | MultiThreadedDLL 107 | Level3 108 | ProgramDatabase 109 | $(ProjectDir);dependencies\hidapi;%(AdditionalIncludeDirectories) 110 | true 111 | 112 | 113 | MachineX86 114 | true 115 | Windows 116 | true 117 | true 118 | %(AdditionalDependencies) 119 | dependencies\hidapi-win\x86;%(AdditionalLibraryDirectories) 120 | 121 | 122 | 123 | 124 | $(ProjectDir);dependencies\hidapi;%(AdditionalIncludeDirectories) 125 | true 126 | 127 | 128 | %(AdditionalDependencies) 129 | $(ProjectDir)$(TargetName)$(TargetExt) 130 | dependencies\hidapi-win\x64;%(AdditionalLibraryDirectories) 131 | 132 | 133 | 134 | 135 | $(ProjectDir);dependencies\hidapi;%(AdditionalIncludeDirectories) 136 | true 137 | 138 | 139 | %(AdditionalDependencies) 140 | $(OutDir)$(TargetName)$(TargetExt) 141 | dependencies\hidapi-win\x64;%(AdditionalLibraryDirectories) 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OpenRazer-Win32 2 | 3 | Control Razer devices on Windows without Synapse or Chroma SDK using the open source OpenRazer driver. This project provides wrapper files that fill in for the Linux kernel headers and convert OpenRazer into a Windows DLL. 4 | 5 | ### Building 6 | 7 | Open OpenRazer.sln in the latest version of Visual Studio. I use VS2019 Community Edition. 8 | 9 | Build the desired OpenRazer-Win32 version. There are also two example apps provided. 64 bit debug version is default. 10 | 11 | ### Using 12 | 13 | Previous versions of this library used the WinUSB driver. It does not use this driver anymore, so please uninstall the WinUSB driver from any devices you may have installed it on before using this library. 14 | 15 | This project contains a main.cpp file which tests the various Chroma API calls on all Chroma devices found. 16 | 17 | This project is only a software library with a crude demonstration app. If you are a user who wants to control your Razer devices without Synapse, check out my OpenRGB project which uses this library: 18 | 19 | https://gitlab.com/CalcProgrammer1/OpenRGB 20 | -------------------------------------------------------------------------------- /dependencies/hidapi-win/x64/hidapi.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CalcProgrammer1/openrazer-win32/d67c289b150c1f638a0d4b785620a16b7548b487/dependencies/hidapi-win/x64/hidapi.dll -------------------------------------------------------------------------------- /dependencies/hidapi-win/x64/hidapi.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CalcProgrammer1/openrazer-win32/d67c289b150c1f638a0d4b785620a16b7548b487/dependencies/hidapi-win/x64/hidapi.lib -------------------------------------------------------------------------------- /dependencies/hidapi-win/x86/hidapi.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CalcProgrammer1/openrazer-win32/d67c289b150c1f638a0d4b785620a16b7548b487/dependencies/hidapi-win/x86/hidapi.dll -------------------------------------------------------------------------------- /dependencies/hidapi-win/x86/hidapi.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CalcProgrammer1/openrazer-win32/d67c289b150c1f638a0d4b785620a16b7548b487/dependencies/hidapi-win/x86/hidapi.lib -------------------------------------------------------------------------------- /dependencies/hidapi/hidapi/hidapi.h: -------------------------------------------------------------------------------- 1 | /******************************************************* 2 | HIDAPI - Multi-Platform library for 3 | communication with HID devices. 4 | 5 | Alan Ott 6 | Signal 11 Software 7 | 8 | 8/22/2009 9 | 10 | Copyright 2009, All Rights Reserved. 11 | 12 | At the discretion of the user of this library, 13 | this software may be licensed under the terms of the 14 | GNU General Public License v3, a BSD-Style license, or the 15 | original HIDAPI license as outlined in the LICENSE.txt, 16 | LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt 17 | files located at the root of the source distribution. 18 | These files may also be found in the public source 19 | code repository located at: 20 | http://github.com/signal11/hidapi . 21 | ********************************************************/ 22 | 23 | /** @file 24 | * @defgroup API hidapi API 25 | */ 26 | 27 | #ifndef HIDAPI_H__ 28 | #define HIDAPI_H__ 29 | 30 | #include 31 | 32 | #ifdef _WIN32 33 | #define HID_API_EXPORT 34 | #define HID_API_CALL 35 | #else 36 | #define HID_API_EXPORT /**< API export macro */ 37 | #define HID_API_CALL /**< API call macro */ 38 | #endif 39 | 40 | #define HID_API_EXPORT_CALL HID_API_EXPORT HID_API_CALL /**< API export and call macro*/ 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | struct hid_device_; 46 | typedef struct hid_device_ hidapi_device; /**< opaque hidapi structure */ 47 | 48 | /** hidapi info structure */ 49 | struct hid_device_info { 50 | /** Platform-specific device path */ 51 | char *path; 52 | /** Device Vendor ID */ 53 | unsigned short vendor_id; 54 | /** Device Product ID */ 55 | unsigned short product_id; 56 | /** Serial Number */ 57 | wchar_t *serial_number; 58 | /** Device Release Number in binary-coded decimal, 59 | also known as Device Version Number */ 60 | unsigned short release_number; 61 | /** Manufacturer String */ 62 | wchar_t *manufacturer_string; 63 | /** Product string */ 64 | wchar_t *product_string; 65 | /** Usage Page for this Device/Interface 66 | (Windows/Mac only). */ 67 | unsigned short usage_page; 68 | /** Usage for this Device/Interface 69 | (Windows/Mac only).*/ 70 | unsigned short usage; 71 | /** The USB interface which this logical device 72 | represents. Valid on both Linux implementations 73 | in all cases, and valid on the Windows implementation 74 | only if the device contains more than one interface. */ 75 | int interface_number; 76 | 77 | /** Pointer to the next device */ 78 | struct hid_device_info *next; 79 | }; 80 | 81 | 82 | /** @brief Initialize the HIDAPI library. 83 | 84 | This function initializes the HIDAPI library. Calling it is not 85 | strictly necessary, as it will be called automatically by 86 | hid_enumerate() and any of the hid_open_*() functions if it is 87 | needed. This function should be called at the beginning of 88 | execution however, if there is a chance of HIDAPI handles 89 | being opened by different threads simultaneously. 90 | 91 | @ingroup API 92 | 93 | @returns 94 | This function returns 0 on success and -1 on error. 95 | */ 96 | int HID_API_EXPORT HID_API_CALL hid_init(void); 97 | 98 | /** @brief Finalize the HIDAPI library. 99 | 100 | This function frees all of the static data associated with 101 | HIDAPI. It should be called at the end of execution to avoid 102 | memory leaks. 103 | 104 | @ingroup API 105 | 106 | @returns 107 | This function returns 0 on success and -1 on error. 108 | */ 109 | int HID_API_EXPORT HID_API_CALL hid_exit(void); 110 | 111 | /** @brief Enumerate the HID Devices. 112 | 113 | This function returns a linked list of all the HID devices 114 | attached to the system which match vendor_id and product_id. 115 | If @p vendor_id is set to 0 then any vendor matches. 116 | If @p product_id is set to 0 then any product matches. 117 | If @p vendor_id and @p product_id are both set to 0, then 118 | all HID devices will be returned. 119 | 120 | @ingroup API 121 | @param vendor_id The Vendor ID (VID) of the types of device 122 | to open. 123 | @param product_id The Product ID (PID) of the types of 124 | device to open. 125 | 126 | @returns 127 | This function returns a pointer to a linked list of type 128 | struct #hid_device, containing information about the HID devices 129 | attached to the system, or NULL in the case of failure. Free 130 | this linked list by calling hid_free_enumeration(). 131 | */ 132 | struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id); 133 | 134 | /** @brief Free an enumeration Linked List 135 | 136 | This function frees a linked list created by hid_enumerate(). 137 | 138 | @ingroup API 139 | @param devs Pointer to a list of struct_device returned from 140 | hid_enumerate(). 141 | */ 142 | void HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs); 143 | 144 | /** @brief Open a HID device using a Vendor ID (VID), Product ID 145 | (PID) and optionally a serial number. 146 | 147 | If @p serial_number is NULL, the first device with the 148 | specified VID and PID is opened. 149 | 150 | @ingroup API 151 | @param vendor_id The Vendor ID (VID) of the device to open. 152 | @param product_id The Product ID (PID) of the device to open. 153 | @param serial_number The Serial Number of the device to open 154 | (Optionally NULL). 155 | 156 | @returns 157 | This function returns a pointer to a #hid_device object on 158 | success or NULL on failure. 159 | */ 160 | HID_API_EXPORT hidapi_device * HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number); 161 | 162 | /** @brief Open a HID device by its path name. 163 | 164 | The path name be determined by calling hid_enumerate(), or a 165 | platform-specific path name can be used (eg: /dev/hidraw0 on 166 | Linux). 167 | 168 | @ingroup API 169 | @param path The path name of the device to open 170 | 171 | @returns 172 | This function returns a pointer to a #hid_device object on 173 | success or NULL on failure. 174 | */ 175 | HID_API_EXPORT hidapi_device* HID_API_CALL hid_open_path(const char *path); 176 | 177 | /** @brief Write an Output report to a HID device. 178 | 179 | The first byte of @p data[] must contain the Report ID. For 180 | devices which only support a single report, this must be set 181 | to 0x0. The remaining bytes contain the report data. Since 182 | the Report ID is mandatory, calls to hid_write() will always 183 | contain one more byte than the report contains. For example, 184 | if a hid report is 16 bytes long, 17 bytes must be passed to 185 | hid_write(), the Report ID (or 0x0, for devices with a 186 | single report), followed by the report data (16 bytes). In 187 | this example, the length passed in would be 17. 188 | 189 | hid_write() will send the data on the first OUT endpoint, if 190 | one exists. If it does not, it will send the data through 191 | the Control Endpoint (Endpoint 0). 192 | 193 | @ingroup API 194 | @param device A device handle returned from hid_open(). 195 | @param data The data to send, including the report number as 196 | the first byte. 197 | @param length The length in bytes of the data to send. 198 | 199 | @returns 200 | This function returns the actual number of bytes written and 201 | -1 on error. 202 | */ 203 | int HID_API_EXPORT HID_API_CALL hid_write(hidapi_device*device, const unsigned char *data, size_t length); 204 | 205 | /** @brief Read an Input report from a HID device with timeout. 206 | 207 | Input reports are returned 208 | to the host through the INTERRUPT IN endpoint. The first byte will 209 | contain the Report number if the device uses numbered reports. 210 | 211 | @ingroup API 212 | @param device A device handle returned from hid_open(). 213 | @param data A buffer to put the read data into. 214 | @param length The number of bytes to read. For devices with 215 | multiple reports, make sure to read an extra byte for 216 | the report number. 217 | @param milliseconds timeout in milliseconds or -1 for blocking wait. 218 | 219 | @returns 220 | This function returns the actual number of bytes read and 221 | -1 on error. If no packet was available to be read within 222 | the timeout period, this function returns 0. 223 | */ 224 | int HID_API_EXPORT HID_API_CALL hid_read_timeout(hidapi_device*dev, unsigned char *data, size_t length, int milliseconds); 225 | 226 | /** @brief Read an Input report from a HID device. 227 | 228 | Input reports are returned 229 | to the host through the INTERRUPT IN endpoint. The first byte will 230 | contain the Report number if the device uses numbered reports. 231 | 232 | @ingroup API 233 | @param device A device handle returned from hid_open(). 234 | @param data A buffer to put the read data into. 235 | @param length The number of bytes to read. For devices with 236 | multiple reports, make sure to read an extra byte for 237 | the report number. 238 | 239 | @returns 240 | This function returns the actual number of bytes read and 241 | -1 on error. If no packet was available to be read and 242 | the handle is in non-blocking mode, this function returns 0. 243 | */ 244 | int HID_API_EXPORT HID_API_CALL hid_read(hidapi_device*device, unsigned char *data, size_t length); 245 | 246 | /** @brief Set the device handle to be non-blocking. 247 | 248 | In non-blocking mode calls to hid_read() will return 249 | immediately with a value of 0 if there is no data to be 250 | read. In blocking mode, hid_read() will wait (block) until 251 | there is data to read before returning. 252 | 253 | Nonblocking can be turned on and off at any time. 254 | 255 | @ingroup API 256 | @param device A device handle returned from hid_open(). 257 | @param nonblock enable or not the nonblocking reads 258 | - 1 to enable nonblocking 259 | - 0 to disable nonblocking. 260 | 261 | @returns 262 | This function returns 0 on success and -1 on error. 263 | */ 264 | int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hidapi_device*device, int nonblock); 265 | 266 | /** @brief Send a Feature report to the device. 267 | 268 | Feature reports are sent over the Control endpoint as a 269 | Set_Report transfer. The first byte of @p data[] must 270 | contain the Report ID. For devices which only support a 271 | single report, this must be set to 0x0. The remaining bytes 272 | contain the report data. Since the Report ID is mandatory, 273 | calls to hid_send_feature_report() will always contain one 274 | more byte than the report contains. For example, if a hid 275 | report is 16 bytes long, 17 bytes must be passed to 276 | hid_send_feature_report(): the Report ID (or 0x0, for 277 | devices which do not use numbered reports), followed by the 278 | report data (16 bytes). In this example, the length passed 279 | in would be 17. 280 | 281 | @ingroup API 282 | @param device A device handle returned from hid_open(). 283 | @param data The data to send, including the report number as 284 | the first byte. 285 | @param length The length in bytes of the data to send, including 286 | the report number. 287 | 288 | @returns 289 | This function returns the actual number of bytes written and 290 | -1 on error. 291 | */ 292 | int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hidapi_device*device, const unsigned char *data, size_t length); 293 | 294 | /** @brief Get a feature report from a HID device. 295 | 296 | Set the first byte of @p data[] to the Report ID of the 297 | report to be read. Make sure to allow space for this 298 | extra byte in @p data[]. Upon return, the first byte will 299 | still contain the Report ID, and the report data will 300 | start in data[1]. 301 | 302 | @ingroup API 303 | @param device A device handle returned from hid_open(). 304 | @param data A buffer to put the read data into, including 305 | the Report ID. Set the first byte of @p data[] to the 306 | Report ID of the report to be read, or set it to zero 307 | if your device does not use numbered reports. 308 | @param length The number of bytes to read, including an 309 | extra byte for the report ID. The buffer can be longer 310 | than the actual report. 311 | 312 | @returns 313 | This function returns the number of bytes read plus 314 | one for the report ID (which is still in the first 315 | byte), or -1 on error. 316 | */ 317 | int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hidapi_device*device, unsigned char *data, size_t length); 318 | 319 | /** @brief Close a HID device. 320 | 321 | @ingroup API 322 | @param device A device handle returned from hid_open(). 323 | */ 324 | void HID_API_EXPORT HID_API_CALL hid_close(hidapi_device*device); 325 | 326 | /** @brief Get The Manufacturer String from a HID device. 327 | 328 | @ingroup API 329 | @param device A device handle returned from hid_open(). 330 | @param string A wide string buffer to put the data into. 331 | @param maxlen The length of the buffer in multiples of wchar_t. 332 | 333 | @returns 334 | This function returns 0 on success and -1 on error. 335 | */ 336 | int HID_API_EXPORT_CALL hid_get_manufacturer_string(hidapi_device*device, wchar_t *string, size_t maxlen); 337 | 338 | /** @brief Get The Product String from a HID device. 339 | 340 | @ingroup API 341 | @param device A device handle returned from hid_open(). 342 | @param string A wide string buffer to put the data into. 343 | @param maxlen The length of the buffer in multiples of wchar_t. 344 | 345 | @returns 346 | This function returns 0 on success and -1 on error. 347 | */ 348 | int HID_API_EXPORT_CALL hid_get_product_string(hidapi_device*device, wchar_t *string, size_t maxlen); 349 | 350 | /** @brief Get The Serial Number String from a HID device. 351 | 352 | @ingroup API 353 | @param device A device handle returned from hid_open(). 354 | @param string A wide string buffer to put the data into. 355 | @param maxlen The length of the buffer in multiples of wchar_t. 356 | 357 | @returns 358 | This function returns 0 on success and -1 on error. 359 | */ 360 | int HID_API_EXPORT_CALL hid_get_serial_number_string(hidapi_device*device, wchar_t *string, size_t maxlen); 361 | 362 | /** @brief Get a string from a HID device, based on its string index. 363 | 364 | @ingroup API 365 | @param device A device handle returned from hid_open(). 366 | @param string_index The index of the string to get. 367 | @param string A wide string buffer to put the data into. 368 | @param maxlen The length of the buffer in multiples of wchar_t. 369 | 370 | @returns 371 | This function returns 0 on success and -1 on error. 372 | */ 373 | int HID_API_EXPORT_CALL hid_get_indexed_string(hidapi_device*device, int string_index, wchar_t *string, size_t maxlen); 374 | 375 | /** @brief Get a string describing the last error which occurred. 376 | 377 | @ingroup API 378 | @param device A device handle returned from hid_open(). 379 | 380 | @returns 381 | This function returns a string containing the last error 382 | which occurred or NULL if none has occurred. 383 | */ 384 | HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hidapi_device*device); 385 | 386 | #ifdef __cplusplus 387 | } 388 | #endif 389 | 390 | #endif 391 | 392 | -------------------------------------------------------------------------------- /linux/dmi.h: -------------------------------------------------------------------------------- 1 | #ifndef DMI_H_ 2 | #define DMI_H_ 3 | 4 | enum dmi_field { 5 | DMI_NONE, 6 | DMI_BIOS_VENDOR, 7 | DMI_BIOS_VERSION, 8 | DMI_BIOS_DATE, 9 | DMI_SYS_VENDOR, 10 | DMI_PRODUCT_NAME, 11 | DMI_PRODUCT_VERSION, 12 | DMI_PRODUCT_SERIAL, 13 | DMI_PRODUCT_UUID, 14 | DMI_BOARD_VENDOR, 15 | DMI_BOARD_NAME, 16 | DMI_BOARD_VERSION, 17 | DMI_BOARD_SERIAL, 18 | DMI_BOARD_ASSET_TAG, 19 | DMI_CHASSIS_VENDOR, 20 | DMI_CHASSIS_TYPE, 21 | DMI_CHASSIS_VERSION, 22 | DMI_CHASSIS_SERIAL, 23 | DMI_CHASSIS_ASSET_TAG, 24 | DMI_STRING_MAX, 25 | }; 26 | 27 | static inline char* dmi_get_system_info(int x) { 28 | return "BLADESERIAL"; 29 | } 30 | 31 | #endif /* DMI_H_ */ 32 | -------------------------------------------------------------------------------- /linux/hid.h: -------------------------------------------------------------------------------- 1 | #ifndef HID_H_ 2 | #define HID_H_ 3 | 4 | #include 5 | 6 | #pragma comment(lib, "hidapi.lib") 7 | 8 | #define HID_STAT_ADDED 1 9 | #define HID_STAT_PARSED 2 10 | 11 | #define HID_CONNECT_HIDINPUT 0x01 12 | #define HID_CONNECT_HIDRAW 0x04 13 | #define HID_CONNECT_HIDDEV 0x08 14 | #define HID_CONNECT_FF 0x20 15 | #define HID_CONNECT_DEFAULT (HID_CONNECT_HIDINPUT|HID_CONNECT_HIDRAW| HID_CONNECT_HIDDEV|HID_CONNECT_FF) 16 | 17 | #define HID_GD_WHEEL 0x00010038 18 | 19 | #define HID_UP_GENDESK 0x00010000 20 | #define HID_UP_BUTTON 0x00090000 21 | 22 | #define HID_REQ_GET_REPORT 0x01 23 | #define HID_REQ_SET_REPORT 0x09 24 | 25 | #define MSC_SCAN 0x04 26 | 27 | #define REL_HWHEEL 0x06 28 | 29 | //#define USB_INTERFACE_PROTOCOL_KEYBOARD 1 30 | //#define USB_INTERFACE_PROTOCOL_MOUSE 2 31 | 32 | //Hack to make detection work without having to install WinUSB on the correct interface 33 | #define USB_INTERFACE_PROTOCOL_KEYBOARD 0 34 | #define USB_INTERFACE_PROTOCOL_MOUSE 0 35 | 36 | static const GUID GUID_DEVINTERFACE = { 0xDEE824EF, 0x729B, 0x4A0E, 0x9C, 0x14, 0xB7, 0x11, 0x7D, 0x33, 0xA8, 0x17 }; 37 | 38 | typedef enum 39 | { 40 | HID_TYPE_OTHER, 41 | HID_TYPE_USBMOUSE, 42 | HID_TYPE_USBNONE 43 | } hid_type; 44 | 45 | struct hid_input { 46 | struct input_dev *input; 47 | }; 48 | 49 | struct hid_field { 50 | unsigned application; /* application usage for this field */ 51 | struct hid_input *hidinput; /* associated input structure */ 52 | }; 53 | 54 | struct hid_usage { 55 | unsigned hid; 56 | __u16 code; /* input driver code */ 57 | __u8 type; /* input driver type */ 58 | }; 59 | 60 | struct hid_driver { 61 | char *name; 62 | const struct hid_device_id *id_table; 63 | bool (*match)(struct hid_device* dev, bool ignore_special_driver); 64 | int (*probe)(struct hid_device *dev, const struct hid_device_id *id); 65 | void (*remove)(struct hid_device *dev); 66 | int (*raw_event)(struct hid_device *hdev, struct hid_report *report, u8 *data, int size); 67 | int (*event)(struct hid_device *hdev, struct hid_field *field, struct hid_usage *usage, __s32 value); 68 | int (*input_configured)(struct hid_device *hdev, 69 | struct hid_input *hidinput); 70 | int (*input_mapping)(struct hid_device *hdev, 71 | struct hid_input *hidinput, struct hid_field *field, 72 | struct hid_usage *usage, unsigned long **bit, int *max); 73 | }; 74 | 75 | struct hid_device_id { 76 | __u16 bus; 77 | __u32 vendor; 78 | __u32 product; 79 | }; 80 | 81 | struct hid_device { 82 | __u16 product; 83 | enum hid_type type; 84 | struct device dev; 85 | struct hid_ll_driver *ll_driver; 86 | unsigned int status; 87 | struct hid_driver *driver; 88 | }; 89 | 90 | struct hid_ll_driver { 91 | int (*start)(struct hid_device *hdev); 92 | void (*stop)(struct hid_device *hdev); 93 | int (*parse)(struct hid_device *hdev); 94 | }; 95 | 96 | inline int ll_start(struct hid_device *hdev) { 97 | printf("ll_start\n"); 98 | return 0; 99 | } 100 | 101 | inline void ll_stop(struct hid_device *hdev) { 102 | printf("ll_stop\n"); 103 | } 104 | 105 | inline int ll_parse(struct hid_device *hdev) { 106 | printf("ll_parse\n"); 107 | return 0; 108 | } 109 | 110 | inline void dev_err(struct device** dev, const char* msg) { 111 | printf("dev_err device=%s msg=%s", (*dev)->init_name, msg); 112 | } 113 | 114 | inline void dev_info(struct device** dev, const char* msg) { 115 | printf("dev_err device=%s msg=%s", (*dev)->init_name, msg); 116 | } 117 | 118 | inline void *dev_get_drvdata(const struct device *dev) { 119 | return dev->driver_data; 120 | } 121 | 122 | inline void dev_set_drvdata(struct device *dev, void *data) { 123 | dev->driver_data = data; 124 | } 125 | 126 | inline int hid_connect(struct hid_device *hdev, unsigned int connect_mask) { 127 | printf("hid_connect\n"); 128 | return 0; 129 | } 130 | 131 | inline int hid_parse(struct hid_device *hdev) { 132 | int ret; 133 | 134 | if (hdev->status & HID_STAT_PARSED) 135 | return 0; 136 | 137 | ret = hdev->ll_driver->parse(hdev); 138 | if (!ret) 139 | hdev->status |= HID_STAT_PARSED; 140 | 141 | return ret; 142 | } 143 | 144 | inline void *hid_get_drvdata(struct hid_device *hdev) { 145 | return dev_get_drvdata(&hdev->dev); 146 | } 147 | 148 | inline void hid_set_drvdata(struct hid_device *hdev, void *data) { 149 | dev_set_drvdata(&hdev->dev, data); 150 | } 151 | 152 | inline int hid_hw_start(struct hid_device *hdev, unsigned int connect_mask) { 153 | int ret = hdev->ll_driver->start(hdev); 154 | if (ret || !connect_mask) 155 | return ret; 156 | ret = hid_connect(hdev, connect_mask); 157 | if (ret) 158 | hdev->ll_driver->stop(hdev); 159 | return ret; 160 | } 161 | 162 | inline void hid_hw_stop(struct hid_device *hdev) { 163 | hdev->ll_driver->stop(hdev); 164 | } 165 | 166 | inline void hid_err(struct hid_device *hdev, const char* msg, ...) { 167 | va_list args; 168 | va_start(args, msg); 169 | printf("hid_err device=%s", hdev->dev.init_name); 170 | printf(msg, args); 171 | va_end(args); 172 | } 173 | 174 | inline void hid_map_usage(struct hid_input* hidinput, 175 | struct hid_usage* usage, unsigned long** bit, int* max, 176 | __u8 type, __u16 c) 177 | { 178 | 179 | }; 180 | 181 | #define container_of(ptr, type, member) (type*)((char*)(ptr)-(char*)&((type *)0)->member) 182 | 183 | inline void close(struct device* dev) { 184 | printf("close %04X\n", (to_usb_device(dev))->descriptor.idProduct); 185 | struct usb_interface *intf = to_usb_interface(dev->parent); 186 | struct usb_device *usb_dev = interface_to_usbdev(intf); 187 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); 188 | free(hdev->ll_driver); 189 | free(usb_dev); 190 | free(intf->cur_altsetting); 191 | free(intf); 192 | free(hdev); 193 | //TODO:cleanup malloc memory, move this function into DLL 194 | } 195 | 196 | /*---------------------------------------------------------*\ 197 | | Tests if PID is from a kraken | 198 | \*---------------------------------------------------------*/ 199 | inline bool is_kraken(unsigned short pid) 200 | { 201 | // Codename Unknown 202 | #define USB_DEVICE_ID_RAZER_KRAKEN_CLASSIC 0x0501 203 | // Codename Rainie 204 | #define USB_DEVICE_ID_RAZER_KRAKEN 0x0504 205 | // Codename Unknown 206 | #define USB_DEVICE_ID_RAZER_KRAKEN_CLASSIC_ALT 0x0506 207 | // Codename Kylie 208 | #define USB_DEVICE_ID_RAZER_KRAKEN_V2 0x0510 209 | 210 | switch (pid) 211 | { 212 | case USB_DEVICE_ID_RAZER_KRAKEN_CLASSIC: 213 | case USB_DEVICE_ID_RAZER_KRAKEN: 214 | case USB_DEVICE_ID_RAZER_KRAKEN_CLASSIC_ALT: 215 | case USB_DEVICE_ID_RAZER_KRAKEN_V2: 216 | return true; 217 | 218 | default: 219 | return false; 220 | } 221 | } 222 | 223 | /*---------------------------------------------------------*\ 224 | | Function to open a device using hidapi | 225 | \*---------------------------------------------------------*/ 226 | inline void openChromaDevice(struct hid_device** hdev, unsigned int* numHdev, struct hid_driver hdr) 227 | { 228 | hid_init(); 229 | 230 | /*-----------------------------------------------------------------*\ 231 | | Loop through all IDs in ID table of header | 232 | \*-----------------------------------------------------------------*/ 233 | for (unsigned int i = 0; hdr.id_table[i].vendor != 0; i++) 234 | { 235 | struct hid_device_info* info = hid_enumerate(hdr.id_table[i].vendor, hdr.id_table[i].product); 236 | 237 | /*-------------------------------------------------------------*\ 238 | | Loop through all device information entries in set | 239 | \*-------------------------------------------------------------*/ 240 | while (info) 241 | { 242 | /*-------------------------------------------------------------*\ 243 | | Open the device. Regular Razer devices use usage page 01 | 244 | | and either usage 02 or 03. Razer Kraken devices use usage | 245 | | page 0C and usage 03 | 246 | \*-------------------------------------------------------------*/ 247 | if((info->vendor_id == hdr.id_table[i].vendor) 248 | && (info->product_id == hdr.id_table[i].product) 249 | && ( ((is_kraken(hdr.id_table[i].product) 250 | && (info->usage_page == 0x000C) 251 | && (info->usage == 0x0001))) 252 | || ((info->usage_page == 0x0001) 253 | && ((info->usage == 0x0002) 254 | || (info->usage == 0x0003))))) 255 | { 256 | /*---------------------------------------------------------*\ 257 | | Open a handle to the device | 258 | \*---------------------------------------------------------*/ 259 | hidapi_device* dev = hid_open_path(info->path); 260 | 261 | if (dev) 262 | { 263 | /*---------------------------------------------------------*\ 264 | | Print debug message indicating device is opened | 265 | \*---------------------------------------------------------*/ 266 | printf("device %04X:%04X opened!\n", hdr.id_table[i].vendor, hdr.id_table[i].product); 267 | 268 | /*---------------------------------------------------------*\ 269 | | Create or resize HID device struct buffer | 270 | \*---------------------------------------------------------*/ 271 | *hdev = (struct hid_device*)realloc(*hdev, (*numHdev + 1) * sizeof(struct hid_device)); 272 | 273 | if (!*hdev) 274 | { 275 | printf("out of memory\n"); 276 | continue; 277 | } 278 | 279 | /*---------------------------------------------------------*\ 280 | | If there are hdev entries from previous loop iterations, | 281 | | copy the data from the previous location to the new. | 282 | \*---------------------------------------------------------*/ 283 | if (*numHdev > 0) 284 | { 285 | for (int old_dev = 0; old_dev < *numHdev; old_dev++) 286 | { 287 | (*hdev)[old_dev].dev.parent = &((*hdev)[old_dev].dev); 288 | (*hdev)[old_dev].dev.parent_usb_interface->dev = &((*hdev)[old_dev].dev); 289 | (*hdev)[old_dev].dev.parent_usb_interface->parent_usb_device->dev = &((*hdev)[old_dev].dev); 290 | } 291 | } 292 | 293 | /*---------------------------------------------------------*\ 294 | | Allocate buffer for USB interface and USB host interface | 295 | | structures | 296 | \*---------------------------------------------------------*/ 297 | struct usb_interface* intf = (struct usb_interface*)malloc(sizeof(struct usb_interface)); 298 | intf->cur_altsetting = (struct usb_host_interface*)malloc(sizeof(struct usb_host_interface)); 299 | 300 | intf->cur_altsetting->desc.bInterfaceProtocol = 0;// interface_descriptor.bInterfaceProtocol; 301 | 302 | /*---------------------------------------------------------*\ 303 | | Allocate buffer for USB device structure | 304 | \*---------------------------------------------------------*/ 305 | struct usb_device* usbdevice = (struct usb_device*)malloc(sizeof(struct usb_device)); 306 | 307 | /*---------------------------------------------------------*\ 308 | | Set up USB device and interface structures | 309 | \*---------------------------------------------------------*/ 310 | usbdevice->descriptor.idVendor = hdr.id_table[i].vendor; 311 | usbdevice->descriptor.idProduct = hdr.id_table[i].product; 312 | 313 | intf->parent_usb_device = usbdevice; 314 | 315 | (*hdev)[*numHdev].product = hdr.id_table[i].product; 316 | (*hdev)[*numHdev].dev.parent = &((*hdev)[*numHdev].dev); 317 | (*hdev)[*numHdev].dev.driver_data; 318 | (*hdev)[*numHdev].dev.p = dev; 319 | (*hdev)[*numHdev].dev.parent_usb_interface = intf; 320 | (*hdev)[*numHdev].dev.init_name = hdr.name; 321 | (*hdev)[*numHdev].dev.attr_count = 0; 322 | 323 | usbdevice->dev = &((*hdev)[*numHdev].dev); 324 | intf->dev = &((*hdev)[*numHdev].dev); 325 | 326 | (*hdev)[*numHdev].status = 2; 327 | (*hdev)[*numHdev].driver = &hdr; 328 | (*hdev)[*numHdev].ll_driver = (struct hid_ll_driver*)malloc(sizeof(struct hid_ll_driver)); 329 | (*hdev)[*numHdev].ll_driver->parse = ll_parse; 330 | (*hdev)[*numHdev].ll_driver->start = ll_start; 331 | (*hdev)[*numHdev].ll_driver->stop = ll_stop; 332 | 333 | /*---------------------------------------------------------*\ 334 | | Call the OpenRazer driver probe function | 335 | \*---------------------------------------------------------*/ 336 | (*hdev)[*numHdev].driver->probe(&((*hdev)[*numHdev]), &(hdr.id_table[i])); 337 | 338 | (*numHdev)++; 339 | } 340 | } 341 | info = info->next; 342 | } 343 | } 344 | } 345 | 346 | #endif /* HID_H_ */ 347 | -------------------------------------------------------------------------------- /linux/hrtimer.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define CLOCK_MONOTONIC 1 4 | 5 | struct rb_node { 6 | unsigned long __rb_parent_color; 7 | struct rb_node* rb_right; 8 | struct rb_node* rb_left; 9 | }; 10 | /* The alignment might seem pointless, but allegedly CRIS needs it */ 11 | 12 | union ktime { 13 | s64 tv64; 14 | #if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR) 15 | struct { 16 | # ifdef __BIG_ENDIAN 17 | s32 sec, nsec; 18 | # else 19 | s32 nsec, sec; 20 | # endif 21 | } tv; 22 | #endif 23 | }; 24 | 25 | typedef union ktime ktime_t; /* Kill this */ 26 | 27 | struct timerqueue_node { 28 | struct rb_node node; 29 | ktime_t expires; 30 | }; 31 | 32 | struct hrtimer { 33 | struct timerqueue_node node; 34 | ktime_t _softexpires; 35 | enum hrtimer_restart(*function)(struct hrtimer*); 36 | struct hrtimer_clock_base* base; 37 | u8 state; 38 | u8 is_rel; 39 | u8 is_soft; 40 | u8 is_hard; 41 | }; 42 | 43 | enum hrtimer_restart { 44 | HRTIMER_NORESTART, /* Timer is not restarted */ 45 | HRTIMER_RESTART, /* Timer must be restarted */ 46 | }; 47 | 48 | enum hrtimer_mode { 49 | HRTIMER_MODE_ABS = 0x00, 50 | HRTIMER_MODE_REL = 0x01, 51 | HRTIMER_MODE_PINNED = 0x02, 52 | HRTIMER_MODE_SOFT = 0x04, 53 | HRTIMER_MODE_HARD = 0x08, 54 | 55 | HRTIMER_MODE_ABS_PINNED = HRTIMER_MODE_ABS | HRTIMER_MODE_PINNED, 56 | HRTIMER_MODE_REL_PINNED = HRTIMER_MODE_REL | HRTIMER_MODE_PINNED, 57 | 58 | HRTIMER_MODE_ABS_SOFT = HRTIMER_MODE_ABS | HRTIMER_MODE_SOFT, 59 | HRTIMER_MODE_REL_SOFT = HRTIMER_MODE_REL | HRTIMER_MODE_SOFT, 60 | 61 | HRTIMER_MODE_ABS_PINNED_SOFT = HRTIMER_MODE_ABS_PINNED | HRTIMER_MODE_SOFT, 62 | HRTIMER_MODE_REL_PINNED_SOFT = HRTIMER_MODE_REL_PINNED | HRTIMER_MODE_SOFT, 63 | 64 | HRTIMER_MODE_ABS_HARD = HRTIMER_MODE_ABS | HRTIMER_MODE_HARD, 65 | HRTIMER_MODE_REL_HARD = HRTIMER_MODE_REL | HRTIMER_MODE_HARD, 66 | 67 | HRTIMER_MODE_ABS_PINNED_HARD = HRTIMER_MODE_ABS_PINNED | HRTIMER_MODE_HARD, 68 | HRTIMER_MODE_REL_PINNED_HARD = HRTIMER_MODE_REL_PINNED | HRTIMER_MODE_HARD, 69 | }; 70 | 71 | inline u64 hrtimer_forward_now(struct hrtimer* timer, ktime_t interval) 72 | { 73 | return 0; 74 | } 75 | 76 | static inline ktime_t ms_to_ktime(u64 ms) 77 | { 78 | static const ktime_t ktime_zero = { .tv64 = 0 }; 79 | 80 | return ktime_zero; 81 | } 82 | 83 | inline void hrtimer_start_range_ns(struct hrtimer* timer, 84 | ktime_t tim, 85 | u64 delta_ns, 86 | const enum hrtimer_mode mode) 87 | { 88 | 89 | } 90 | 91 | inline int hrtimer_cancel(struct hrtimer* timer) 92 | { 93 | return 0; 94 | } 95 | 96 | void hrtimer_init(struct hrtimer* timer, int which_clock, 97 | enum hrtimer_mode mode) 98 | { 99 | 100 | } -------------------------------------------------------------------------------- /linux/init.h: -------------------------------------------------------------------------------- 1 | #ifndef INIT_H_ 2 | #define INIT_H_ 3 | 4 | #define KERN_WARNING 5 | #define KERN_ALERT 6 | #define KERN_CRIT 7 | 8 | #define printk printf 9 | 10 | inline unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base) { 11 | return strtoul(cp, endp, base); 12 | } 13 | 14 | inline void usleep(__int64 usec) { 15 | HANDLE timer; 16 | LARGE_INTEGER ft; 17 | 18 | ft.QuadPart = -(10 * usec); // Convert to 100 nanosecond interval, negative value indicates relative time 19 | 20 | timer = CreateWaitableTimer(NULL, TRUE, NULL); 21 | SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0); 22 | WaitForSingleObject(timer, INFINITE); 23 | CloseHandle(timer); 24 | } 25 | 26 | inline void msleep(__int64 msec) { 27 | usleep(1000 * msec); 28 | } 29 | 30 | inline void usleep_range(__int64 usec1, __int64 usec2) { 31 | usleep((usec1 + usec2) / 2); 32 | } 33 | 34 | inline unsigned short eflip(unsigned short val) { 35 | return (val & 0xff) * 0xFF + (val >> 8); 36 | } 37 | 38 | #endif /* INIT_H_ */ 39 | -------------------------------------------------------------------------------- /linux/kernel.h: -------------------------------------------------------------------------------- 1 | #ifndef KERNEL_H_ 2 | #define KERNEL_H_ 3 | 4 | #include 5 | 6 | #define ARRAY_SIZE(array) \ 7 | (sizeof(array) / sizeof(*array)) 8 | 9 | #define DLL_INTERNAL __declspec( dllexport ) 10 | 11 | #define u8 unsigned char 12 | #define u16 unsigned short 13 | #define u32 unsigned int 14 | #define u64 unsigned long 15 | 16 | #define s8 char 17 | #define s16 short 18 | #define s32 int 19 | #define s64 long 20 | 21 | #define __u8 unsigned char 22 | #define __u16 unsigned short 23 | #define __u32 unsigned int 24 | #define __u64 unsigned long 25 | #define uint8_t unsigned char 26 | #define uint16_t unsigned short 27 | #define uint32_t unsigned int 28 | #define uint64_t unsigned long 29 | #define __le8 unsigned char 30 | #define __le16 unsigned short 31 | #define __le32 unsigned int 32 | #define __le64 unsigned long 33 | #define __s8 signed char 34 | #define __s16 signed short 35 | #define __s32 signed int 36 | #define __s64 signed long 37 | #define uint unsigned int 38 | #define ulong unsigned long 39 | 40 | #define socklen_t int 41 | 42 | #define bool int 43 | #define true 1 44 | #define false 0 45 | 46 | #define size_t SIZE_T 47 | #define ssize_t SSIZE_T 48 | 49 | struct mutex { 50 | CRITICAL_SECTION lock; 51 | }; 52 | 53 | inline void mutex_init(struct mutex* mutex) { 54 | InitializeCriticalSection(&mutex->lock); 55 | } 56 | 57 | inline void mutex_lock(struct mutex* mutex) { 58 | EnterCriticalSection(&mutex->lock); 59 | } 60 | 61 | inline void mutex_unlock(struct mutex* mutex) { 62 | LeaveCriticalSection(&mutex->lock); 63 | } 64 | 65 | inline int mutex_trylock(struct mutex* mutex) { 66 | return TryEnterCriticalSection(&mutex->lock); 67 | } 68 | 69 | inline int mutex_is_locked(struct mutex* mutex) { 70 | if (mutex_trylock(mutex)) { 71 | mutex_unlock(mutex); 72 | return 0; 73 | } 74 | else 75 | return 1; 76 | } 77 | 78 | inline void set_bit(int nr, volatile unsigned long *addr) { 79 | int *a = (int *)addr; 80 | int mask; 81 | 82 | a += nr >> 5; 83 | mask = 1 << (nr & 0x1f); 84 | *a |= mask; 85 | } 86 | #define __set_bit set_bit 87 | 88 | inline void clear_bit(int nr, volatile unsigned long *addr) { 89 | int *a = (int *)addr; 90 | int mask; 91 | 92 | a += nr >> 5; 93 | mask = 1 << (nr & 0x1f); 94 | *a &= ~mask; 95 | } 96 | 97 | inline int test_bit(int nr, const void *addr) { 98 | int *a = (int *)addr; 99 | int mask; 100 | 101 | a += nr >> 5; 102 | mask = 1 << (nr & 0x1f); 103 | return ((mask & *a) != 0); 104 | } 105 | 106 | inline int kstrtouint(const char* s, 107 | unsigned int base, 108 | unsigned int* res) 109 | { 110 | return 0; 111 | } 112 | 113 | static inline void input_report_rel(struct input_dev* dev, unsigned int code, int value) 114 | { 115 | 116 | } 117 | 118 | inline struct usb_interface* usb_ifnum_to_if(const struct usb_device* dev, 119 | unsigned ifnum) 120 | { 121 | return NULL; 122 | } 123 | 124 | inline void input_set_capability(struct input_dev* dev, unsigned int type, unsigned int code) 125 | { 126 | 127 | } 128 | #endif /* KERNEL_H_ */ 129 | -------------------------------------------------------------------------------- /linux/module.h: -------------------------------------------------------------------------------- 1 | #ifndef MODULE_H_ 2 | #define MODULE_H_ 3 | 4 | #include 5 | #include 6 | 7 | #define MODULE_AUTHOR( __Declaration__ ) 8 | #define MODULE_DESCRIPTION( __Declaration__ ) 9 | #define MODULE_VERSION( __Declaration__ ) 10 | #define MODULE_LICENSE( __Declaration__ ) 11 | 12 | #define USB_CTRL_SET_TIMEOUT 5000 13 | 14 | #define USB_DIR_OUT 0 15 | #define USB_DIR_IN 0x80 16 | 17 | #define USB_TYPE_CLASS (0x01 << 5) 18 | #define USB_RECIP_INTERFACE 0x01 19 | 20 | #define usb_sndctrlpipe(u,d) 0 21 | #define usb_rcvctrlpipe(u,d) 0 22 | 23 | #define PATH_MAX 512 24 | 25 | struct usb_interface_descriptor { 26 | unsigned char bInterfaceNumber; 27 | unsigned char bInterfaceProtocol; 28 | unsigned char bInterfaceSubClass; 29 | }; 30 | 31 | struct usb_host_interface { 32 | struct usb_interface_descriptor desc; 33 | }; 34 | 35 | struct device { 36 | struct device *parent; 37 | void *p; 38 | const char *init_name; 39 | struct bus_type* bus; 40 | void *driver_data; 41 | unsigned int attr_count; 42 | struct device_attribute * attr_list[64]; 43 | struct usb_interface *parent_usb_interface; 44 | }; 45 | 46 | struct usb_interface { 47 | struct device* dev; 48 | int num_altsetting; 49 | struct usb_host_interface *cur_altsetting; 50 | struct usb_device *parent_usb_device; 51 | }; 52 | 53 | struct usb_device_descriptor { 54 | unsigned short idVendor; 55 | unsigned short idProduct; 56 | }; 57 | 58 | struct usb_config_descriptor { 59 | u8 bLength; 60 | u8 bDescriptorType; 61 | 62 | u16 wTotalLength; 63 | u8 bNumInterfaces; 64 | u8 bConfigurationValue; 65 | u8 iConfiguration; 66 | u8 bmAttributes; 67 | u8 bMaxPower; 68 | }; 69 | 70 | struct usb_host_config { 71 | struct usb_config_descriptor desc; 72 | }; 73 | 74 | struct usb_device { 75 | struct device* dev; 76 | struct usb_device_descriptor descriptor; 77 | struct usb_host_config* actconfig; 78 | }; 79 | 80 | /*---------------------------------------------------------*\ 81 | | Implementation of usb_control_msg using hidapi | 82 | \*---------------------------------------------------------*/ 83 | inline int usb_control_msg 84 | ( 85 | struct usb_device *usb_dev, 86 | int usb_pipe, 87 | unsigned int request, 88 | unsigned int request_type, 89 | unsigned int value, 90 | unsigned int report_index, 91 | unsigned char* buf, 92 | unsigned int size, 93 | unsigned int timeout 94 | ) 95 | { 96 | /*---------------------------------------------------------*\ 97 | | Kraken uses hid_write | 98 | \*---------------------------------------------------------*/ 99 | if(size == 37) 100 | { 101 | if ((request_type & USB_DIR_IN) == USB_DIR_IN) 102 | { 103 | return(hid_read((hidapi_device*)usb_dev->dev->p, buf, size)); 104 | } 105 | else 106 | { 107 | return(hid_write((hidapi_device*)usb_dev->dev->p, buf, size)); 108 | } 109 | } 110 | /*---------------------------------------------------------*\ 111 | | Check request type to determine if we're reading or | 112 | | writing the feature report | 113 | \*---------------------------------------------------------*/ 114 | else if ((request_type & USB_DIR_IN) == USB_DIR_IN) 115 | { 116 | /*---------------------------------------------------------*\ 117 | | Create a buffer to receive report with index | 118 | \*---------------------------------------------------------*/ 119 | int cbRecvd = 0; 120 | unsigned char pkt[91]; 121 | 122 | /*---------------------------------------------------------*\ 123 | | Set the report index | 124 | \*---------------------------------------------------------*/ 125 | pkt[0] = report_index; 126 | 127 | /*---------------------------------------------------------*\ 128 | | Get the feature report. Add one to the size to account | 129 | | for the report index | 130 | \*---------------------------------------------------------*/ 131 | cbRecvd = hid_get_feature_report((hidapi_device*)usb_dev->dev->p, pkt, size + 1); 132 | 133 | /*---------------------------------------------------------*\ 134 | | For some reason, cbRecvd is sometimes 1 greater than size | 135 | | + 1. Limit the return value. | 136 | \*---------------------------------------------------------*/ 137 | if(cbRecvd > size + 1) 138 | { 139 | cbRecvd = size + 1; 140 | } 141 | 142 | /*---------------------------------------------------------*\ 143 | | Copy the received report into the buffer | 144 | \*---------------------------------------------------------*/ 145 | memcpy(buf, &pkt[1], size); 146 | 147 | /*---------------------------------------------------------*\ 148 | | Return the number of bytes received, not including the | 149 | | report index | 150 | \*---------------------------------------------------------*/ 151 | return(cbRecvd - 1); 152 | } 153 | else 154 | { 155 | /*---------------------------------------------------------*\ 156 | | Create a buffer to send report with index | 157 | \*---------------------------------------------------------*/ 158 | int cbSent = 0; 159 | unsigned char pkt[91]; 160 | 161 | /*---------------------------------------------------------*\ 162 | | Set the report index and copy the report into the buffer | 163 | \*---------------------------------------------------------*/ 164 | pkt[0] = report_index; 165 | memcpy(&pkt[1], buf, size); 166 | 167 | /*---------------------------------------------------------*\ 168 | | Send the feature report. Add one to the size to account | 169 | | for the report index | 170 | \*---------------------------------------------------------*/ 171 | cbSent = hid_send_feature_report((hidapi_device*)usb_dev->dev->p, pkt, size + 1); 172 | 173 | /*---------------------------------------------------------*\ 174 | | Return the number of bytes sent, not including the | 175 | | report index | 176 | \*---------------------------------------------------------*/ 177 | return cbSent - 1; 178 | } 179 | } 180 | 181 | inline struct usb_interface *to_usb_interface(struct device *dev) { 182 | return dev->parent_usb_interface; 183 | } 184 | 185 | inline struct usb_device *to_usb_device(struct device *dev) { 186 | return dev->parent_usb_interface->parent_usb_device; 187 | } 188 | 189 | inline struct usb_device *interface_to_usbdev(struct usb_interface *intf) { 190 | return to_usb_device(intf->dev->parent); 191 | } 192 | 193 | inline void usb_disable_autosuspend(struct usb_device *usb_dev) { 194 | printf("usb_disable_autosuspend\n"); 195 | } 196 | 197 | struct device_attribute { 198 | const char* name; 199 | ssize_t(*show)(struct device *dev, struct device_attribute *attr, char *buf); 200 | ssize_t(*store)(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); 201 | }; 202 | 203 | inline int device_create_file(struct device *device, struct device_attribute *entry) 204 | { 205 | if (device->attr_count < 64) 206 | { 207 | printf("device_create_file - Adding %s to list\n", entry->name); 208 | device->attr_list[device->attr_count] = entry; 209 | device->attr_count++; 210 | } 211 | else 212 | { 213 | printf("device_create_file - List is full\n"); 214 | } 215 | return 0; 216 | } 217 | 218 | inline void device_remove_file(struct device *device, struct device_attribute *entry) { 219 | printf("device_remove_file %s\n", entry->name); 220 | } 221 | 222 | #define HID_USB_DEVICE(ven, prod) \ 223 | .vendor = (ven) \ 224 | , .product = (prod) 225 | 226 | 227 | #define __stringify(x) #x 228 | 229 | // Hack to turn Linux device macros into API calls 230 | #define DEVICE_ATTR1(_device,_name, _mode, _show, _store) \ 231 | struct device_attribute dev_attr_##_name = { \ 232 | .name = __stringify(_name) \ 233 | , .show = _show \ 234 | , .store = _store \ 235 | }; \ 236 | DLL_INTERNAL struct device_attribute dev##_device##_attr_##_name = { \ 237 | .name = __stringify(_name) \ 238 | , .show = _show \ 239 | , .store = _store \ 240 | }; 241 | 242 | #define MODULE_DEVICE_TABLE(type, name) 243 | 244 | /*typedef struct hid_device_array_tag { 245 | unsigned int count; 246 | struct hid_device* hdev[]; 247 | } hid_device_array;*/ 248 | 249 | #define module_hid_driver(hdr) \ 250 | DLL_INTERNAL unsigned int init_##hdr## (struct hid_device** hdevo) { \ 251 | unsigned int numHdevs = 0; \ 252 | struct hid_device* hdev = NULL; \ 253 | openChromaDevice(&hdev, &numHdevs, hdr); \ 254 | *hdevo = hdev; \ 255 | return numHdevs; \ 256 | } 257 | 258 | #endif /* MODULE_H_ */ 259 | -------------------------------------------------------------------------------- /linux/random.h: -------------------------------------------------------------------------------- 1 | #ifndef RANDOM_H_ 2 | #define RANDOM_H_ 3 | 4 | static inline void get_random_bytes(void* rand_ptr, unsigned int rand_size) { 5 | char failed = 0; 6 | static HCRYPTPROV prov = 0; 7 | if (prov == 0) { 8 | if (!CryptAcquireContext(&prov, NULL, NULL, PROV_RSA_FULL, 0)) 9 | failed = 1; 10 | } 11 | if (!failed && !CryptGenRandom(prov, rand_size, (unsigned char*)rand_ptr)) 12 | printf("get_random_bytes failed\n"); 13 | } 14 | 15 | 16 | #endif /* RANDOM_H_ */ 17 | -------------------------------------------------------------------------------- /linux/slab.h: -------------------------------------------------------------------------------- 1 | #ifndef SLAB_H_ 2 | #define SLAB_H_ 3 | 4 | typedef enum { 5 | GFP_KERNEL, 6 | GFP_ATOMIC, 7 | __GFP_HIGHMEM, 8 | __GFP_HIGH 9 | } gfp_t; 10 | 11 | static inline void *kzalloc(size_t s, gfp_t gfp) { 12 | void *p = malloc(s); 13 | 14 | memset(p, 0, s); 15 | return p; 16 | } 17 | 18 | inline void *kmemdup(const void *src, size_t len, gfp_t gfp) { 19 | void *p; 20 | p = malloc(len); 21 | if (p) 22 | memcpy(p, src, len); 23 | return p; 24 | } 25 | 26 | static inline void kfree(const void* p) { 27 | free((void*)p); 28 | } 29 | 30 | 31 | #endif /* SLAB_H_ */ 32 | -------------------------------------------------------------------------------- /linux/usb/input.h: -------------------------------------------------------------------------------- 1 | #ifndef INPUT_H_ 2 | #define INPUT_H_ 3 | 4 | #include 5 | #include 6 | 7 | #define uint unsigned int 8 | #define ulong unsigned long 9 | #define u8 unsigned char 10 | #define u16 unsigned short 11 | #define u32 unsigned int 12 | #define u64 unsigned long 13 | 14 | #define ABS_VOLUME 0x20 15 | 16 | //input-event-codes.h 17 | #define KEY_RESERVED 0 18 | #define KEY_ESC 1 19 | #define KEY_1 2 20 | #define KEY_2 3 21 | #define KEY_3 4 22 | #define KEY_4 5 23 | #define KEY_5 6 24 | #define KEY_6 7 25 | #define KEY_7 8 26 | #define KEY_8 9 27 | #define KEY_9 10 28 | #define KEY_0 11 29 | #define KEY_MINUS 12 30 | #define KEY_EQUAL 13 31 | #define KEY_BACKSPACE 14 32 | #define KEY_TAB 15 33 | #define KEY_Q 16 34 | #define KEY_W 17 35 | #define KEY_E 18 36 | #define KEY_R 19 37 | #define KEY_T 20 38 | #define KEY_Y 21 39 | #define KEY_U 22 40 | #define KEY_I 23 41 | #define KEY_O 24 42 | #define KEY_P 25 43 | #define KEY_LEFTBRACE 26 44 | #define KEY_RIGHTBRACE 27 45 | #define KEY_ENTER 28 46 | #define KEY_LEFTCTRL 29 47 | #define KEY_A 30 48 | #define KEY_S 31 49 | #define KEY_D 32 50 | #define KEY_F 33 51 | #define KEY_G 34 52 | #define KEY_H 35 53 | #define KEY_J 36 54 | #define KEY_K 37 55 | #define KEY_L 38 56 | #define KEY_SEMICOLON 39 57 | #define KEY_APOSTROPHE 40 58 | #define KEY_GRAVE 41 59 | #define KEY_LEFTSHIFT 42 60 | #define KEY_BACKSLASH 43 61 | #define KEY_Z 44 62 | #define KEY_X 45 63 | #define KEY_C 46 64 | #define KEY_V 47 65 | #define KEY_B 48 66 | #define KEY_N 49 67 | #define KEY_M 50 68 | #define KEY_COMMA 51 69 | #define KEY_DOT 52 70 | #define KEY_SLASH 53 71 | #define KEY_RIGHTSHIFT 54 72 | #define KEY_KPASTERISK 55 73 | #define KEY_LEFTALT 56 74 | #define KEY_SPACE 57 75 | #define KEY_CAPSLOCK 58 76 | #define KEY_F1 59 77 | #define KEY_F2 60 78 | #define KEY_F3 61 79 | #define KEY_F4 62 80 | #define KEY_F5 63 81 | #define KEY_F6 64 82 | #define KEY_F7 65 83 | #define KEY_F8 66 84 | #define KEY_F9 67 85 | #define KEY_F10 68 86 | #define KEY_NUMLOCK 69 87 | #define KEY_SCROLLLOCK 70 88 | #define KEY_KP7 71 89 | #define KEY_KP8 72 90 | #define KEY_KP9 73 91 | #define KEY_KPMINUS 74 92 | #define KEY_KP4 75 93 | #define KEY_KP5 76 94 | #define KEY_KP6 77 95 | #define KEY_KPPLUS 78 96 | #define KEY_KP1 79 97 | #define KEY_KP2 80 98 | #define KEY_KP3 81 99 | #define KEY_KP0 82 100 | #define KEY_KPDOT 83 101 | 102 | #define KEY_ZENKAKUHANKAKU 85 103 | #define KEY_102ND 86 104 | #define KEY_F11 87 105 | #define KEY_F12 88 106 | #define KEY_RO 89 107 | #define KEY_KATAKANA 90 108 | #define KEY_HIRAGANA 91 109 | #define KEY_HENKAN 92 110 | #define KEY_KATAKANAHIRAGANA 93 111 | #define KEY_MUHENKAN 94 112 | #define KEY_KPJPCOMMA 95 113 | #define KEY_KPENTER 96 114 | #define KEY_RIGHTCTRL 97 115 | #define KEY_KPSLASH 98 116 | #define KEY_SYSRQ 99 117 | #define KEY_RIGHTALT 100 118 | #define KEY_LINEFEED 101 119 | #define KEY_HOME 102 120 | #define KEY_UP 103 121 | #define KEY_PAGEUP 104 122 | #define KEY_LEFT 105 123 | #define KEY_RIGHT 106 124 | #define KEY_END 107 125 | #define KEY_DOWN 108 126 | #define KEY_PAGEDOWN 109 127 | #define KEY_INSERT 110 128 | #define KEY_DELETE 111 129 | #define KEY_MACRO 112 130 | #define KEY_MUTE 113 131 | #define KEY_VOLUMEDOWN 114 132 | #define KEY_VOLUMEUP 115 133 | #define KEY_POWER 116 /* SC System Power Down */ 134 | #define KEY_KPEQUAL 117 135 | #define KEY_KPPLUSMINUS 118 136 | #define KEY_PAUSE 119 137 | #define KEY_SCALE 120 /* AL Compiz Scale (Expose) */ 138 | 139 | #define KEY_KPCOMMA 121 140 | #define KEY_HANGEUL 122 141 | #define KEY_HANGUEL KEY_HANGEUL 142 | #define KEY_HANJA 123 143 | #define KEY_YEN 124 144 | #define KEY_LEFTMETA 125 145 | #define KEY_RIGHTMETA 126 146 | #define KEY_COMPOSE 127 147 | 148 | #define KEY_STOP 128 /* AC Stop */ 149 | #define KEY_AGAIN 129 150 | #define KEY_PROPS 130 /* AC Properties */ 151 | #define KEY_UNDO 131 /* AC Undo */ 152 | #define KEY_FRONT 132 153 | #define KEY_COPY 133 /* AC Copy */ 154 | #define KEY_OPEN 134 /* AC Open */ 155 | #define KEY_PASTE 135 /* AC Paste */ 156 | #define KEY_FIND 136 /* AC Search */ 157 | #define KEY_CUT 137 /* AC Cut */ 158 | #define KEY_HELP 138 /* AL Integrated Help Center */ 159 | #define KEY_MENU 139 /* Menu (show menu) */ 160 | #define KEY_CALC 140 /* AL Calculator */ 161 | #define KEY_SETUP 141 162 | #define KEY_SLEEP 142 /* SC System Sleep */ 163 | #define KEY_WAKEUP 143 /* System Wake Up */ 164 | #define KEY_FILE 144 /* AL Local Machine Browser */ 165 | #define KEY_SENDFILE 145 166 | #define KEY_DELETEFILE 146 167 | #define KEY_XFER 147 168 | #define KEY_PROG1 148 169 | #define KEY_PROG2 149 170 | #define KEY_WWW 150 /* AL Internet Browser */ 171 | #define KEY_MSDOS 151 172 | #define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */ 173 | #define KEY_SCREENLOCK KEY_COFFEE 174 | #define KEY_DIRECTION 153 175 | #define KEY_CYCLEWINDOWS 154 176 | #define KEY_MAIL 155 177 | #define KEY_BOOKMARKS 156 /* AC Bookmarks */ 178 | #define KEY_COMPUTER 157 179 | #define KEY_BACK 158 /* AC Back */ 180 | #define KEY_FORWARD 159 /* AC Forward */ 181 | #define KEY_CLOSECD 160 182 | #define KEY_EJECTCD 161 183 | #define KEY_EJECTCLOSECD 162 184 | #define KEY_NEXTSONG 163 185 | #define KEY_PLAYPAUSE 164 186 | #define KEY_PREVIOUSSONG 165 187 | #define KEY_STOPCD 166 188 | #define KEY_RECORD 167 189 | #define KEY_REWIND 168 190 | #define KEY_PHONE 169 /* Media Select Telephone */ 191 | #define KEY_ISO 170 192 | #define KEY_CONFIG 171 /* AL Consumer Control Configuration */ 193 | #define KEY_HOMEPAGE 172 /* AC Home */ 194 | #define KEY_REFRESH 173 /* AC Refresh */ 195 | #define KEY_EXIT 174 /* AC Exit */ 196 | #define KEY_MOVE 175 197 | #define KEY_EDIT 176 198 | #define KEY_SCROLLUP 177 199 | #define KEY_SCROLLDOWN 178 200 | #define KEY_KPLEFTPAREN 179 201 | #define KEY_KPRIGHTPAREN 180 202 | #define KEY_NEW 181 /* AC New */ 203 | #define KEY_REDO 182 /* AC Redo/Repeat */ 204 | 205 | #define KEY_F13 183 206 | #define KEY_F14 184 207 | #define KEY_F15 185 208 | #define KEY_F16 186 209 | #define KEY_F17 187 210 | #define KEY_F18 188 211 | #define KEY_F19 189 212 | #define KEY_F20 190 213 | #define KEY_F21 191 214 | #define KEY_F22 192 215 | #define KEY_F23 193 216 | #define KEY_F24 194 217 | 218 | #define KEY_PLAYCD 200 219 | #define KEY_PAUSECD 201 220 | #define KEY_PROG3 202 221 | #define KEY_PROG4 203 222 | #define KEY_DASHBOARD 204 /* AL Dashboard */ 223 | #define KEY_SUSPEND 205 224 | #define KEY_CLOSE 206 /* AC Close */ 225 | #define KEY_PLAY 207 226 | #define KEY_FASTFORWARD 208 227 | #define KEY_BASSBOOST 209 228 | #define KEY_PRINT 210 /* AC Print */ 229 | #define KEY_HP 211 230 | #define KEY_CAMERA 212 231 | #define KEY_SOUND 213 232 | #define KEY_QUESTION 214 233 | #define KEY_EMAIL 215 234 | #define KEY_CHAT 216 235 | #define KEY_SEARCH 217 236 | #define KEY_CONNECT 218 237 | #define KEY_FINANCE 219 /* AL Checkbook/Finance */ 238 | #define KEY_SPORT 220 239 | #define KEY_SHOP 221 240 | #define KEY_ALTERASE 222 241 | #define KEY_CANCEL 223 /* AC Cancel */ 242 | #define KEY_BRIGHTNESSDOWN 224 243 | #define KEY_BRIGHTNESSUP 225 244 | #define KEY_MEDIA 226 245 | 246 | #define KEY_SWITCHVIDEOMODE 227 /* Cycle between available video 247 | outputs (Monitor/LCD/TV-out/etc) */ 248 | #define KEY_KBDILLUMTOGGLE 228 249 | #define KEY_KBDILLUMDOWN 229 250 | #define KEY_KBDILLUMUP 230 251 | 252 | #define KEY_SEND 231 /* AC Send */ 253 | #define KEY_REPLY 232 /* AC Reply */ 254 | #define KEY_FORWARDMAIL 233 /* AC Forward Msg */ 255 | #define KEY_SAVE 234 /* AC Save */ 256 | #define KEY_DOCUMENTS 235 257 | 258 | #define KEY_BATTERY 236 259 | 260 | #define KEY_BLUETOOTH 237 261 | #define KEY_WLAN 238 262 | #define KEY_UWB 239 263 | 264 | #define KEY_UNKNOWN 240 265 | 266 | #define KEY_VIDEO_NEXT 241 /* drive next video source */ 267 | #define KEY_VIDEO_PREV 242 /* drive previous video source */ 268 | #define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */ 269 | #define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */ 270 | #define KEY_DISPLAY_OFF 245 /* display device to off state */ 271 | 272 | #define KEY_WIMAX 246 273 | 274 | /* Range 248 - 255 is reserved for special needs of AT keyboard driver */ 275 | 276 | #define BTN_MISC 0x100 277 | #define BTN_0 0x100 278 | #define BTN_1 0x101 279 | #define BTN_2 0x102 280 | #define BTN_3 0x103 281 | #define BTN_4 0x104 282 | #define BTN_5 0x105 283 | #define BTN_6 0x106 284 | #define BTN_7 0x107 285 | #define BTN_8 0x108 286 | #define BTN_9 0x109 287 | 288 | #define BTN_MOUSE 0x110 289 | #define BTN_LEFT 0x110 290 | #define BTN_RIGHT 0x111 291 | #define BTN_MIDDLE 0x112 292 | #define BTN_SIDE 0x113 293 | #define BTN_EXTRA 0x114 294 | #define BTN_FORWARD 0x115 295 | #define BTN_BACK 0x116 296 | #define BTN_TASK 0x117 297 | 298 | #define BTN_JOYSTICK 0x120 299 | #define BTN_TRIGGER 0x120 300 | #define BTN_THUMB 0x121 301 | #define BTN_THUMB2 0x122 302 | #define BTN_TOP 0x123 303 | #define BTN_TOP2 0x124 304 | #define BTN_PINKIE 0x125 305 | #define BTN_BASE 0x126 306 | #define BTN_BASE2 0x127 307 | #define BTN_BASE3 0x128 308 | #define BTN_BASE4 0x129 309 | #define BTN_BASE5 0x12a 310 | #define BTN_BASE6 0x12b 311 | #define BTN_DEAD 0x12f 312 | 313 | #define BTN_GAMEPAD 0x130 314 | #define BTN_A 0x130 315 | #define BTN_B 0x131 316 | #define BTN_C 0x132 317 | #define BTN_X 0x133 318 | #define BTN_Y 0x134 319 | #define BTN_Z 0x135 320 | #define BTN_TL 0x136 321 | #define BTN_TR 0x137 322 | #define BTN_TL2 0x138 323 | #define BTN_TR2 0x139 324 | #define BTN_SELECT 0x13a 325 | #define BTN_START 0x13b 326 | #define BTN_MODE 0x13c 327 | #define BTN_THUMBL 0x13d 328 | #define BTN_THUMBR 0x13e 329 | 330 | #define BTN_DIGI 0x140 331 | #define BTN_TOOL_PEN 0x140 332 | #define BTN_TOOL_RUBBER 0x141 333 | #define BTN_TOOL_BRUSH 0x142 334 | #define BTN_TOOL_PENCIL 0x143 335 | #define BTN_TOOL_AIRBRUSH 0x144 336 | #define BTN_TOOL_FINGER 0x145 337 | #define BTN_TOOL_MOUSE 0x146 338 | #define BTN_TOOL_LENS 0x147 339 | #define BTN_TOUCH 0x14a 340 | #define BTN_STYLUS 0x14b 341 | #define BTN_STYLUS2 0x14c 342 | #define BTN_TOOL_DOUBLETAP 0x14d 343 | #define BTN_TOOL_TRIPLETAP 0x14e 344 | #define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */ 345 | 346 | #define BTN_WHEEL 0x150 347 | #define BTN_GEAR_DOWN 0x150 348 | #define BTN_GEAR_UP 0x151 349 | 350 | #define KEY_OK 0x160 351 | #define KEY_SELECT 0x161 352 | #define KEY_GOTO 0x162 353 | #define KEY_CLEAR 0x163 354 | #define KEY_POWER2 0x164 355 | #define KEY_OPTION 0x165 356 | #define KEY_INFO 0x166 /* AL OEM Features/Tips/Tutorial */ 357 | #define KEY_TIME 0x167 358 | #define KEY_VENDOR 0x168 359 | #define KEY_ARCHIVE 0x169 360 | #define KEY_PROGRAM 0x16a /* Media Select Program Guide */ 361 | #define KEY_CHANNEL 0x16b 362 | #define KEY_FAVORITES 0x16c 363 | #define KEY_EPG 0x16d 364 | #define KEY_PVR 0x16e /* Media Select Home */ 365 | #define KEY_MHP 0x16f 366 | #define KEY_LANGUAGE 0x170 367 | #define KEY_TITLE 0x171 368 | #define KEY_SUBTITLE 0x172 369 | #define KEY_ANGLE 0x173 370 | #define KEY_ZOOM 0x174 371 | #define KEY_MODE 0x175 372 | #define KEY_KEYBOARD 0x176 373 | #define KEY_SCREEN 0x177 374 | #define KEY_PC 0x178 /* Media Select Computer */ 375 | #define KEY_TV 0x179 /* Media Select TV */ 376 | #define KEY_TV2 0x17a /* Media Select Cable */ 377 | #define KEY_VCR 0x17b /* Media Select VCR */ 378 | #define KEY_VCR2 0x17c /* VCR Plus */ 379 | #define KEY_SAT 0x17d /* Media Select Satellite */ 380 | #define KEY_SAT2 0x17e 381 | #define KEY_CD 0x17f /* Media Select CD */ 382 | #define KEY_TAPE 0x180 /* Media Select Tape */ 383 | #define KEY_RADIO 0x181 384 | #define KEY_TUNER 0x182 /* Media Select Tuner */ 385 | #define KEY_PLAYER 0x183 386 | #define KEY_TEXT 0x184 387 | #define KEY_DVD 0x185 /* Media Select DVD */ 388 | #define KEY_AUX 0x186 389 | #define KEY_MP3 0x187 390 | #define KEY_AUDIO 0x188 391 | #define KEY_VIDEO 0x189 392 | #define KEY_DIRECTORY 0x18a 393 | #define KEY_LIST 0x18b 394 | #define KEY_MEMO 0x18c /* Media Select Messages */ 395 | #define KEY_CALENDAR 0x18d 396 | #define KEY_RED 0x18e 397 | #define KEY_GREEN 0x18f 398 | #define KEY_YELLOW 0x190 399 | #define KEY_BLUE 0x191 400 | #define KEY_CHANNELUP 0x192 /* Channel Increment */ 401 | #define KEY_CHANNELDOWN 0x193 /* Channel Decrement */ 402 | #define KEY_FIRST 0x194 403 | #define KEY_LAST 0x195 /* Recall Last */ 404 | #define KEY_AB 0x196 405 | #define KEY_NEXT 0x197 406 | #define KEY_RESTART 0x198 407 | #define KEY_SLOW 0x199 408 | #define KEY_SHUFFLE 0x19a 409 | #define KEY_BREAK 0x19b 410 | #define KEY_PREVIOUS 0x19c 411 | #define KEY_DIGITS 0x19d 412 | #define KEY_TEEN 0x19e 413 | #define KEY_TWEN 0x19f 414 | #define KEY_VIDEOPHONE 0x1a0 /* Media Select Video Phone */ 415 | #define KEY_GAMES 0x1a1 /* Media Select Games */ 416 | #define KEY_ZOOMIN 0x1a2 /* AC Zoom In */ 417 | #define KEY_ZOOMOUT 0x1a3 /* AC Zoom Out */ 418 | #define KEY_ZOOMRESET 0x1a4 /* AC Zoom */ 419 | #define KEY_WORDPROCESSOR 0x1a5 /* AL Word Processor */ 420 | #define KEY_EDITOR 0x1a6 /* AL Text Editor */ 421 | #define KEY_SPREADSHEET 0x1a7 /* AL Spreadsheet */ 422 | #define KEY_GRAPHICSEDITOR 0x1a8 /* AL Graphics Editor */ 423 | #define KEY_PRESENTATION 0x1a9 /* AL Presentation App */ 424 | #define KEY_DATABASE 0x1aa /* AL Database App */ 425 | #define KEY_NEWS 0x1ab /* AL Newsreader */ 426 | #define KEY_VOICEMAIL 0x1ac /* AL Voicemail */ 427 | #define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */ 428 | #define KEY_MESSENGER 0x1ae /* AL Instant Messaging */ 429 | #define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */ 430 | #define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */ 431 | #define KEY_LOGOFF 0x1b1 /* AL Logoff */ 432 | 433 | #define KEY_DOLLAR 0x1b2 434 | #define KEY_EURO 0x1b3 435 | 436 | #define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */ 437 | #define KEY_FRAMEFORWARD 0x1b5 438 | #define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */ 439 | #define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */ 440 | 441 | #define KEY_DEL_EOL 0x1c0 442 | #define KEY_DEL_EOS 0x1c1 443 | #define KEY_INS_LINE 0x1c2 444 | #define KEY_DEL_LINE 0x1c3 445 | 446 | #define KEY_FN 0x1d0 447 | #define KEY_FN_ESC 0x1d1 448 | #define KEY_FN_F1 0x1d2 449 | #define KEY_FN_F2 0x1d3 450 | #define KEY_FN_F3 0x1d4 451 | #define KEY_FN_F4 0x1d5 452 | #define KEY_FN_F5 0x1d6 453 | #define KEY_FN_F6 0x1d7 454 | #define KEY_FN_F7 0x1d8 455 | #define KEY_FN_F8 0x1d9 456 | #define KEY_FN_F9 0x1da 457 | #define KEY_FN_F10 0x1db 458 | #define KEY_FN_F11 0x1dc 459 | #define KEY_FN_F12 0x1dd 460 | #define KEY_FN_1 0x1de 461 | #define KEY_FN_2 0x1df 462 | #define KEY_FN_D 0x1e0 463 | #define KEY_FN_E 0x1e1 464 | #define KEY_FN_F 0x1e2 465 | #define KEY_FN_S 0x1e3 466 | #define KEY_FN_B 0x1e4 467 | 468 | #define KEY_BRL_DOT1 0x1f1 469 | #define KEY_BRL_DOT2 0x1f2 470 | #define KEY_BRL_DOT3 0x1f3 471 | #define KEY_BRL_DOT4 0x1f4 472 | #define KEY_BRL_DOT5 0x1f5 473 | #define KEY_BRL_DOT6 0x1f6 474 | #define KEY_BRL_DOT7 0x1f7 475 | #define KEY_BRL_DOT8 0x1f8 476 | #define KEY_BRL_DOT9 0x1f9 477 | #define KEY_BRL_DOT10 0x1fa 478 | 479 | #define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */ 480 | #define KEY_NUMERIC_1 0x201 /* and other keypads */ 481 | #define KEY_NUMERIC_2 0x202 482 | #define KEY_NUMERIC_3 0x203 483 | #define KEY_NUMERIC_4 0x204 484 | #define KEY_NUMERIC_5 0x205 485 | #define KEY_NUMERIC_6 0x206 486 | #define KEY_NUMERIC_7 0x207 487 | #define KEY_NUMERIC_8 0x208 488 | #define KEY_NUMERIC_9 0x209 489 | #define KEY_NUMERIC_STAR 0x20a 490 | #define KEY_NUMERIC_POUND 0x20b 491 | 492 | /* We avoid low common keys in module aliases so they don't get huge. */ 493 | #define KEY_MIN_INTERESTING KEY_MUTE 494 | #define KEY_MAX 0x2ff 495 | #define KEY_CNT (KEY_MAX+1) 496 | 497 | #define EV_SYN 0x00 498 | #define EV_KEY 0x01 499 | #define EV_REL 0x02 500 | #define EV_ABS 0x03 501 | #define EV_MSC 0x04 502 | #define EV_SW 0x05 503 | #define EV_LED 0x11 504 | #define EV_SND 0x12 505 | #define EV_REP 0x14 506 | #define EV_FF 0x15 507 | #define EV_PWR 0x16 508 | #define EV_FF_STATUS 0x17 509 | #define EV_MAX 0x1f 510 | #define EV_CNT (EV_MAX+1) 511 | 512 | #define SYN_REPORT 0 513 | 514 | #define BITS_PER_BYTE 8 515 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 516 | #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) 517 | #define DECLARE_BITMAP(name,bits) unsigned long name[BITS_TO_LONGS(bits)] 518 | 519 | struct input_dev { 520 | const char *name; 521 | const char *phys; 522 | unsigned long evbit[BITS_TO_LONGS(EV_CNT)]; 523 | unsigned long keybit[BITS_TO_LONGS(KEY_CNT)]; 524 | }; 525 | 526 | static inline void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) { 527 | printf("input_event\n"); 528 | } 529 | 530 | static inline void input_report_key(struct input_dev *dev, unsigned int code, int value) { 531 | input_event(dev, EV_KEY, code, value); 532 | } 533 | 534 | static inline void input_sync(struct input_dev *dev) { 535 | input_event(dev, EV_SYN, SYN_REPORT, 0); 536 | } 537 | 538 | 539 | #endif /* INPUT_H_ */ 540 | -------------------------------------------------------------------------------- /winprojectexampledll/ChromaExampleDLL.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {720FE38F-432B-422C-AC23-00855B10313F} 23 | Win32Proj 24 | OpenRazerExampleDLL 25 | 26 | 27 | 28 | Application 29 | true 30 | v142 31 | 32 | 33 | Application 34 | false 35 | v142 36 | 37 | 38 | Application 39 | true 40 | v142 41 | 42 | 43 | Application 44 | false 45 | v142 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | true 67 | 68 | 69 | true 70 | 71 | 72 | 73 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 74 | MultiThreadedDebugDLL 75 | Level3 76 | ProgramDatabase 77 | Disabled 78 | $(ProjectDir);$(ProjectDir)..;$(ProjectDir)..\dependencies\hidapi 79 | true 80 | 81 | 82 | MachineX86 83 | true 84 | Console 85 | ..\dependencies\hidapi-win\x86;%(AdditionalLibraryDirectories) 86 | 87 | 88 | 89 | 90 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 91 | MultiThreadedDLL 92 | Level3 93 | ProgramDatabase 94 | $(ProjectDir);$(ProjectDir)..;$(ProjectDir)..\dependencies\hidapi 95 | true 96 | 97 | 98 | MachineX86 99 | true 100 | Console 101 | true 102 | true 103 | ..\dependencies\hidapi-win\x86;%(AdditionalLibraryDirectories) 104 | 105 | 106 | 107 | 108 | $(ProjectDir);$(ProjectDir)..;$(ProjectDir)..\dependencies\hidapi 109 | true 110 | 111 | 112 | ..\dependencies\hidapi-win\x64;%(AdditionalLibraryDirectories) 113 | 114 | 115 | 116 | 117 | $(ProjectDir);$(ProjectDir)..;$(ProjectDir)..\dependencies\hidapi 118 | true 119 | 120 | 121 | ..\dependencies\hidapi-win\x64;%(AdditionalLibraryDirectories) 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /winprojectexampledll/ChromaExampleDLL.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(ProjectDir).. 5 | WindowsLocalDebugger 6 | 7 | 8 | $(ProjectDir).. 9 | WindowsLocalDebugger 10 | 11 | 12 | $(ProjectDir).. 13 | WindowsLocalDebugger 14 | 15 | 16 | $(ProjectDir).. 17 | WindowsLocalDebugger 18 | 19 | -------------------------------------------------------------------------------- /winprojectexampledll/defines.h: -------------------------------------------------------------------------------- 1 | #undef DLL_INTERNAL 2 | //#define DLL_INTERNAL extern 3 | -------------------------------------------------------------------------------- /winprojectexampledll/main.cpp: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------*\ 2 | | OpenRazer-Win32 Demo Application | 3 | | | 4 | | This application uses the OpenRazer-Win32 driver to test | 5 | | all modes of Razer devices. | 6 | | | 7 | | Original code: | 8 | | https://github.com/rsandoz/razer-drivers-win32 | 9 | | | 10 | | Updated by Adam Honse (CalcProgrammer1), 4/21/2020 | 11 | \*---------------------------------------------------------*/ 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | /*---------------------------------------------------------*\ 24 | | This section selects between the 32 and 64 bit DLLs | 25 | \*---------------------------------------------------------*/ 26 | #ifdef _WIN64 27 | #define OPENRAZERDLL _T("OpenRazer64.dll") 28 | #elif WIN32 29 | #define OPENRAZERDLL _T("OpenRazer.dll") 30 | #endif 31 | 32 | /*---------------------------------------------------------*\ 33 | | This structure holds all possible device attributes that | 34 | | are used in the demo application. Device attributes are | 35 | | equivalent to sysfs entries on Linux. | 36 | \*---------------------------------------------------------*/ 37 | typedef struct 38 | { 39 | struct device_attribute* device_type; 40 | struct device_attribute* device_serial; 41 | struct device_attribute* firmware_version; 42 | 43 | struct device_attribute* matrix_custom_frame; 44 | struct device_attribute* matrix_brightness; 45 | 46 | struct device_attribute* matrix_effect_custom; 47 | struct device_attribute* matrix_effect_none; 48 | struct device_attribute* matrix_effect_static; 49 | struct device_attribute* matrix_effect_breath; 50 | struct device_attribute* matrix_effect_spectrum; 51 | struct device_attribute* matrix_effect_reactive; 52 | struct device_attribute* matrix_effect_wave; 53 | 54 | struct device_attribute* logo_led_brightness; 55 | struct device_attribute* logo_matrix_effect_none; 56 | struct device_attribute* logo_matrix_effect_static; 57 | struct device_attribute* logo_matrix_effect_breath; 58 | struct device_attribute* logo_matrix_effect_spectrum; 59 | struct device_attribute* logo_matrix_effect_reactive; 60 | 61 | struct device_attribute* scroll_led_brightness; 62 | struct device_attribute* scroll_matrix_effect_none; 63 | struct device_attribute* scroll_matrix_effect_static; 64 | struct device_attribute* scroll_matrix_effect_breath; 65 | struct device_attribute* scroll_matrix_effect_spectrum; 66 | struct device_attribute* scroll_matrix_effect_reactive; 67 | 68 | struct device_attribute* left_led_brightness; 69 | struct device_attribute* left_matrix_effect_none; 70 | struct device_attribute* left_matrix_effect_static; 71 | struct device_attribute* left_matrix_effect_breath; 72 | struct device_attribute* left_matrix_effect_spectrum; 73 | struct device_attribute* left_matrix_effect_reactive; 74 | struct device_attribute* left_matrix_effect_wave; 75 | 76 | struct device_attribute* right_led_brightness; 77 | struct device_attribute* right_matrix_effect_none; 78 | struct device_attribute* right_matrix_effect_static; 79 | struct device_attribute* right_matrix_effect_breath; 80 | struct device_attribute* right_matrix_effect_spectrum; 81 | struct device_attribute* right_matrix_effect_reactive; 82 | struct device_attribute* right_matrix_effect_wave; 83 | 84 | struct device_attribute* logo_led_effect; 85 | struct device_attribute* logo_led_rgb; 86 | struct device_attribute* logo_led_state; 87 | 88 | struct device_attribute* scroll_led_effect; 89 | struct device_attribute* scroll_led_rgb; 90 | struct device_attribute* scroll_led_state; 91 | } device_fn_type; 92 | 93 | typedef struct 94 | { 95 | struct device_attribute* dev_attr_list[44]; 96 | } device_fn_list_type; 97 | 98 | /*---------------------------------------------------------*\ 99 | | This is a table of device attribute names. It should | 100 | | always match the order of the entries in the structure | 101 | \*---------------------------------------------------------*/ 102 | static const char* device_fn_names[] = 103 | { 104 | "device_type", 105 | "device_serial", 106 | "firmware_version", 107 | 108 | "matrix_custom_frame", 109 | "matrix_brightness", 110 | 111 | "matrix_effect_custom", 112 | "matrix_effect_none", 113 | "matrix_effect_static", 114 | "matrix_effect_breath", 115 | "matrix_effect_spectrum", 116 | "matrix_effect_reactive", 117 | "matrix_effect_wave", 118 | 119 | "logo_led_brightness", 120 | "logo_matrix_effect_none", 121 | "logo_matrix_effect_static", 122 | "logo_matrix_effect_breath", 123 | "logo_matrix_effect_spectrum", 124 | "logo_matrix_effect_reactive", 125 | 126 | "scroll_led_brightness", 127 | "scroll_matrix_effect_none", 128 | "scroll_matrix_effect_static", 129 | "scroll_matrix_effect_breath", 130 | "scroll_matrix_effect_spectrum", 131 | "scroll_matrix_effect_reactive", 132 | 133 | "left_led_brightness", 134 | "left_matrix_effect_none", 135 | "left_matrix_effect_static", 136 | "left_matrix_effect_breath", 137 | "left_matrix_effect_spectrum", 138 | "left_matrix_effect_reactive", 139 | "left_matrix_effect_wave", 140 | 141 | "right_led_brightness", 142 | "right_matrix_effect_none", 143 | "right_matrix_effect_static", 144 | "right_matrix_effect_breath", 145 | "right_matrix_effect_spectrum", 146 | "right_matrix_effect_reactive", 147 | "right_matrix_effect_wave", 148 | 149 | "logo_led_effect", 150 | "logo_led_rgb", 151 | "logo_led_state", 152 | 153 | "scroll_led_effect", 154 | "scroll_led_rgb", 155 | "scroll_led_state" 156 | }; 157 | 158 | /*---------------------------------------------------------*\ 159 | | This function searches the device attribute list of a | 160 | | given device to fill in a device_fn_type structure | 161 | \*---------------------------------------------------------*/ 162 | static void load_device_fn(device_fn_type* device_fn, device* dev) 163 | { 164 | memset(device_fn, 0, sizeof(device_fn_type)); 165 | 166 | for (int table_idx = 0; table_idx < 44; table_idx++) 167 | { 168 | for (int list_idx = 0; list_idx < dev->attr_count; list_idx++) 169 | { 170 | if (strcmp(device_fn_names[table_idx], dev->attr_list[list_idx]->name) == 0) 171 | { 172 | ((device_fn_list_type*)device_fn)->dev_attr_list[table_idx] = dev->attr_list[list_idx]; 173 | } 174 | } 175 | } 176 | } 177 | 178 | /*---------------------------------------------------------*\ 179 | | Tables of test data | 180 | \*---------------------------------------------------------*/ 181 | static const COLORREF testColor[] = 182 | { 183 | RGB(0x00,0x00,0xFF) 184 | , RGB(0x00,0xFF,0x00) 185 | , RGB(0xFF,0x00,0x00) 186 | , RGB(0xFF,0xFF,0x00) 187 | , RGB(0xFF,0x00,0xFF) 188 | , RGB(0x00,0xFF,0xFF) 189 | }; 190 | 191 | static const char* testReactive[] = 192 | { 193 | "\x00\xFF\x00\x00" 194 | , "\x20\xFF\xFF\x00" 195 | , "\x30\x00\xFF\x00" 196 | }; 197 | 198 | static const char* testBrightness[] = 199 | { 200 | "0" 201 | , "31" 202 | , "63" 203 | , "95" 204 | , "127" 205 | , "159" 206 | , "191" 207 | , "223" 208 | , "255"}; 209 | 210 | /*---------------------------------------------------------*\ 211 | | Functions to extract color components from COLORREF | 212 | \*---------------------------------------------------------*/ 213 | static unsigned char red(COLORREF color) 214 | { 215 | return (char)(color & 0x0000FF); 216 | } 217 | 218 | static unsigned char green(COLORREF color) 219 | { 220 | return (char)((color & 0x00FF00) >> 8); 221 | } 222 | 223 | static unsigned char blue(COLORREF color) 224 | { 225 | return (char)((color & 0xFF0000) >> 16); 226 | } 227 | 228 | /*---------------------------------------------------------*\ 229 | | Main function of demo application | 230 | \*---------------------------------------------------------*/ 231 | int main(int argc, char** argv) 232 | { 233 | printf("Press enter to load DLL..."); 234 | getc(stdin); 235 | printf("\n"); 236 | 237 | HMODULE chromaLinuxModule = LoadLibrary(OPENRAZERDLL); 238 | if (chromaLinuxModule == nullptr) 239 | return 0; 240 | 241 | /*---------------------------------------------------------*\ 242 | | Map DLL functions | 243 | \*---------------------------------------------------------*/ 244 | typedef unsigned int(*INITRAZERDRIVER)(struct hid_device** hdev); 245 | 246 | INITRAZERDRIVER init_razer_kbd_driver = reinterpret_cast(GetProcAddress(chromaLinuxModule, "init_razer_kbd_driver")); 247 | INITRAZERDRIVER init_razer_mouse_driver = reinterpret_cast(GetProcAddress(chromaLinuxModule, "init_razer_mouse_driver")); 248 | INITRAZERDRIVER init_razer_accessory_driver = reinterpret_cast(GetProcAddress(chromaLinuxModule, "init_razer_accessory_driver")); 249 | INITRAZERDRIVER init_razer_kraken_driver = reinterpret_cast(GetProcAddress(chromaLinuxModule, "init_razer_kraken_driver")); 250 | 251 | /*---------------------------------------------------------*\ 252 | | Initialize all OpenRazer driver modules and store devices | 253 | \*---------------------------------------------------------*/ 254 | printf("Press enter to init usb and devices..."); 255 | getc(stdin); 256 | printf("\n"); 257 | 258 | struct hid_device* hdev; 259 | std::vector devs; 260 | std::vector devices; 261 | unsigned int num; 262 | 263 | hdev = NULL; 264 | num = init_razer_kbd_driver(&hdev); 265 | for (unsigned int i = 0; i < num; i++) 266 | { 267 | device_fn_type new_dev; 268 | load_device_fn(&new_dev, &hdev[i].dev); 269 | devs.push_back(&hdev[i].dev); 270 | devices.push_back(new_dev); 271 | } 272 | 273 | hdev = NULL; 274 | num = init_razer_mouse_driver(&hdev); 275 | for (unsigned int i = 0; i < num; i++) 276 | { 277 | device_fn_type new_dev; 278 | load_device_fn(&new_dev, &hdev[i].dev); 279 | devs.push_back(&hdev[i].dev); 280 | devices.push_back(new_dev); 281 | } 282 | 283 | hdev = NULL; 284 | num = init_razer_accessory_driver(&hdev); 285 | for (unsigned int i = 0; i < num; i++) 286 | { 287 | device_fn_type new_dev; 288 | load_device_fn(&new_dev, &hdev[i].dev); 289 | devs.push_back(&hdev[i].dev); 290 | devices.push_back(new_dev); 291 | } 292 | 293 | hdev = NULL; 294 | num = init_razer_kraken_driver(&hdev); 295 | for (unsigned int i = 0; i < num; i++) 296 | { 297 | device_fn_type new_dev; 298 | load_device_fn(&new_dev, &hdev[i].dev); 299 | devs.push_back(&hdev[i].dev); 300 | devices.push_back(new_dev); 301 | } 302 | 303 | /*---------------------------------------------------------*\ 304 | | Start by setting static white | 305 | \*---------------------------------------------------------*/ 306 | printf("Press enter to start..."); 307 | getc(stdin); 308 | printf("\n"); 309 | 310 | for (int dev_idx = 0; dev_idx < devices.size(); dev_idx++) 311 | { 312 | if (devices[dev_idx].matrix_effect_static) 313 | { 314 | const char cmd[3] = { 0xFF, 0xFF, 0xFF }; 315 | 316 | devices[dev_idx].matrix_effect_static->store(devs[dev_idx], NULL, cmd, 3); 317 | } 318 | 319 | if (devices[dev_idx].logo_matrix_effect_static) 320 | { 321 | const char cmd[3] = { 0xFF, 0xFF, 0xFF }; 322 | 323 | devices[dev_idx].logo_matrix_effect_static->store(devs[dev_idx], NULL, cmd, 3); 324 | } 325 | 326 | if (devices[dev_idx].scroll_matrix_effect_static) 327 | { 328 | const char cmd[3] = { 0xFF, 0xFF, 0xFF }; 329 | 330 | devices[dev_idx].scroll_matrix_effect_static->store(devs[dev_idx], NULL, cmd, 3); 331 | } 332 | 333 | if (devices[dev_idx].left_matrix_effect_static) 334 | { 335 | const char cmd[3] = { 0xFF, 0xFF, 0xFF }; 336 | 337 | devices[dev_idx].left_matrix_effect_static->store(devs[dev_idx], NULL, cmd, 3); 338 | } 339 | 340 | if (devices[dev_idx].right_matrix_effect_static) 341 | { 342 | const char cmd[3] = { 0xFF, 0xFF, 0xFF }; 343 | 344 | devices[dev_idx].right_matrix_effect_static->store(devs[dev_idx], NULL, cmd, 3); 345 | } 346 | 347 | if (devices[dev_idx].logo_led_state) 348 | { 349 | const char state[1] = { '1' }; 350 | 351 | devices[dev_idx].logo_led_state->store(devs[dev_idx], NULL, state, 1); 352 | } 353 | 354 | if (devices[dev_idx].scroll_led_state) 355 | { 356 | const char state[1] = { '1' }; 357 | 358 | devices[dev_idx].scroll_led_state->store(devs[dev_idx], NULL, state, 1); 359 | } 360 | 361 | if (devices[dev_idx].logo_led_rgb && devices[dev_idx].logo_led_effect) 362 | { 363 | const char cmd[3] = { 0xFF, 0xFF, 0xFF }; 364 | 365 | devices[dev_idx].logo_led_rgb->store(devs[dev_idx], NULL, cmd, 3); 366 | 367 | const char effect[1] = { '0' }; 368 | 369 | devices[dev_idx].logo_led_effect->store(devs[dev_idx], NULL, effect, 1); 370 | } 371 | 372 | if (devices[dev_idx].scroll_led_rgb && devices[dev_idx].scroll_led_effect) 373 | { 374 | const char cmd[3] = { 0xFF, 0xFF, 0xFF }; 375 | 376 | devices[dev_idx].scroll_led_rgb->store(devs[dev_idx], NULL, cmd, 3); 377 | 378 | const char effect[1] = { '0' }; 379 | 380 | devices[dev_idx].scroll_led_effect->store(devs[dev_idx], NULL, effect, 1); 381 | } 382 | } 383 | 384 | /*---------------------------------------------------------*\ 385 | | Test brightness | 386 | \*---------------------------------------------------------*/ 387 | for (int i = 0; i < _countof(testBrightness); i++) 388 | { 389 | printf("Press enter to test brightness level %s ...", testBrightness[i]); 390 | getc(stdin); 391 | printf("\n"); 392 | 393 | for (int dev_idx = 0; dev_idx < devices.size(); dev_idx++) 394 | { 395 | if (devices[dev_idx].matrix_brightness) 396 | { 397 | devices[dev_idx].matrix_brightness->store(devs[dev_idx], NULL, testBrightness[i], strlen(testBrightness[i]) - 1); 398 | } 399 | 400 | if (devices[dev_idx].logo_led_brightness) 401 | { 402 | devices[dev_idx].logo_led_brightness->store(devs[dev_idx], NULL, testBrightness[i], strlen(testBrightness[i]) - 1); 403 | } 404 | 405 | if (devices[dev_idx].scroll_led_brightness) 406 | { 407 | devices[dev_idx].scroll_led_brightness->store(devs[dev_idx], NULL, testBrightness[i], strlen(testBrightness[i]) - 1); 408 | } 409 | 410 | if (devices[dev_idx].left_led_brightness) 411 | { 412 | devices[dev_idx].left_led_brightness->store(devs[dev_idx], NULL, testBrightness[i], strlen(testBrightness[i]) - 1); 413 | } 414 | 415 | if (devices[dev_idx].right_led_brightness) 416 | { 417 | devices[dev_idx].right_led_brightness->store(devs[dev_idx], NULL, testBrightness[i], strlen(testBrightness[i]) - 1); 418 | } 419 | } 420 | } 421 | 422 | /*---------------------------------------------------------*\ 423 | | Test none (off) | 424 | \*---------------------------------------------------------*/ 425 | printf("Press enter to test none (turn everything off)..."); 426 | getc(stdin); 427 | printf("\n"); 428 | 429 | for (int dev_idx = 0; dev_idx < devices.size(); dev_idx++) 430 | { 431 | if (devices[dev_idx].matrix_effect_none) 432 | { 433 | const char cmd[1] = { 0x00 }; 434 | 435 | devices[dev_idx].matrix_effect_none->store(devs[dev_idx], NULL, cmd, 1); 436 | } 437 | 438 | if (devices[dev_idx].logo_matrix_effect_none) 439 | { 440 | const char cmd[1] = { 0x00 }; 441 | 442 | devices[dev_idx].logo_matrix_effect_none->store(devs[dev_idx], NULL, cmd, 1); 443 | } 444 | 445 | if (devices[dev_idx].scroll_matrix_effect_none) 446 | { 447 | const char cmd[1] = { 0x00 }; 448 | 449 | devices[dev_idx].scroll_matrix_effect_none->store(devs[dev_idx], NULL, cmd, 1); 450 | } 451 | 452 | if (devices[dev_idx].left_matrix_effect_none) 453 | { 454 | const char cmd[1] = { 0x00 }; 455 | 456 | devices[dev_idx].left_matrix_effect_none->store(devs[dev_idx], NULL, cmd, 1); 457 | } 458 | 459 | if (devices[dev_idx].right_matrix_effect_none) 460 | { 461 | const char cmd[1] = { 0x00 }; 462 | 463 | devices[dev_idx].right_matrix_effect_none->store(devs[dev_idx], NULL, cmd, 1); 464 | } 465 | 466 | if (devices[dev_idx].logo_led_state) 467 | { 468 | const char state[1] = { '0' }; 469 | 470 | devices[dev_idx].logo_led_state->store(devs[dev_idx], NULL, state, 1); 471 | } 472 | 473 | if (devices[dev_idx].scroll_led_state) 474 | { 475 | const char state[1] = { '0' }; 476 | 477 | devices[dev_idx].scroll_led_state->store(devs[dev_idx], NULL, state, 1); 478 | } 479 | } 480 | 481 | /*---------------------------------------------------------*\ 482 | | Test spectrum | 483 | \*---------------------------------------------------------*/ 484 | printf("Press enter to test spectrum effects..."); 485 | getc(stdin); 486 | printf("\n"); 487 | 488 | for (int dev_idx = 0; dev_idx < devices.size(); dev_idx++) 489 | { 490 | if (devices[dev_idx].matrix_effect_spectrum) 491 | { 492 | const char cmd[1] = { 0x00 }; 493 | 494 | devices[dev_idx].matrix_effect_spectrum->store(devs[dev_idx], NULL, cmd, 1); 495 | } 496 | 497 | if (devices[dev_idx].logo_matrix_effect_spectrum) 498 | { 499 | const char cmd[1] = { 0x00 }; 500 | 501 | devices[dev_idx].logo_matrix_effect_spectrum->store(devs[dev_idx], NULL, cmd, 1); 502 | } 503 | 504 | if (devices[dev_idx].scroll_matrix_effect_spectrum) 505 | { 506 | const char cmd[1] = { 0x00 }; 507 | 508 | devices[dev_idx].scroll_matrix_effect_spectrum->store(devs[dev_idx], NULL, cmd, 1); 509 | } 510 | 511 | if (devices[dev_idx].left_matrix_effect_spectrum) 512 | { 513 | const char cmd[1] = { 0x00 }; 514 | 515 | devices[dev_idx].left_matrix_effect_spectrum->store(devs[dev_idx], NULL, cmd, 1); 516 | } 517 | 518 | if (devices[dev_idx].right_matrix_effect_spectrum) 519 | { 520 | const char cmd[1] = { 0x00 }; 521 | 522 | devices[dev_idx].right_matrix_effect_spectrum->store(devs[dev_idx], NULL, cmd, 1); 523 | } 524 | 525 | if (devices[dev_idx].logo_led_state && devices[dev_idx].logo_led_effect) 526 | { 527 | const char state[1] = { '1' }; 528 | 529 | devices[dev_idx].logo_led_state->store(devs[dev_idx], NULL, state, 1); 530 | 531 | const char effect[1] = { '4' }; 532 | 533 | devices[dev_idx].logo_led_effect->store(devs[dev_idx], NULL, effect, 1); 534 | } 535 | 536 | if (devices[dev_idx].scroll_led_state && devices[dev_idx].scroll_led_effect) 537 | { 538 | const char state[1] = { '1' }; 539 | 540 | devices[dev_idx].scroll_led_state->store(devs[dev_idx], NULL, state, 1); 541 | 542 | const char effect[1] = { '4' }; 543 | 544 | devices[dev_idx].scroll_led_effect->store(devs[dev_idx], NULL, effect, 1); 545 | } 546 | } 547 | 548 | /*---------------------------------------------------------*\ 549 | | Test reactive | 550 | \*---------------------------------------------------------*/ 551 | printf("Press enter to test reactive effects..."); 552 | getc(stdin); 553 | printf("\n"); 554 | 555 | for (int dev_idx = 0; dev_idx < devices.size(); dev_idx++) 556 | { 557 | if (devices[dev_idx].matrix_effect_reactive) 558 | { 559 | const char cmd[1] = { 0x00 }; 560 | 561 | devices[dev_idx].matrix_effect_reactive->store(devs[dev_idx], NULL, cmd, 1); 562 | } 563 | 564 | if (devices[dev_idx].logo_matrix_effect_reactive) 565 | { 566 | const char cmd[1] = { 0x00 }; 567 | 568 | devices[dev_idx].logo_matrix_effect_reactive->store(devs[dev_idx], NULL, cmd, 1); 569 | } 570 | 571 | if (devices[dev_idx].scroll_matrix_effect_reactive) 572 | { 573 | const char cmd[1] = { 0x00 }; 574 | 575 | devices[dev_idx].scroll_matrix_effect_reactive->store(devs[dev_idx], NULL, cmd, 1); 576 | } 577 | 578 | if (devices[dev_idx].left_matrix_effect_reactive) 579 | { 580 | const char cmd[1] = { 0x00 }; 581 | 582 | devices[dev_idx].left_matrix_effect_reactive->store(devs[dev_idx], NULL, cmd, 1); 583 | } 584 | 585 | if (devices[dev_idx].right_matrix_effect_reactive) 586 | { 587 | const char cmd[1] = { 0x00 }; 588 | 589 | devices[dev_idx].right_matrix_effect_reactive->store(devs[dev_idx], NULL, cmd, 1); 590 | } 591 | } 592 | 593 | /*---------------------------------------------------------*\ 594 | | Test static | 595 | \*---------------------------------------------------------*/ 596 | printf("Press enter to test static effects (loop through 6 colors)..."); 597 | getc(stdin); 598 | printf("\n"); 599 | 600 | for (int i = 0; i < _countof(testColor); i++) 601 | { 602 | for (int dev_idx = 0; dev_idx < devices.size(); dev_idx++) 603 | { 604 | if (devices[dev_idx].matrix_effect_static) 605 | { 606 | const char cmd[3] = { red(testColor[i]), green(testColor[i]), blue(testColor[i]) }; 607 | 608 | devices[dev_idx].matrix_effect_static->store(devs[dev_idx], NULL, cmd, 3); 609 | } 610 | 611 | if (devices[dev_idx].logo_matrix_effect_static) 612 | { 613 | const char cmd[3] = { red(testColor[i]), green(testColor[i]), blue(testColor[i]) }; 614 | 615 | devices[dev_idx].logo_matrix_effect_static->store(devs[dev_idx], NULL, cmd, 3); 616 | } 617 | 618 | if (devices[dev_idx].scroll_matrix_effect_static) 619 | { 620 | const char cmd[3] = { red(testColor[i]), green(testColor[i]), blue(testColor[i]) }; 621 | 622 | devices[dev_idx].scroll_matrix_effect_static->store(devs[dev_idx], NULL, cmd, 3); 623 | } 624 | 625 | if (devices[dev_idx].left_matrix_effect_static) 626 | { 627 | const char cmd[3] = { red(testColor[i]), green(testColor[i]), blue(testColor[i]) }; 628 | 629 | devices[dev_idx].left_matrix_effect_static->store(devs[dev_idx], NULL, cmd, 3); 630 | } 631 | 632 | if (devices[dev_idx].right_matrix_effect_static) 633 | { 634 | const char cmd[3] = { red(testColor[i]), green(testColor[i]), blue(testColor[i]) }; 635 | 636 | devices[dev_idx].right_matrix_effect_static->store(devs[dev_idx], NULL, cmd, 3); 637 | } 638 | 639 | if (devices[dev_idx].logo_led_rgb && devices[dev_idx].logo_led_effect) 640 | { 641 | const char effect[1] = { '0' }; 642 | 643 | devices[dev_idx].logo_led_effect->store(devs[dev_idx], NULL, effect, 1); 644 | 645 | const char cmd[3] = { red(testColor[i]), green(testColor[i]), blue(testColor[i]) }; 646 | 647 | devices[dev_idx].logo_led_rgb->store(devs[dev_idx], NULL, cmd, 3); 648 | } 649 | 650 | if (devices[dev_idx].scroll_led_rgb && devices[dev_idx].scroll_led_effect) 651 | { 652 | const char effect[1] = { '0' }; 653 | 654 | devices[dev_idx].scroll_led_effect->store(devs[dev_idx], NULL, effect, 1); 655 | 656 | const char cmd[3] = { red(testColor[i]), green(testColor[i]), blue(testColor[i]) }; 657 | 658 | devices[dev_idx].scroll_led_rgb->store(devs[dev_idx], NULL, cmd, 3); 659 | } 660 | } 661 | 662 | printf("Color RGB(%02X,%02X,%02X) sent. Press enter to test next color...",red(testColor[i]), green(testColor[i]), blue(testColor[i])); 663 | getc(stdin); 664 | printf("\n"); 665 | } 666 | 667 | /*---------------------------------------------------------*\ 668 | | Test custom | 669 | \*---------------------------------------------------------*/ 670 | printf("Press enter to test custom effects..."); 671 | getc(stdin); 672 | printf("\n"); 673 | 674 | for(int i = 0;i < 10;i++) 675 | { 676 | for (unsigned int offset = 0; offset < _countof(testColor); offset++) 677 | { 678 | 679 | } 680 | } 681 | 682 | /*---------------------------------------------------------*\ 683 | | Test is complete, time to exit | 684 | \*---------------------------------------------------------*/ 685 | printf("Press enter to exit..."); 686 | getc(stdin); 687 | printf("\n"); 688 | 689 | return 0; 690 | } 691 | -------------------------------------------------------------------------------- /winprojectexamplenodll/ChromaExampleNoDLL.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {72A1DC9D-32A9-423C-9638-EE544FE573BB} 23 | Win32Proj 24 | 10.0 25 | OpenRazerExampleNoDLL 26 | 27 | 28 | 29 | Application 30 | true 31 | v142 32 | 33 | 34 | Application 35 | false 36 | v142 37 | 38 | 39 | Application 40 | true 41 | v142 42 | 43 | 44 | Application 45 | false 46 | v142 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | true 68 | $(Platform)\$(Configuration)\ 69 | 70 | 71 | true 72 | $(Platform)\$(Configuration)\ 73 | 74 | 75 | 76 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 77 | MultiThreadedDebugDLL 78 | Level3 79 | ProgramDatabase 80 | Disabled 81 | $(ProjectDir);..\;..\openrazer\driver;$(ProjectDir)\..\dependencies\hidapi;%(AdditionalIncludeDirectories) 82 | true 83 | 84 | 85 | MachineX86 86 | true 87 | Console 88 | %(AdditionalDependencies) 89 | $(ProjectDir)..\;..\dependencies\hidapi-win\x86;%(AdditionalLibraryDirectories) 90 | 91 | 92 | 93 | 94 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 95 | MultiThreadedDLL 96 | Level3 97 | ProgramDatabase 98 | $(ProjectDir);..\;..\openrazer\driver;$(ProjectDir)\..\dependencies\hidapi;%(AdditionalIncludeDirectories) 99 | true 100 | 101 | 102 | MachineX86 103 | true 104 | Console 105 | true 106 | true 107 | %(AdditionalDependencies) 108 | $(ProjectDir)..\;..\dependencies\hidapi-win\x86;%(AdditionalLibraryDirectories) 109 | 110 | 111 | 112 | 113 | $(ProjectDir);..\;..\openrazer\driver;$(ProjectDir)\..\dependencies\hidapi;%(AdditionalIncludeDirectories) 114 | true 115 | 116 | 117 | %(AdditionalDependencies) 118 | $(ProjectDir)..\;..\dependencies\hidapi-win\x64;%(AdditionalLibraryDirectories) 119 | 120 | 121 | 122 | 123 | $(ProjectDir);..\;..\openrazer\driver;$(ProjectDir)\..\dependencies\hidapi;%(AdditionalIncludeDirectories) 124 | true 125 | 126 | 127 | %(AdditionalDependencies) 128 | $(ProjectDir)..\;..\dependencies\hidapi-win\x64;%(AdditionalLibraryDirectories) 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | -------------------------------------------------------------------------------- /winprojectexamplenodll/defines.h: -------------------------------------------------------------------------------- 1 | #undef DLL_INTERNAL 2 | #define DLL_INTERNAL extern 3 | --------------------------------------------------------------------------------