Add files via upload
This commit is contained in:
parent
48bce6a176
commit
a58baae6d3
12 changed files with 1320 additions and 0 deletions
71
example.ini
Normal file
71
example.ini
Normal file
|
@ -0,0 +1,71 @@
|
|||
#example configuration for the M908 mouse
|
||||
#5 different profiles (1-5) are stored on the mouse
|
||||
#if a particular option is not specified a default value will be used
|
||||
#all numbers are specified in hexadecimal without a prefix
|
||||
|
||||
[profile1]
|
||||
#led mode:
|
||||
#breathing, rainbow, static, wave, alternating, reactive, flashing, off
|
||||
lightmode=static
|
||||
#led color
|
||||
color=50ff00
|
||||
#led brightness level (1-3)
|
||||
brightness=2
|
||||
#led animation speed (1-8)
|
||||
speed=1
|
||||
|
||||
#scrollspeed (1-3f)
|
||||
scrollspeed=1
|
||||
|
||||
#each profile has 5 dpi levels (1-5) that can be individually set and enabled/disabled
|
||||
#set dpiX_enable=0 to disable a particular dpi level
|
||||
#WARNING: NEVER DISABLE ALL DPI LEVELS! this could result in problems
|
||||
dpi1_enable=0
|
||||
dpi2_enable=1
|
||||
dpi3_enable=1
|
||||
dpi4_enable=1
|
||||
dpi5_enable=0
|
||||
#dpi (4-8c)
|
||||
dpi1=04
|
||||
dpi2=16
|
||||
dpi3=2d
|
||||
dpi4=43
|
||||
dpi5=8c
|
||||
|
||||
#button mapping: there is a total of 20 programmable buttons
|
||||
button_left=left
|
||||
button_right=right
|
||||
button_middle=middle
|
||||
button_fire=left
|
||||
button_dpi_up=dpi+
|
||||
button_dpi_down=dpi-
|
||||
scroll_up=scroll_up
|
||||
scroll_down=scroll_down
|
||||
button_1=backward
|
||||
button_2=forward
|
||||
button_3=none
|
||||
button_4=dpi-cycle
|
||||
button_5=report_rate+
|
||||
button_6=report_rate-
|
||||
button_7=profile_switch
|
||||
button_8=none
|
||||
button_9=none
|
||||
button_10=none
|
||||
button_11=none
|
||||
button_12=none
|
||||
|
||||
[profile2]
|
||||
lightmode=breathing
|
||||
color=5000ff
|
||||
brightness=3
|
||||
scrollspeed=1
|
||||
dpi1=20
|
||||
dpi2=20
|
||||
button_1=backward
|
||||
button_2=forward
|
||||
|
||||
[profile3]
|
||||
|
||||
[profile4]
|
||||
|
||||
[profile5]
|
71
include/constructor.cpp
Normal file
71
include/constructor.cpp
Normal file
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
//constructor
|
||||
mouse_m908::mouse_m908(){
|
||||
|
||||
_mouse_vid = 0x04d9;
|
||||
_mouse_pid = 0xfc4d;
|
||||
|
||||
//min and max settings
|
||||
_scrollspeed_min = 0x01;
|
||||
_scrollspeed_max = 0x3f;
|
||||
_brightness_min = 0x01;
|
||||
_brightness_max = 0x03;
|
||||
_speed_min = 0x01;
|
||||
_speed_max = 0x08;
|
||||
_level_min = 0;
|
||||
_level_max = 4;
|
||||
_dpi_min = 0x04;
|
||||
_dpi_max = 0x8c;
|
||||
|
||||
//default settings
|
||||
_profile = profile_1;
|
||||
_scrollspeeds.fill( 0x01 );
|
||||
_lightmodes.fill( lightmode_static );
|
||||
_colors.fill( {0xff, 0xff, 0xff} );
|
||||
_brightness_levels.fill( 0x03 );
|
||||
_speed_levels.fill( 0x08 );
|
||||
_dpi_enabled.fill( {true, true, true, true, true} );
|
||||
_dpi_levels.fill( {0x04, 0x16, 0x2d, 0x43, 0x8c} );
|
||||
for( int i = 0; i < 5; i++ ){
|
||||
for( int j = 0; j < 20; j++ ){
|
||||
_keymap_data[i][j][0] = _data_settings_3[35+(20*i)+j][8];
|
||||
_keymap_data[i][j][1] = _data_settings_3[35+(20*i)+j][9];
|
||||
_keymap_data[i][j][2] = _data_settings_3[35+(20*i)+j][10];
|
||||
}
|
||||
}
|
||||
|
||||
//name → keycode
|
||||
_keycodes = {
|
||||
{ "forward", { 0x85, 0x00, 0x00 } },
|
||||
{ "backward", { 0x84, 0x00, 0x00 } },
|
||||
{ "dpi+", { 0x8a, 0x00, 0x00 } },
|
||||
{ "dpi-", { 0x89, 0x00, 0x00 } },
|
||||
{ "dpi-cycle", { 0x88, 0x00, 0x00 } },
|
||||
{ "report_rate+", { 0x97, 0x00, 0x00 } },
|
||||
{ "report_rate-", { 0x98, 0x00, 0x00 } },
|
||||
{ "scroll_up", { 0x8b, 0x00, 0x00 } },
|
||||
{ "scroll_down", { 0x8c, 0x00, 0x00 } },
|
||||
{ "left", { 0x81, 0x00, 0x00 } },
|
||||
{ "right", { 0x82, 0x00, 0x00 } },
|
||||
{ "middle", { 0x83, 0x00, 0x00 } },
|
||||
{ "profile_switch", { 0x8d, 0x00, 0x00 } },
|
||||
{ "none", { 0x00, 0x00, 0x00 } } };
|
||||
|
||||
}
|
196
include/data.cpp
Normal file
196
include/data.cpp
Normal file
|
@ -0,0 +1,196 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
//usb data packets
|
||||
|
||||
uint8_t mouse_m908::_data_profile[][16] = {
|
||||
{0x02, 0xf3, 0x2c, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf1, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf1, 0x02, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf1, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf1, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf1, 0x02, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
|
||||
};
|
||||
|
||||
uint8_t mouse_m908::_data_settings_1[][16] = {
|
||||
{0x02, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x3e, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x46, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x49, 0x04, 0x06, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x4f, 0x04, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x51, 0x04, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x02, 0x08, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x57, 0x04, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x59, 0x04, 0x06, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x5f, 0x04, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x61, 0x04, 0x06, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x02, 0x08, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x67, 0x04, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x69, 0x04, 0x06, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x6f, 0x04, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x32, 0x00, 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x38, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00}
|
||||
};
|
||||
|
||||
uint8_t mouse_m908::_data_settings_2[64] = {
|
||||
0x03, 0xf3, 0x20, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
uint8_t mouse_m908::_data_settings_3[][16] = {
|
||||
{0x02, 0xf3, 0x42, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xb2, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x62, 0x02, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x12, 0x03, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf1, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf1, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x44, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x04, 0x01, 0x04, 0x00, 0x00, 0x00, 0x01, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xb4, 0x01, 0x04, 0x00, 0x00, 0x00, 0x01, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x64, 0x02, 0x04, 0x00, 0x00, 0x00, 0x01, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x14, 0x03, 0x04, 0x00, 0x00, 0x00, 0x01, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x4a, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x0a, 0x01, 0x04, 0x00, 0x00, 0x00, 0x01, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xba, 0x01, 0x04, 0x00, 0x00, 0x00, 0x01, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x6a, 0x02, 0x04, 0x00, 0x00, 0x00, 0x01, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x1a, 0x03, 0x04, 0x00, 0x00, 0x00, 0x01, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x50, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x10, 0x01, 0x04, 0x00, 0x00, 0x00, 0x01, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xc0, 0x01, 0x04, 0x00, 0x00, 0x00, 0x01, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x70, 0x02, 0x04, 0x00, 0x00, 0x00, 0x01, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x20, 0x03, 0x04, 0x00, 0x00, 0x00, 0x01, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x56, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x16, 0x01, 0x04, 0x00, 0x00, 0x00, 0x01, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xc6, 0x01, 0x04, 0x00, 0x00, 0x00, 0x01, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x76, 0x02, 0x04, 0x00, 0x00, 0x00, 0x01, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x26, 0x03, 0x04, 0x00, 0x00, 0x00, 0x01, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x5c, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x1c, 0x01, 0x04, 0x00, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xcc, 0x01, 0x04, 0x00, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x7c, 0x02, 0x04, 0x00, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x2c, 0x03, 0x04, 0x00, 0x00, 0x00, 0x01, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf1, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x2c, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf1, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x82, 0x00, 0x04, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x86, 0x00, 0x04, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x8a, 0x00, 0x04, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x8e, 0x00, 0x04, 0x00, 0x00, 0x00, 0x99, 0x81, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x92, 0x00, 0x04, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x96, 0x00, 0x04, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x9a, 0x00, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x9e, 0x00, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xa2, 0x00, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xa6, 0x00, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xaa, 0x00, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xae, 0x00, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xb2, 0x00, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xb6, 0x00, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xba, 0x00, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xbe, 0x00, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xc2, 0x00, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xc6, 0x00, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xda, 0x00, 0x04, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xde, 0x00, 0x04, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x42, 0x01, 0x04, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x46, 0x01, 0x04, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x4a, 0x01, 0x04, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x4e, 0x01, 0x04, 0x00, 0x00, 0x00, 0x99, 0x81, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x52, 0x01, 0x04, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x56, 0x01, 0x04, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x5a, 0x01, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x5e, 0x01, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x62, 0x01, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x66, 0x01, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x6a, 0x01, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x6e, 0x01, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x72, 0x01, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x76, 0x01, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x7a, 0x01, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x7e, 0x01, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x82, 0x01, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x86, 0x01, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x9a, 0x01, 0x04, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x9e, 0x01, 0x04, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xf2, 0x01, 0x04, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xf6, 0x01, 0x04, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xfa, 0x01, 0x04, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xfe, 0x01, 0x04, 0x00, 0x00, 0x00, 0x99, 0x81, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x02, 0x02, 0x04, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x06, 0x02, 0x04, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x0a, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x0e, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x12, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x16, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x1a, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x1e, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x22, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x26, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x2a, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x2e, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x32, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x36, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x4a, 0x02, 0x04, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x4e, 0x02, 0x04, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xa2, 0x02, 0x04, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xa6, 0x02, 0x04, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xaa, 0x02, 0x04, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xae, 0x02, 0x04, 0x00, 0x00, 0x00, 0x99, 0x81, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xb2, 0x02, 0x04, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xb6, 0x02, 0x04, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xba, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xbe, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xc2, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xc6, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xca, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xce, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xd2, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xd6, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xda, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xde, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xe2, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xe6, 0x02, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xfa, 0x02, 0x04, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xfe, 0x02, 0x04, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x52, 0x03, 0x04, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x56, 0x03, 0x04, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x5a, 0x03, 0x04, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x5e, 0x03, 0x04, 0x00, 0x00, 0x00, 0x99, 0x81, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x62, 0x03, 0x04, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x66, 0x03, 0x04, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x6a, 0x03, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x6e, 0x03, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x72, 0x03, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x76, 0x03, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x7a, 0x03, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x7e, 0x03, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x82, 0x03, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x86, 0x03, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x8a, 0x03, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x8e, 0x03, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x92, 0x03, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0x96, 0x03, 0x04, 0x00, 0x00, 0x00, 0x90, 0x00, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xaa, 0x03, 0x04, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf3, 0xae, 0x03, 0x04, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf1, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf1, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf1, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf1, 0x02, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x02, 0xf5, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
|
||||
};
|
49
include/getters.cpp
Normal file
49
include/getters.cpp
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
mouse_m908::m908_profile mouse_m908::get_profile(){
|
||||
return _profile;
|
||||
}
|
||||
|
||||
uint8_t mouse_m908::get_scrollspeed( m908_profile profile ){
|
||||
return _scrollspeeds[profile];
|
||||
}
|
||||
|
||||
mouse_m908::m908_lightmode mouse_m908::get_lightmode( m908_profile profile ){
|
||||
return _lightmodes[profile];
|
||||
}
|
||||
|
||||
void mouse_m908::get_color( m908_profile profile, std::array<uint8_t, 3> &color ){
|
||||
color = _colors[profile];
|
||||
}
|
||||
|
||||
uint8_t mouse_m908::get_brightness( m908_profile profile ){
|
||||
return _brightness_levels[profile];
|
||||
}
|
||||
|
||||
uint8_t mouse_m908::get_speed( m908_profile profile ){
|
||||
return _speed_levels[profile];
|
||||
}
|
||||
|
||||
bool mouse_m908::get_dpi_enable( m908_profile profile, int level ){
|
||||
return _dpi_enabled[profile][level];
|
||||
}
|
||||
|
||||
uint8_t mouse_m908::get_dpi( m908_profile profile, int level ){
|
||||
return _dpi_levels[profile][level];
|
||||
}
|
119
include/helpers.cpp
Normal file
119
include/helpers.cpp
Normal file
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
//helper functions
|
||||
|
||||
//init libusb and open mouse
|
||||
int mouse_m908::open_mouse(){
|
||||
|
||||
//vars
|
||||
int res = 0;
|
||||
|
||||
//libusb init
|
||||
res = libusb_init( NULL );
|
||||
if( res < 0 ){
|
||||
return res;
|
||||
}
|
||||
|
||||
//open device
|
||||
_handle = libusb_open_device_with_vid_pid( NULL, _mouse_vid,
|
||||
_mouse_pid );
|
||||
if( !_handle ){
|
||||
return 1;
|
||||
}
|
||||
|
||||
//detach kernel driver on interface 0 if active
|
||||
if( libusb_kernel_driver_active( _handle, 0 ) ){
|
||||
res += libusb_detach_kernel_driver( _handle, 0 );
|
||||
if( res == 0 ){
|
||||
_detached_driver_0 = true;
|
||||
} else{
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
//detach kernel driver on interface 1 if active
|
||||
if( libusb_kernel_driver_active( _handle, 1 ) ){
|
||||
res += libusb_detach_kernel_driver( _handle, 1 );
|
||||
if( res == 0 ){
|
||||
_detached_driver_1 = true;
|
||||
} else{
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
//detach kernel driver on interface 2 if active
|
||||
if( libusb_kernel_driver_active( _handle, 2 ) ){
|
||||
res += libusb_detach_kernel_driver( _handle, 2 );
|
||||
if( res == 0 ){
|
||||
_detached_driver_2 = true;
|
||||
} else{
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
//claim interface 0
|
||||
res += libusb_claim_interface( _handle, 0 );
|
||||
if( res != 0 ){
|
||||
return res;
|
||||
}
|
||||
|
||||
//claim interface 1
|
||||
res += libusb_claim_interface( _handle, 1 );
|
||||
if( res != 0 ){
|
||||
return res;
|
||||
}
|
||||
|
||||
//claim interface 2
|
||||
res += libusb_claim_interface( _handle, 2 );
|
||||
if( res != 0 ){
|
||||
return res;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
//close mouse
|
||||
int mouse_m908::close_mouse(){
|
||||
|
||||
//release interfaces 0, 1 and 2
|
||||
libusb_release_interface( _handle, 0 );
|
||||
libusb_release_interface( _handle, 1 );
|
||||
libusb_release_interface( _handle, 2 );
|
||||
|
||||
//attach kernel driver for interface 0
|
||||
if( _detached_driver_0 ){
|
||||
libusb_attach_kernel_driver( _handle, 0 );
|
||||
}
|
||||
|
||||
//attach kernel driver for interface 1
|
||||
if( _detached_driver_1 ){
|
||||
libusb_attach_kernel_driver( _handle, 1 );
|
||||
}
|
||||
|
||||
|
||||
//attach kernel driver for interface 2
|
||||
if( _detached_driver_2 ){
|
||||
libusb_attach_kernel_driver( _handle, 2);
|
||||
}
|
||||
|
||||
//exit libusb
|
||||
libusb_exit( NULL );
|
||||
|
||||
return 0;
|
||||
}
|
132
include/mouse_m908.h
Normal file
132
include/mouse_m908.h
Normal file
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
//main class
|
||||
#ifndef MOUSE_M908
|
||||
#define MOUSE_M908
|
||||
|
||||
#include <libusb-1.0/libusb.h>
|
||||
#include <map>
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <exception>
|
||||
|
||||
class mouse_m908{
|
||||
|
||||
public:
|
||||
|
||||
//constructor
|
||||
mouse_m908();
|
||||
|
||||
//enums
|
||||
enum m908_profile{
|
||||
profile_1 = 0,
|
||||
profile_2 = 1,
|
||||
profile_3 = 2,
|
||||
profile_4 = 3,
|
||||
profile_5 = 4,
|
||||
};
|
||||
enum m908_lightmode{
|
||||
lightmode_breathing,
|
||||
lightmode_rainbow,
|
||||
lightmode_static,
|
||||
lightmode_wave,
|
||||
lightmode_alternating,
|
||||
lightmode_reactive,
|
||||
lightmode_flashing,
|
||||
lightmode_off,
|
||||
};
|
||||
|
||||
|
||||
//setter functions
|
||||
int set_profile( m908_profile profile );
|
||||
int set_scrollspeed( m908_profile profile, uint8_t speed );
|
||||
int set_lightmode( m908_profile profile, m908_lightmode lightmode );
|
||||
int set_color( m908_profile profile, std::array<uint8_t, 3> color );
|
||||
int set_brightness( m908_profile profile, uint8_t brightness );
|
||||
int set_speed( m908_profile profile, uint8_t speed );
|
||||
int set_dpi_enable( m908_profile profile, int level, bool enabled );
|
||||
int set_dpi( m908_profile profile, int level, uint8_t dpi );
|
||||
int set_key_mapping( m908_profile profile, int key, std::array<uint8_t, 3> mapping );
|
||||
int set_key_mapping( m908_profile profile, int key, std::string mapping );
|
||||
|
||||
//getter functions
|
||||
m908_profile get_profile();
|
||||
uint8_t get_scrollspeed( m908_profile profile );
|
||||
m908_lightmode get_lightmode( m908_profile profile );
|
||||
void get_color( m908_profile profile, std::array<uint8_t, 3> &color );
|
||||
uint8_t get_brightness( m908_profile profile );
|
||||
uint8_t get_speed( m908_profile profile );
|
||||
bool get_dpi_enable( m908_profile profile, int level );
|
||||
uint8_t get_dpi( m908_profile profile, int level );
|
||||
|
||||
//writer functions (apply settings to mouse)
|
||||
int write_profile();
|
||||
int write_settings();
|
||||
|
||||
//helper functions
|
||||
int open_mouse();
|
||||
int close_mouse();
|
||||
|
||||
private:
|
||||
|
||||
//usb device vars
|
||||
uint16_t _mouse_vid;
|
||||
uint16_t _mouse_pid;
|
||||
libusb_device_handle* _handle;
|
||||
bool _detached_driver_0 = false;
|
||||
bool _detached_driver_1 = false;
|
||||
bool _detached_driver_2 = false;
|
||||
|
||||
//setting vars
|
||||
m908_profile _profile;
|
||||
std::array<uint8_t, 5> _scrollspeeds;
|
||||
std::array<m908_lightmode, 5> _lightmodes;
|
||||
std::array<std::array<uint8_t, 3>, 5> _colors;
|
||||
std::array<uint8_t, 5> _brightness_levels;
|
||||
std::array<uint8_t, 5> _speed_levels;
|
||||
std::array<std::array<bool, 5>, 5> _dpi_enabled;
|
||||
std::array<std::array<uint8_t, 5>, 5> _dpi_levels;
|
||||
std::array<std::array<std::array<uint8_t, 3>, 20>, 5> _keymap_data;
|
||||
|
||||
//setting min and max values
|
||||
uint8_t _scrollspeed_min, _scrollspeed_max;
|
||||
uint8_t _brightness_min, _brightness_max;
|
||||
uint8_t _speed_min, _speed_max;
|
||||
uint8_t _level_min, _level_max;
|
||||
uint8_t _dpi_min, _dpi_max;
|
||||
|
||||
//mapping of button names to values
|
||||
std::map< std::string, std::array<uint8_t, 3> > _keycodes;
|
||||
|
||||
//usb data packets
|
||||
static uint8_t _data_profile[][16];
|
||||
static uint8_t _data_settings_1[][16];
|
||||
static uint8_t _data_settings_2[64];
|
||||
static uint8_t _data_settings_3[][16];
|
||||
};
|
||||
|
||||
#include "data.cpp"
|
||||
#include "constructor.cpp"
|
||||
#include "helpers.cpp"
|
||||
#include "getters.cpp"
|
||||
#include "setters.cpp"
|
||||
#include "writers.cpp"
|
||||
|
||||
#endif
|
27
include/print_help.cpp
Normal file
27
include/print_help.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
//prints a help message
|
||||
void print_help(){
|
||||
std::cout << "Options:\n";
|
||||
std::cout << "-h --help\n\tDisplays this message.\n";
|
||||
std::cout << "-c --config\n\tLoads and applies settings from specified file.\n";
|
||||
std::cout << "-p --profile\n\tSets currently active profile (1-5).\n";
|
||||
}
|
109
include/setters.cpp
Normal file
109
include/setters.cpp
Normal file
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
//setter functions
|
||||
|
||||
int mouse_m908::set_profile( m908_profile profile ){
|
||||
_profile = profile;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mouse_m908::set_scrollspeed( m908_profile profile, uint8_t speed ){
|
||||
|
||||
//check if bounds exceeded
|
||||
if( speed < _scrollspeed_min || speed > _scrollspeed_max ){
|
||||
return 1;
|
||||
}
|
||||
|
||||
_scrollspeeds[profile] = speed;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mouse_m908::set_lightmode( m908_profile profile, m908_lightmode lightmode ){
|
||||
_lightmodes[profile] = lightmode;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mouse_m908::set_color( m908_profile profile, std::array<uint8_t, 3> color ){
|
||||
_colors[profile] = color;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mouse_m908::set_brightness( m908_profile profile, uint8_t brightness ){
|
||||
|
||||
//check bounds
|
||||
if( brightness < _brightness_min || brightness > _brightness_max ){
|
||||
return 1;
|
||||
}
|
||||
|
||||
_brightness_levels[profile] = brightness;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mouse_m908::set_speed( m908_profile profile, uint8_t speed ){
|
||||
|
||||
//check bounds
|
||||
if( speed < _speed_min || speed > _speed_max ){
|
||||
return 1;
|
||||
}
|
||||
|
||||
_speed_levels[profile] = speed;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mouse_m908::set_dpi_enable( m908_profile profile, int level, bool enabled ){
|
||||
|
||||
//check bounds
|
||||
if( level < _level_min || level > _level_max ){
|
||||
return 1;
|
||||
}
|
||||
|
||||
_dpi_enabled[profile][level] = enabled;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mouse_m908::set_dpi( m908_profile profile, int level, uint8_t dpi ){
|
||||
|
||||
//check bounds
|
||||
if( dpi < _dpi_min || dpi > _dpi_max ){
|
||||
return 1;
|
||||
}
|
||||
|
||||
_dpi_levels[profile][level] = dpi;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mouse_m908::set_key_mapping( m908_profile profile, int key, std::array<uint8_t, 3> mapping ){
|
||||
_keymap_data[profile][key][0] = mapping[0];
|
||||
_keymap_data[profile][key][1] = mapping[1];
|
||||
_keymap_data[profile][key][2] = mapping[2];
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mouse_m908::set_key_mapping( m908_profile profile, int key, std::string mapping ){
|
||||
|
||||
try{
|
||||
_keymap_data[profile][key][0] = _keycodes[mapping][0];
|
||||
_keymap_data[profile][key][1] = _keycodes[mapping][1];
|
||||
_keymap_data[profile][key][2] = _keycodes[mapping][2];
|
||||
} catch( std::exception& e ){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
147
include/writers.cpp
Normal file
147
include/writers.cpp
Normal file
|
@ -0,0 +1,147 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
//writer functions (apply changes to mouse)
|
||||
|
||||
int mouse_m908::write_profile(){
|
||||
|
||||
//prepare data
|
||||
uint8_t buffer[6][16];
|
||||
for( int i = 0; i < 6; i++ ){
|
||||
std::copy(std::begin(_data_profile[i]), std::end(_data_profile[i]), std::begin(buffer[i]));
|
||||
}
|
||||
|
||||
//modify buffer from default to include specified profile
|
||||
buffer[0][8] = _profile;
|
||||
|
||||
//send data
|
||||
for( int i = 0; i < 6; i++ ){
|
||||
libusb_control_transfer( _handle, 0x21, 0x09, 0x0302, 0x0002, buffer[i], 16, 1000 );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mouse_m908::write_settings(){
|
||||
|
||||
//prepare data 1
|
||||
int rows1 = sizeof(_data_settings_1) / sizeof(_data_settings_1[0]);
|
||||
uint8_t buffer1[rows1][16];
|
||||
for( int i = 0; i < rows1; i++ ){
|
||||
std::copy(std::begin(_data_settings_1[i]), std::end(_data_settings_1[i]), std::begin(buffer1[i]));
|
||||
}
|
||||
|
||||
//prepare data 2
|
||||
uint8_t buffer2[64];
|
||||
std::copy(std::begin(_data_settings_2), std::end(_data_settings_2), std::begin(buffer2));
|
||||
|
||||
//prepare data 3
|
||||
int rows3 = sizeof(_data_settings_3) / sizeof(_data_settings_3[0]);
|
||||
uint8_t buffer3[rows3][16];
|
||||
for( int i = 0; i < rows3; i++ ){
|
||||
std::copy(std::begin(_data_settings_3[i]), std::end(_data_settings_3[i]), std::begin(buffer3[i]));
|
||||
}
|
||||
|
||||
//modify buffers to include settings
|
||||
//scrollspeed
|
||||
for( int i = 0; i < 5; i++ ){
|
||||
buffer2[8+(2*i)] = _scrollspeeds[i];
|
||||
}
|
||||
//lightmode
|
||||
for( int i = 0; i < 5; i++ ){
|
||||
switch( _lightmodes[i] ){
|
||||
case lightmode_breathing:
|
||||
buffer1[3+(2*i)][11] = 0x01;
|
||||
buffer1[3+(2*i)][13] = 0x04;
|
||||
break;
|
||||
case lightmode_rainbow:
|
||||
buffer1[3+(2*i)][11] = 0x01;
|
||||
buffer1[3+(2*i)][13] = 0x08;
|
||||
break;
|
||||
case lightmode_static:
|
||||
default:
|
||||
buffer1[3+(2*i)][11] = 0x01;
|
||||
buffer1[3+(2*i)][13] = 0x02;
|
||||
break;
|
||||
case lightmode_wave:
|
||||
buffer1[3+(2*i)][11] = 0x02;
|
||||
buffer1[3+(2*i)][13] = 0x00;
|
||||
break;
|
||||
case lightmode_alternating:
|
||||
buffer1[3+(2*i)][11] = 0x06;
|
||||
buffer1[3+(2*i)][13] = 0x00;
|
||||
break;
|
||||
case lightmode_reactive:
|
||||
buffer1[3+(2*i)][11] = 0x07;
|
||||
buffer1[3+(2*i)][13] = 0x00;
|
||||
break;
|
||||
case lightmode_flashing:
|
||||
buffer1[3+(2*i)][11] = 0x01;
|
||||
buffer1[3+(2*i)][13] = 0x10;
|
||||
break;
|
||||
case lightmode_off:
|
||||
buffer1[3+(2*i)][11] = 0x00;
|
||||
buffer1[3+(2*i)][13] = 0x00;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//color
|
||||
for( int i = 0; i < 5; i++ ){
|
||||
buffer1[3+(2*i)][8] = _colors[i].at(0);
|
||||
buffer1[3+(2*i)][9] = _colors[i].at(1);
|
||||
buffer1[3+(2*i)][10] = _colors[i].at(2);
|
||||
}
|
||||
//brightness
|
||||
for( int i = 0; i < 5; i++ ){
|
||||
buffer1[4+(2*i)][8] = _brightness_levels[i];
|
||||
}
|
||||
//speed
|
||||
for( int i = 0; i < 5; i++ ){
|
||||
buffer1[3+(2*i)][12] = _speed_levels[i];
|
||||
}
|
||||
//dpi
|
||||
for( int i = 0; i < 5; i++ ){
|
||||
for( int j = 0; j < 5; j++ ){
|
||||
buffer3[7+(5*i)+j][8] = _dpi_enabled[j][i];
|
||||
buffer3[7+(5*i)+j][9] = _dpi_levels[j][i];
|
||||
}
|
||||
}
|
||||
//key mapping
|
||||
for( int i = 0; i < 5; i++ ){
|
||||
for( int j = 0; j < 20; j++ ){
|
||||
buffer3[35+(20*i)+j][8] = _keymap_data[i][j][0];
|
||||
buffer3[35+(20*i)+j][9] = _keymap_data[i][j][1];
|
||||
buffer3[35+(20*i)+j][10] = _keymap_data[i][j][2];
|
||||
}
|
||||
}
|
||||
|
||||
//send data 1
|
||||
for( int i = 0; i < rows1; i++ ){
|
||||
libusb_control_transfer( _handle, 0x21, 0x09, 0x0302, 0x0002, buffer1[i], 16, 1000 );
|
||||
}
|
||||
|
||||
//send data 2
|
||||
libusb_control_transfer( _handle, 0x21, 0x09, 0x0302, 0x0002, buffer2, 64, 1000 );
|
||||
|
||||
//send data 3
|
||||
for( int i = 0; i < rows3; i++ ){
|
||||
libusb_control_transfer( _handle, 0x21, 0x09, 0x0302, 0x0002, buffer3[i], 16, 1000 );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
7
makefile
Normal file
7
makefile
Normal file
|
@ -0,0 +1,7 @@
|
|||
BIN_DIR = /usr/bin
|
||||
|
||||
install:
|
||||
g++ mouse_m908.cpp -o mouse_m908 -lusb-1.0 && \
|
||||
cp ./rgb_keyboard $(BIN_DIR)/mouse_m908 && \
|
||||
cp ./mouse_m908.rules /etc/udev/rules.d
|
||||
|
390
mouse_m908.cpp
Normal file
390
mouse_m908.cpp
Normal file
|
@ -0,0 +1,390 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
* g++ mouse_m908.cpp -o mouse_m908 -lusb-1.0
|
||||
*
|
||||
*/
|
||||
|
||||
#include <map>
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/ini_parser.hpp>
|
||||
#include <getopt.h>
|
||||
|
||||
#include "include/mouse_m908.h"
|
||||
#include "include/print_help.cpp"
|
||||
|
||||
int main( int argc, char **argv ){
|
||||
|
||||
mouse_m908 m;
|
||||
|
||||
//command line options
|
||||
static struct option long_options[] = {
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"config", required_argument, 0, 'c'},
|
||||
{"profile", required_argument, 0, 'p'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
bool flag_config = false, flag_profile = false;
|
||||
std::string string_config, string_profile;
|
||||
|
||||
//parse command line options
|
||||
int c, option_index = 0;
|
||||
while( (c = getopt_long( argc, argv, "hc:p:",
|
||||
long_options, &option_index ) ) != -1 ){
|
||||
|
||||
switch( c ){
|
||||
case 'h':
|
||||
print_help();
|
||||
return 0;
|
||||
break;
|
||||
case 'c':
|
||||
flag_config = true;
|
||||
string_config = optarg;
|
||||
break;
|
||||
case 'p':
|
||||
flag_profile = true;
|
||||
string_profile = optarg;
|
||||
break;
|
||||
case '?':
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//load and write config
|
||||
if( flag_config ){
|
||||
try{
|
||||
boost::property_tree::ptree pt;
|
||||
boost::property_tree::ini_parser::read_ini(string_config, pt);
|
||||
|
||||
//parse config file
|
||||
//profile 1
|
||||
if( pt.get("profile1.lightmode", "") == "breathing" ){ m.set_lightmode( mouse_m908::profile_1, mouse_m908::lightmode_breathing ); }
|
||||
if( pt.get("profile1.lightmode", "") == "rainbow" ){ m.set_lightmode( mouse_m908::profile_1, mouse_m908::lightmode_rainbow ); }
|
||||
if( pt.get("profile1.lightmode", "") == "static" ){ m.set_lightmode( mouse_m908::profile_1, mouse_m908::lightmode_static ); }
|
||||
if( pt.get("profile1.lightmode", "") == "wave" ){ m.set_lightmode( mouse_m908::profile_1, mouse_m908::lightmode_wave ); }
|
||||
if( pt.get("profile1.lightmode", "") == "alternating" ){ m.set_lightmode( mouse_m908::profile_1, mouse_m908::lightmode_alternating ); }
|
||||
if( pt.get("profile1.lightmode", "") == "reactive" ){ m.set_lightmode( mouse_m908::profile_1, mouse_m908::lightmode_reactive ); }
|
||||
if( pt.get("profile1.lightmode", "") == "flashing" ){ m.set_lightmode( mouse_m908::profile_1, mouse_m908::lightmode_flashing ); }
|
||||
if( pt.get("profile1.lightmode", "") == "off" ){ m.set_lightmode( mouse_m908::profile_1, mouse_m908::lightmode_off ); }
|
||||
if( pt.get("profile1.color", "").length() == 6 ){
|
||||
m.set_color( mouse_m908::profile_1,
|
||||
{(uint8_t)stoi( pt.get("profile1.color", "").substr(0,2), 0, 16),
|
||||
(uint8_t)stoi( pt.get("profile1.color", "").substr(2,2), 0, 16),
|
||||
(uint8_t)stoi( pt.get("profile1.color", "").substr(4,2), 0, 16)} );
|
||||
}
|
||||
if( pt.get("profile1.brightness", "").length() != 0 ){
|
||||
m.set_brightness( mouse_m908::profile_1, (uint8_t)stoi( pt.get("profile1.brightness", ""), 0, 16) );
|
||||
}
|
||||
if( pt.get("profile1.speed", "").length() != 0 ){
|
||||
m.set_speed( mouse_m908::profile_1, (uint8_t)stoi( pt.get("profile1.speed", ""), 0, 16) );
|
||||
}
|
||||
if( pt.get("profile1.scrollspeed", "").length() != 0 ){
|
||||
m.set_scrollspeed( mouse_m908::profile_1, (uint8_t)stoi( pt.get("profile1.scrollspeed", ""), 0, 16) );
|
||||
}
|
||||
if( pt.get("profile1.dpi1_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_1, 0, false ); }
|
||||
if( pt.get("profile1.dpi2_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_1, 1, false ); }
|
||||
if( pt.get("profile1.dpi3_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_1, 2, false ); }
|
||||
if( pt.get("profile1.dpi4_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_1, 3, false ); }
|
||||
if( pt.get("profile1.dpi5_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_1, 4, false ); }
|
||||
if( pt.get("profile1.dpi1", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_1, 0, (uint8_t)stoi( pt.get("profile1.dpi1", ""), 0, 16) ); }
|
||||
if( pt.get("profile1.dpi2", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_1, 1, (uint8_t)stoi( pt.get("profile1.dpi2", ""), 0, 16) ); }
|
||||
if( pt.get("profile1.dpi3", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_1, 2, (uint8_t)stoi( pt.get("profile1.dpi3", ""), 0, 16) ); }
|
||||
if( pt.get("profile1.dpi4", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_1, 3, (uint8_t)stoi( pt.get("profile1.dpi4", ""), 0, 16) ); }
|
||||
if( pt.get("profile1.dpi5", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_1, 4, (uint8_t)stoi( pt.get("profile1.dpi5", ""), 0, 16) ); }
|
||||
if( pt.get("profile1.button_left", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 0, pt.get("profile1.button_left", "") ); }
|
||||
if( pt.get("profile1.button_right", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 1, pt.get("profile1.button_right", "") ); }
|
||||
if( pt.get("profile1.button_middle", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 2, pt.get("profile1.button_middle", "") ); }
|
||||
if( pt.get("profile1.button_fire", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 3, pt.get("profile1.button_fire", "") ); }
|
||||
if( pt.get("profile1.button_dpi_up", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 4, pt.get("profile1.button_dpi_up", "") ); }
|
||||
if( pt.get("profile1.button_dpi_down", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 5, pt.get("profile1.button_dpi_down", "") ); }
|
||||
if( pt.get("profile1.button_1", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 6, pt.get("profile1.button_1", "") ); }
|
||||
if( pt.get("profile1.button_2", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 7, pt.get("profile1.button_2", "") ); }
|
||||
if( pt.get("profile1.button_3", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 8, pt.get("profile1.button_3", "") ); }
|
||||
if( pt.get("profile1.button_4", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 9, pt.get("profile1.button_4", "") ); }
|
||||
if( pt.get("profile1.button_5", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 10, pt.get("profile1.button_5", "") ); }
|
||||
if( pt.get("profile1.button_6", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 11, pt.get("profile1.button_6", "") ); }
|
||||
if( pt.get("profile1.button_7", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 12, pt.get("profile1.button_7", "") ); }
|
||||
if( pt.get("profile1.button_8", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 13, pt.get("profile1.button_8", "") ); }
|
||||
if( pt.get("profile1.button_9", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 14, pt.get("profile1.button_9", "") ); }
|
||||
if( pt.get("profile1.button_10", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 15, pt.get("profile1.button_10", "") ); }
|
||||
if( pt.get("profile1.button_11", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 16, pt.get("profile1.button_11", "") ); }
|
||||
if( pt.get("profile1.button_12", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 17, pt.get("profile1.button_12", "") ); }
|
||||
if( pt.get("profile1.scroll_up", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 18, pt.get("profile1.scroll_up", "") ); }
|
||||
if( pt.get("profile1.scroll_down", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_1, 19, pt.get("profile1.scroll_down", "") ); }
|
||||
//profile 2
|
||||
if( pt.get("profile2.lightmode", "") == "breathing" ){ m.set_lightmode( mouse_m908::profile_2, mouse_m908::lightmode_breathing ); }
|
||||
if( pt.get("profile2.lightmode", "") == "rainbow" ){ m.set_lightmode( mouse_m908::profile_2, mouse_m908::lightmode_rainbow ); }
|
||||
if( pt.get("profile2.lightmode", "") == "static" ){ m.set_lightmode( mouse_m908::profile_2, mouse_m908::lightmode_static ); }
|
||||
if( pt.get("profile2.lightmode", "") == "wave" ){ m.set_lightmode( mouse_m908::profile_2, mouse_m908::lightmode_wave ); }
|
||||
if( pt.get("profile2.lightmode", "") == "alternating" ){ m.set_lightmode( mouse_m908::profile_2, mouse_m908::lightmode_alternating ); }
|
||||
if( pt.get("profile2.lightmode", "") == "reactive" ){ m.set_lightmode( mouse_m908::profile_2, mouse_m908::lightmode_reactive ); }
|
||||
if( pt.get("profile2.lightmode", "") == "flashing" ){ m.set_lightmode( mouse_m908::profile_2, mouse_m908::lightmode_flashing ); }
|
||||
if( pt.get("profile2.lightmode", "") == "off" ){ m.set_lightmode( mouse_m908::profile_2, mouse_m908::lightmode_off ); }
|
||||
if( pt.get("profile2.color", "").length() == 6 ){
|
||||
m.set_color( mouse_m908::profile_2,
|
||||
{(uint8_t)stoi( pt.get("profile2.color", "").substr(0,2), 0, 16),
|
||||
(uint8_t)stoi( pt.get("profile2.color", "").substr(2,2), 0, 16),
|
||||
(uint8_t)stoi( pt.get("profile2.color", "").substr(4,2), 0, 16)} );
|
||||
}
|
||||
if( pt.get("profile2.brightness", "").length() != 0 ){
|
||||
m.set_brightness( mouse_m908::profile_2, (uint8_t)stoi( pt.get("profile2.brightness", ""), 0, 16) );
|
||||
}
|
||||
if( pt.get("profile2.speed", "").length() != 0 ){
|
||||
m.set_speed( mouse_m908::profile_2, (uint8_t)stoi( pt.get("profile2.speed", ""), 0, 16) );
|
||||
}
|
||||
if( pt.get("profile2.scrollspeed", "").length() != 0 ){
|
||||
m.set_scrollspeed( mouse_m908::profile_2, (uint8_t)stoi( pt.get("profile2.scrollspeed", ""), 0, 16) );
|
||||
}
|
||||
if( pt.get("profile2.dpi1_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_2, 0, false ); }
|
||||
if( pt.get("profile2.dpi2_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_2, 1, false ); }
|
||||
if( pt.get("profile2.dpi3_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_2, 2, false ); }
|
||||
if( pt.get("profile2.dpi4_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_2, 3, false ); }
|
||||
if( pt.get("profile2.dpi5_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_2, 4, false ); }
|
||||
if( pt.get("profile2.dpi1", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_2, 0, (uint8_t)stoi( pt.get("profile2.dpi1", ""), 0, 16) ); }
|
||||
if( pt.get("profile2.dpi2", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_2, 1, (uint8_t)stoi( pt.get("profile2.dpi2", ""), 0, 16) ); }
|
||||
if( pt.get("profile2.dpi3", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_2, 2, (uint8_t)stoi( pt.get("profile2.dpi3", ""), 0, 16) ); }
|
||||
if( pt.get("profile2.dpi4", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_2, 3, (uint8_t)stoi( pt.get("profile2.dpi4", ""), 0, 16) ); }
|
||||
if( pt.get("profile2.dpi5", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_2, 4, (uint8_t)stoi( pt.get("profile2.dpi5", ""), 0, 16) ); }
|
||||
if( pt.get("profile2.button_left", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 0, pt.get("profile2.button_left", "") ); }
|
||||
if( pt.get("profile2.button_right", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 1, pt.get("profile2.button_right", "") ); }
|
||||
if( pt.get("profile2.button_middle", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 2, pt.get("profile2.button_middle", "") ); }
|
||||
if( pt.get("profile2.button_fire", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 3, pt.get("profile2.button_fire", "") ); }
|
||||
if( pt.get("profile2.button_dpi_up", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 4, pt.get("profile2.button_dpi_up", "") ); }
|
||||
if( pt.get("profile2.button_dpi_down", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 5, pt.get("profile2.button_dpi_down", "") ); }
|
||||
if( pt.get("profile2.button_1", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 6, pt.get("profile2.button_1", "") ); }
|
||||
if( pt.get("profile2.button_2", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 7, pt.get("profile2.button_2", "") ); }
|
||||
if( pt.get("profile2.button_3", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 8, pt.get("profile2.button_3", "") ); }
|
||||
if( pt.get("profile2.button_4", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 9, pt.get("profile2.button_4", "") ); }
|
||||
if( pt.get("profile2.button_5", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 10, pt.get("profile2.button_5", "") ); }
|
||||
if( pt.get("profile2.button_6", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 11, pt.get("profile2.button_6", "") ); }
|
||||
if( pt.get("profile2.button_7", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 12, pt.get("profile2.button_7", "") ); }
|
||||
if( pt.get("profile2.button_8", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 13, pt.get("profile2.button_8", "") ); }
|
||||
if( pt.get("profile2.button_9", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 14, pt.get("profile2.button_9", "") ); }
|
||||
if( pt.get("profile2.button_10", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 15, pt.get("profile2.button_10", "") ); }
|
||||
if( pt.get("profile2.button_11", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 16, pt.get("profile2.button_11", "") ); }
|
||||
if( pt.get("profile2.button_12", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 17, pt.get("profile2.button_12", "") ); }
|
||||
if( pt.get("profile2.scroll_up", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 18, pt.get("profile2.scroll_up", "") ); }
|
||||
if( pt.get("profile2.scroll_down", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_2, 19, pt.get("profile2.scroll_down", "") ); }
|
||||
//profile 3
|
||||
if( pt.get("profile3.lightmode", "") == "breathing" ){ m.set_lightmode( mouse_m908::profile_3, mouse_m908::lightmode_breathing ); }
|
||||
if( pt.get("profile3.lightmode", "") == "rainbow" ){ m.set_lightmode( mouse_m908::profile_3, mouse_m908::lightmode_rainbow ); }
|
||||
if( pt.get("profile3.lightmode", "") == "static" ){ m.set_lightmode( mouse_m908::profile_3, mouse_m908::lightmode_static ); }
|
||||
if( pt.get("profile3.lightmode", "") == "wave" ){ m.set_lightmode( mouse_m908::profile_3, mouse_m908::lightmode_wave ); }
|
||||
if( pt.get("profile3.lightmode", "") == "alternating" ){ m.set_lightmode( mouse_m908::profile_3, mouse_m908::lightmode_alternating ); }
|
||||
if( pt.get("profile3.lightmode", "") == "reactive" ){ m.set_lightmode( mouse_m908::profile_3, mouse_m908::lightmode_reactive ); }
|
||||
if( pt.get("profile3.lightmode", "") == "flashing" ){ m.set_lightmode( mouse_m908::profile_3, mouse_m908::lightmode_flashing ); }
|
||||
if( pt.get("profile3.lightmode", "") == "off" ){ m.set_lightmode( mouse_m908::profile_3, mouse_m908::lightmode_off ); }
|
||||
if( pt.get("profile3.color", "").length() == 6 ){
|
||||
m.set_color( mouse_m908::profile_3,
|
||||
{(uint8_t)stoi( pt.get("profile3.color", "").substr(0,2), 0, 16),
|
||||
(uint8_t)stoi( pt.get("profile3.color", "").substr(2,2), 0, 16),
|
||||
(uint8_t)stoi( pt.get("profile3.color", "").substr(4,2), 0, 16)} );
|
||||
}
|
||||
if( pt.get("profile3.brightness", "").length() != 0 ){
|
||||
m.set_brightness( mouse_m908::profile_3, (uint8_t)stoi( pt.get("profile3.brightness", ""), 0, 16) );
|
||||
}
|
||||
if( pt.get("profile3.speed", "").length() != 0 ){
|
||||
m.set_speed( mouse_m908::profile_3, (uint8_t)stoi( pt.get("profile3.speed", ""), 0, 16) );
|
||||
}
|
||||
if( pt.get("profile3.scrollspeed", "").length() != 0 ){
|
||||
m.set_scrollspeed( mouse_m908::profile_3, (uint8_t)stoi( pt.get("profile3.scrollspeed", ""), 0, 16) );
|
||||
}
|
||||
if( pt.get("profile3.dpi1_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_3, 0, false ); }
|
||||
if( pt.get("profile3.dpi2_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_3, 1, false ); }
|
||||
if( pt.get("profile3.dpi3_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_3, 2, false ); }
|
||||
if( pt.get("profile3.dpi4_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_3, 3, false ); }
|
||||
if( pt.get("profile3.dpi5_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_3, 4, false ); }
|
||||
if( pt.get("profile3.dpi1", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_3, 0, (uint8_t)stoi( pt.get("profile3.dpi1", ""), 0, 16) ); }
|
||||
if( pt.get("profile3.dpi2", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_3, 1, (uint8_t)stoi( pt.get("profile3.dpi2", ""), 0, 16) ); }
|
||||
if( pt.get("profile3.dpi3", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_3, 2, (uint8_t)stoi( pt.get("profile3.dpi3", ""), 0, 16) ); }
|
||||
if( pt.get("profile3.dpi4", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_3, 3, (uint8_t)stoi( pt.get("profile3.dpi4", ""), 0, 16) ); }
|
||||
if( pt.get("profile3.dpi5", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_3, 4, (uint8_t)stoi( pt.get("profile3.dpi5", ""), 0, 16) ); }
|
||||
if( pt.get("profile3.button_left", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 0, pt.get("profile3.button_left", "") ); }
|
||||
if( pt.get("profile3.button_right", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 1, pt.get("profile3.button_right", "") ); }
|
||||
if( pt.get("profile3.button_middle", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 2, pt.get("profile3.button_middle", "") ); }
|
||||
if( pt.get("profile3.button_fire", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 3, pt.get("profile3.button_fire", "") ); }
|
||||
if( pt.get("profile3.button_dpi_up", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 4, pt.get("profile3.button_dpi_up", "") ); }
|
||||
if( pt.get("profile3.button_dpi_down", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 5, pt.get("profile3.button_dpi_down", "") ); }
|
||||
if( pt.get("profile3.button_1", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 6, pt.get("profile3.button_1", "") ); }
|
||||
if( pt.get("profile3.button_2", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 7, pt.get("profile3.button_2", "") ); }
|
||||
if( pt.get("profile3.button_3", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 8, pt.get("profile3.button_3", "") ); }
|
||||
if( pt.get("profile3.button_4", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 9, pt.get("profile3.button_4", "") ); }
|
||||
if( pt.get("profile3.button_5", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 10, pt.get("profile3.button_5", "") ); }
|
||||
if( pt.get("profile3.button_6", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 11, pt.get("profile3.button_6", "") ); }
|
||||
if( pt.get("profile3.button_7", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 12, pt.get("profile3.button_7", "") ); }
|
||||
if( pt.get("profile3.button_8", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 13, pt.get("profile3.button_8", "") ); }
|
||||
if( pt.get("profile3.button_9", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 14, pt.get("profile3.button_9", "") ); }
|
||||
if( pt.get("profile3.button_10", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 15, pt.get("profile3.button_10", "") ); }
|
||||
if( pt.get("profile3.button_11", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 16, pt.get("profile3.button_11", "") ); }
|
||||
if( pt.get("profile3.button_12", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 17, pt.get("profile3.button_12", "") ); }
|
||||
if( pt.get("profile3.scroll_up", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 18, pt.get("profile3.scroll_up", "") ); }
|
||||
if( pt.get("profile3.scroll_down", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_3, 19, pt.get("profile3.scroll_down", "") ); }
|
||||
//profile 4
|
||||
if( pt.get("profile4.lightmode", "") == "breathing" ){ m.set_lightmode( mouse_m908::profile_4, mouse_m908::lightmode_breathing ); }
|
||||
if( pt.get("profile4.lightmode", "") == "rainbow" ){ m.set_lightmode( mouse_m908::profile_4, mouse_m908::lightmode_rainbow ); }
|
||||
if( pt.get("profile4.lightmode", "") == "static" ){ m.set_lightmode( mouse_m908::profile_4, mouse_m908::lightmode_static ); }
|
||||
if( pt.get("profile4.lightmode", "") == "wave" ){ m.set_lightmode( mouse_m908::profile_4, mouse_m908::lightmode_wave ); }
|
||||
if( pt.get("profile4.lightmode", "") == "alternating" ){ m.set_lightmode( mouse_m908::profile_4, mouse_m908::lightmode_alternating ); }
|
||||
if( pt.get("profile4.lightmode", "") == "reactive" ){ m.set_lightmode( mouse_m908::profile_4, mouse_m908::lightmode_reactive ); }
|
||||
if( pt.get("profile4.lightmode", "") == "flashing" ){ m.set_lightmode( mouse_m908::profile_4, mouse_m908::lightmode_flashing ); }
|
||||
if( pt.get("profile4.lightmode", "") == "off" ){ m.set_lightmode( mouse_m908::profile_4, mouse_m908::lightmode_off ); }
|
||||
if( pt.get("profile4.color", "").length() == 6 ){
|
||||
m.set_color( mouse_m908::profile_4,
|
||||
{(uint8_t)stoi( pt.get("profile4.color", "").substr(0,2), 0, 16),
|
||||
(uint8_t)stoi( pt.get("profile4.color", "").substr(2,2), 0, 16),
|
||||
(uint8_t)stoi( pt.get("profile4.color", "").substr(4,2), 0, 16)} );
|
||||
}
|
||||
if( pt.get("profile4.brightness", "").length() != 0 ){
|
||||
m.set_brightness( mouse_m908::profile_4, (uint8_t)stoi( pt.get("profile4.brightness", ""), 0, 16) );
|
||||
}
|
||||
if( pt.get("profile4.speed", "").length() != 0 ){
|
||||
m.set_speed( mouse_m908::profile_4, (uint8_t)stoi( pt.get("profile4.speed", ""), 0, 16) );
|
||||
}
|
||||
if( pt.get("profile4.scrollspeed", "").length() != 0 ){
|
||||
m.set_scrollspeed( mouse_m908::profile_4, (uint8_t)stoi( pt.get("profile4.scrollspeed", ""), 0, 16) );
|
||||
}
|
||||
if( pt.get("profile4.dpi1_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_4, 0, false ); }
|
||||
if( pt.get("profile4.dpi2_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_4, 1, false ); }
|
||||
if( pt.get("profile4.dpi3_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_4, 2, false ); }
|
||||
if( pt.get("profile4.dpi4_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_4, 3, false ); }
|
||||
if( pt.get("profile4.dpi5_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_4, 4, false ); }
|
||||
if( pt.get("profile4.dpi1", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_4, 0, (uint8_t)stoi( pt.get("profile4.dpi1", ""), 0, 16) ); }
|
||||
if( pt.get("profile4.dpi2", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_4, 1, (uint8_t)stoi( pt.get("profile4.dpi2", ""), 0, 16) ); }
|
||||
if( pt.get("profile4.dpi3", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_4, 2, (uint8_t)stoi( pt.get("profile4.dpi3", ""), 0, 16) ); }
|
||||
if( pt.get("profile4.dpi4", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_4, 3, (uint8_t)stoi( pt.get("profile4.dpi4", ""), 0, 16) ); }
|
||||
if( pt.get("profile4.dpi5", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_4, 4, (uint8_t)stoi( pt.get("profile4.dpi5", ""), 0, 16) ); }
|
||||
if( pt.get("profile4.button_left", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 0, pt.get("profile4.button_left", "") ); }
|
||||
if( pt.get("profile4.button_right", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 1, pt.get("profile4.button_right", "") ); }
|
||||
if( pt.get("profile4.button_middle", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 2, pt.get("profile4.button_middle", "") ); }
|
||||
if( pt.get("profile4.button_fire", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 3, pt.get("profile4.button_fire", "") ); }
|
||||
if( pt.get("profile4.button_dpi_up", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 4, pt.get("profile4.button_dpi_up", "") ); }
|
||||
if( pt.get("profile4.button_dpi_down", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 5, pt.get("profile4.button_dpi_down", "") ); }
|
||||
if( pt.get("profile4.button_1", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 6, pt.get("profile4.button_1", "") ); }
|
||||
if( pt.get("profile4.button_2", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 7, pt.get("profile4.button_2", "") ); }
|
||||
if( pt.get("profile4.button_3", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 8, pt.get("profile4.button_3", "") ); }
|
||||
if( pt.get("profile4.button_4", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 9, pt.get("profile4.button_4", "") ); }
|
||||
if( pt.get("profile4.button_5", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 10, pt.get("profile4.button_5", "") ); }
|
||||
if( pt.get("profile4.button_6", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 11, pt.get("profile4.button_6", "") ); }
|
||||
if( pt.get("profile4.button_7", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 12, pt.get("profile4.button_7", "") ); }
|
||||
if( pt.get("profile4.button_8", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 13, pt.get("profile4.button_8", "") ); }
|
||||
if( pt.get("profile4.button_9", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 14, pt.get("profile4.button_9", "") ); }
|
||||
if( pt.get("profile4.button_10", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 15, pt.get("profile4.button_10", "") ); }
|
||||
if( pt.get("profile4.button_11", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 16, pt.get("profile4.button_11", "") ); }
|
||||
if( pt.get("profile4.button_12", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 17, pt.get("profile4.button_12", "") ); }
|
||||
if( pt.get("profile4.scroll_up", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 18, pt.get("profile4.scroll_up", "") ); }
|
||||
if( pt.get("profile4.scroll_down", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_4, 19, pt.get("profile4.scroll_down", "") ); }
|
||||
//profile 5
|
||||
if( pt.get("profile5.lightmode", "") == "breathing" ){ m.set_lightmode( mouse_m908::profile_5, mouse_m908::lightmode_breathing ); }
|
||||
if( pt.get("profile5.lightmode", "") == "rainbow" ){ m.set_lightmode( mouse_m908::profile_5, mouse_m908::lightmode_rainbow ); }
|
||||
if( pt.get("profile5.lightmode", "") == "static" ){ m.set_lightmode( mouse_m908::profile_5, mouse_m908::lightmode_static ); }
|
||||
if( pt.get("profile5.lightmode", "") == "wave" ){ m.set_lightmode( mouse_m908::profile_5, mouse_m908::lightmode_wave ); }
|
||||
if( pt.get("profile5.lightmode", "") == "alternating" ){ m.set_lightmode( mouse_m908::profile_5, mouse_m908::lightmode_alternating ); }
|
||||
if( pt.get("profile5.lightmode", "") == "reactive" ){ m.set_lightmode( mouse_m908::profile_5, mouse_m908::lightmode_reactive ); }
|
||||
if( pt.get("profile5.lightmode", "") == "flashing" ){ m.set_lightmode( mouse_m908::profile_5, mouse_m908::lightmode_flashing ); }
|
||||
if( pt.get("profile5.lightmode", "") == "off" ){ m.set_lightmode( mouse_m908::profile_5, mouse_m908::lightmode_off ); }
|
||||
if( pt.get("profile5.color", "").length() == 6 ){
|
||||
m.set_color( mouse_m908::profile_5,
|
||||
{(uint8_t)stoi( pt.get("profile5.color", "").substr(0,2), 0, 16),
|
||||
(uint8_t)stoi( pt.get("profile5.color", "").substr(2,2), 0, 16),
|
||||
(uint8_t)stoi( pt.get("profile5.color", "").substr(4,2), 0, 16)} );
|
||||
}
|
||||
if( pt.get("profile5.brightness", "").length() != 0 ){
|
||||
m.set_brightness( mouse_m908::profile_5, (uint8_t)stoi( pt.get("profile5.brightness", ""), 0, 16) );
|
||||
}
|
||||
if( pt.get("profile5.speed", "").length() != 0 ){
|
||||
m.set_speed( mouse_m908::profile_5, (uint8_t)stoi( pt.get("profile5.speed", ""), 0, 16) );
|
||||
}
|
||||
if( pt.get("profile5.scrollspeed", "").length() != 0 ){
|
||||
m.set_scrollspeed( mouse_m908::profile_5, (uint8_t)stoi( pt.get("profile5.scrollspeed", ""), 0, 16) );
|
||||
}
|
||||
if( pt.get("profile5.dpi1_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_5, 0, false ); }
|
||||
if( pt.get("profile5.dpi2_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_5, 1, false ); }
|
||||
if( pt.get("profile5.dpi3_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_5, 2, false ); }
|
||||
if( pt.get("profile5.dpi4_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_5, 3, false ); }
|
||||
if( pt.get("profile5.dpi5_enable", "") == "0" ){ m.set_dpi_enable( mouse_m908::profile_5, 4, false ); }
|
||||
if( pt.get("profile5.dpi1", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_5, 0, (uint8_t)stoi( pt.get("profile5.dpi1", ""), 0, 16) ); }
|
||||
if( pt.get("profile5.dpi2", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_5, 1, (uint8_t)stoi( pt.get("profile5.dpi2", ""), 0, 16) ); }
|
||||
if( pt.get("profile5.dpi3", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_5, 2, (uint8_t)stoi( pt.get("profile5.dpi3", ""), 0, 16) ); }
|
||||
if( pt.get("profile5.dpi4", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_5, 3, (uint8_t)stoi( pt.get("profile5.dpi4", ""), 0, 16) ); }
|
||||
if( pt.get("profile5.dpi5", "").length() != 0 ){ m.set_dpi( mouse_m908::profile_5, 4, (uint8_t)stoi( pt.get("profile5.dpi5", ""), 0, 16) ); }
|
||||
if( pt.get("profile5.button_left", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 0, pt.get("profile5.button_left", "") ); }
|
||||
if( pt.get("profile5.button_right", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 1, pt.get("profile5.button_right", "") ); }
|
||||
if( pt.get("profile5.button_middle", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 2, pt.get("profile5.button_middle", "") ); }
|
||||
if( pt.get("profile5.button_fire", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 3, pt.get("profile5.button_fire", "") ); }
|
||||
if( pt.get("profile5.button_dpi_up", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 4, pt.get("profile5.button_dpi_up", "") ); }
|
||||
if( pt.get("profile5.button_dpi_down", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 5, pt.get("profile5.button_dpi_down", "") ); }
|
||||
if( pt.get("profile5.button_1", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 6, pt.get("profile5.button_1", "") ); }
|
||||
if( pt.get("profile5.button_2", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 7, pt.get("profile5.button_2", "") ); }
|
||||
if( pt.get("profile5.button_3", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 8, pt.get("profile5.button_3", "") ); }
|
||||
if( pt.get("profile5.button_4", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 9, pt.get("profile5.button_4", "") ); }
|
||||
if( pt.get("profile5.button_5", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 10, pt.get("profile5.button_5", "") ); }
|
||||
if( pt.get("profile5.button_6", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 11, pt.get("profile5.button_6", "") ); }
|
||||
if( pt.get("profile5.button_7", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 12, pt.get("profile5.button_7", "") ); }
|
||||
if( pt.get("profile5.button_8", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 13, pt.get("profile5.button_8", "") ); }
|
||||
if( pt.get("profile5.button_9", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 14, pt.get("profile5.button_9", "") ); }
|
||||
if( pt.get("profile5.button_10", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 15, pt.get("profile5.button_10", "") ); }
|
||||
if( pt.get("profile5.button_11", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 16, pt.get("profile5.button_11", "") ); }
|
||||
if( pt.get("profile5.button_12", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 17, pt.get("profile5.button_12", "") ); }
|
||||
if( pt.get("profile5.scroll_up", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 18, pt.get("profile5.scroll_up", "") ); }
|
||||
if( pt.get("profile5.scroll_down", "").length() != 0 ){ m.set_key_mapping( mouse_m908::profile_5, 19, pt.get("profile5.scroll_down", "") ); }
|
||||
|
||||
int r;
|
||||
r = m.open_mouse();
|
||||
if( r != 0 ){
|
||||
std::cout << "Couldn't open mouse\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
m.write_settings();
|
||||
|
||||
m.close_mouse();
|
||||
} catch( std::exception& e ){
|
||||
std::cerr << "Error: " << e.what() << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if( flag_profile ){
|
||||
|
||||
if( string_profile == "1" ){ m.set_profile( mouse_m908::profile_1 ); }
|
||||
if( string_profile == "2" ){ m.set_profile( mouse_m908::profile_2 ); }
|
||||
if( string_profile == "3" ){ m.set_profile( mouse_m908::profile_3 ); }
|
||||
if( string_profile == "4" ){ m.set_profile( mouse_m908::profile_4 ); }
|
||||
if( string_profile == "5" ){ m.set_profile( mouse_m908::profile_5 ); }
|
||||
|
||||
int r;
|
||||
r = m.open_mouse();
|
||||
if( r != 0 ){
|
||||
std::cout << "Couldn't open mouse\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
m.write_profile();
|
||||
|
||||
m.close_mouse();
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
2
mouse_m908.rules
Normal file
2
mouse_m908.rules
Normal file
|
@ -0,0 +1,2 @@
|
|||
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d9", ATTRS{idProduct}=="fc4d", MODE:="0666"
|
||||
SUBSYSTEM=="usb_device", ATTRS{idVendor}=="04d9", ATTRS{idProduct}=="fc4d", MODE:="0666"
|
Loading…
Reference in a new issue