Remove m prefix from mouse names

This commit is contained in:
dokutan 2021-02-07 22:31:05 +01:00
parent d4cd2593ba
commit dce9d509bb
7 changed files with 10 additions and 10 deletions

View file

@ -22,7 +22,7 @@
#include "../rd_mouse.h"
const std::string mouse_m709::_c_name = "m709";
const std::string mouse_m709::_c_name = "709";
// usb device vars
const uint16_t mouse_m709::_c_mouse_vid = 0x04d9;

View file

@ -22,7 +22,7 @@
#include "../rd_mouse.h"
const std::string mouse_m711::_c_name = "m711";
const std::string mouse_m711::_c_name = "711";
// usb device vars
const uint16_t mouse_m711::_c_mouse_vid = 0x04d9;

View file

@ -22,7 +22,7 @@
#include "../rd_mouse.h"
const std::string mouse_m715::_c_name = "m715";
const std::string mouse_m715::_c_name = "715";
// usb device vars
const uint16_t mouse_m715::_c_mouse_vid = 0x04d9;

View file

@ -22,7 +22,7 @@
#include "../rd_mouse.h"
const std::string mouse_m908::_c_name = "m908";
const std::string mouse_m908::_c_name = "908";
// usb device vars
const uint16_t mouse_m908::_c_mouse_vid = 0x04d9;

View file

@ -22,7 +22,7 @@
#include "../rd_mouse.h"
const std::string mouse_m990::_c_name = "m990";
const std::string mouse_m990::_c_name = "990";
// usb device vars
const uint16_t mouse_m990::_c_mouse_vid = 0x04d9;

View file

@ -22,7 +22,7 @@
#include "../rd_mouse.h"
const std::string mouse_m990chroma::_c_name = "m990chroma";
const std::string mouse_m990chroma::_c_name = "990chroma";
// usb device vars
const uint16_t mouse_m990chroma::_c_mouse_vid = 0x04d9;

View file

@ -19,7 +19,7 @@
#include "rd_mouse.h"
/// Calls the function fn with an object of each type in the variant V
template< typename V, size_t I, typename F > void variant_loop(F fn){
template< typename V, size_t I = std::variant_size_v<V>-1, typename F > void variant_loop(F fn){
V var = V(std::in_place_index<I>);
std::visit( fn, var );
@ -55,7 +55,7 @@ rd_mouse::mouse_variant rd_mouse::detect(){
uint16_t pid = descriptor.idProduct;
// Compare the VID and PID of the current device against the IDs of all mice
variant_loop< rd_mouse::mouse_variant, std::variant_size_v<rd_mouse::mouse_variant>-1 >( [&](auto m){
variant_loop< rd_mouse::mouse_variant >( [&](auto m){
if( vid == m.get_vid() && pid == m.get_pid() )
mouse = m;
} );
@ -82,7 +82,7 @@ rd_mouse::mouse_variant rd_mouse::detect(){
}
rd_mouse::mouse_variant rd_mouse::detect( std::string mouse_name ){
std::cout << mouse_name << "\n";
rd_mouse::mouse_variant mouse = rd_mouse::monostate();
// libusb init
@ -107,7 +107,7 @@ rd_mouse::mouse_variant rd_mouse::detect( std::string mouse_name ){
uint16_t pid = descriptor.idProduct;
// Compare the VID and PID of the current device against the IDs of all mice
variant_loop< rd_mouse::mouse_variant, std::variant_size_v<rd_mouse::mouse_variant>-1 >( [&](auto m){
variant_loop< rd_mouse::mouse_variant >( [&](auto m){
if( vid == m.get_vid() && pid == m.get_pid() && mouse_name == m.get_name() )
mouse = m;
} );