mirror of https://github.com/nirenjan/libx52.git
Add framework for virtual mouse driver
This change adds the configuration and build related changes for supporting the virtual mouse. Subsequent commits will add support for reading the IO interface and translating it to mouse commands.reverse-scroll
parent
8874a282aa
commit
016851478a
|
@ -35,6 +35,15 @@ x52d_LDADD = \
|
|||
libx52.la \
|
||||
@LTLIBINTL@
|
||||
|
||||
if HAVE_EVDEV
|
||||
x52d_SOURCES += \
|
||||
daemon/x52d_mouse_evdev.c
|
||||
|
||||
x52d_CFLAGS += -DHAVE_EVDEV @EVDEV_CFLAGS@
|
||||
x52d_LDFLAGS += @EVDEV_LIBS@
|
||||
x52d_LDADD += libx52io.la
|
||||
endif
|
||||
|
||||
x52dconfdir = @sysconfdir@/x52d
|
||||
x52dconf_DATA = daemon/x52d.conf
|
||||
|
||||
|
|
|
@ -74,6 +74,17 @@ Clutch=green
|
|||
MFD=128
|
||||
LED=128
|
||||
|
||||
######################################################################
|
||||
# Mouse - only valid on Linux
|
||||
######################################################################
|
||||
[Mouse]
|
||||
|
||||
# Enabled controls whether the virtual mouse is enabled or not.
|
||||
Enabled=yes
|
||||
|
||||
# Speed is proportional to the speed of updates to the virtual mouse
|
||||
Speed=0
|
||||
|
||||
######################################################################
|
||||
# Profiles - only valid on Linux
|
||||
######################################################################
|
||||
|
|
|
@ -65,6 +65,16 @@ CFG(LED, Clutch, leds[LIBX52_LED_CLUTCH], led, green)
|
|||
CFG(Brightness, MFD, brightness[0], int, 128)
|
||||
CFG(Brightness, LED, brightness[1], int, 128)
|
||||
|
||||
/**********************************************************************
|
||||
* Mouse Settings
|
||||
*********************************************************************/
|
||||
// Enabled controls whether the virtual mouse is enabled or not.
|
||||
CFG(Mouse, Enabled, mouse_enabled, bool, true)
|
||||
|
||||
// Speed is a value that is proportional to the speed of updates to the
|
||||
// virtual mouse
|
||||
CFG(Mouse, Speed, mouse_speed, int, 0)
|
||||
|
||||
/**********************************************************************
|
||||
* Profiles - only valid on Linux
|
||||
*********************************************************************/
|
||||
|
|
|
@ -37,6 +37,9 @@ struct x52d_config {
|
|||
|
||||
int brightness[2];
|
||||
|
||||
bool mouse_enabled;
|
||||
int mouse_speed;
|
||||
|
||||
bool clutch_enabled;
|
||||
bool clutch_latched;
|
||||
|
||||
|
@ -66,6 +69,8 @@ void x52d_cfg_set_LED_POV(libx52_led_state param);
|
|||
void x52d_cfg_set_LED_Clutch(libx52_led_state param);
|
||||
void x52d_cfg_set_Brightness_MFD(uint16_t param);
|
||||
void x52d_cfg_set_Brightness_LED(uint16_t param);
|
||||
void x52d_cfg_set_Mouse_Enabled(bool param);
|
||||
void x52d_cfg_set_Mouse_Speed(int param);
|
||||
void x52d_cfg_set_Profiles_Directory(char* param);
|
||||
void x52d_cfg_set_Profiles_ClutchEnabled(bool param);
|
||||
void x52d_cfg_set_Profiles_ClutchLatched(bool param);
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Saitek X52 Pro MFD & LED driver - Mouse driver
|
||||
*
|
||||
* Copyright (C) 2021 Nirenjan Krishnan (nirenjan@nirenjan.org)
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "pinelog.h"
|
||||
#include "x52d_config.h"
|
||||
#include "x52d_const.h"
|
||||
|
||||
// Mouse speed is the delay between subsequent mouse reports
|
||||
#define DEFAULT_MOUSE_SPEED 250000
|
||||
|
||||
static bool mouse_enabled = false;
|
||||
static int mouse_speed = DEFAULT_MOUSE_SPEED;
|
||||
|
||||
#define MAX_MOUSE_SPEED 5
|
||||
static const int mouse_speed_map[MAX_MOUSE_SPEED] = {
|
||||
250000,
|
||||
200000,
|
||||
150000,
|
||||
100000,
|
||||
50000,
|
||||
};
|
||||
|
||||
void x52d_cfg_set_Mouse_Enabled(bool enabled)
|
||||
{
|
||||
PINELOG_DEBUG(_("Setting mouse enable to %s"),
|
||||
enabled ? _("on") : _("off"));
|
||||
mouse_enabled = enabled;
|
||||
}
|
||||
|
||||
void x52d_cfg_set_Mouse_Speed(int speed)
|
||||
{
|
||||
int new_speed;
|
||||
if (speed >= 0 && speed < MAX_MOUSE_SPEED) {
|
||||
new_speed = mouse_speed_map[speed];
|
||||
PINELOG_DEBUG(_("Setting mouse speed to %d (delay %d ms)"),
|
||||
speed, new_speed);
|
||||
mouse_speed = new_speed;
|
||||
} else {
|
||||
PINELOG_INFO(_("Ignoring mouse speed %d outside supported range (0-%d)"),
|
||||
speed, MAX_MOUSE_SPEED);
|
||||
}
|
||||
}
|
|
@ -17,3 +17,4 @@ daemon/x52d_clock.c
|
|||
daemon/x52d_config.c
|
||||
daemon/x52d_config_parser.c
|
||||
daemon/x52d_device.c
|
||||
daemon/x52d_mouse_evdev.c
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: x52pro-linux 0.2.2\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n"
|
||||
"POT-Creation-Date: 2021-09-14 01:00-0700\n"
|
||||
"POT-Creation-Date: 2021-09-14 09:52-0700\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -143,10 +143,12 @@ msgid "Unknown LED state %d"
|
|||
msgstr ""
|
||||
|
||||
#: libx52/x52_stringify.c:47 daemon/x52d_clock.c:28
|
||||
#: daemon/x52d_mouse_evdev.c:35
|
||||
msgid "off"
|
||||
msgstr ""
|
||||
|
||||
#: libx52/x52_stringify.c:48 daemon/x52d_clock.c:28
|
||||
#: daemon/x52d_mouse_evdev.c:35
|
||||
msgid "on"
|
||||
msgstr ""
|
||||
|
||||
|
@ -714,3 +716,18 @@ msgstr ""
|
|||
#, c-format
|
||||
msgid "Error %d when updating X52 device: %s"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/x52d_mouse_evdev.c:34
|
||||
#, c-format
|
||||
msgid "Setting mouse enable to %s"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/x52d_mouse_evdev.c:44
|
||||
#, c-format
|
||||
msgid "Setting mouse speed to %d (delay %d ms)"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/x52d_mouse_evdev.c:48
|
||||
#, c-format
|
||||
msgid "Ignoring mouse speed %d outside supported range (0-%d)"
|
||||
msgstr ""
|
||||
|
|
21
po/xx_PL.po
21
po/xx_PL.po
|
@ -7,8 +7,8 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: x52pro-linux 0.2.1\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/nirenjan/x52pro-linux/issues\n"
|
||||
"POT-Creation-Date: 2021-09-14 01:00-0700\n"
|
||||
"PO-Revision-Date: 2021-08-30 10:41-0700\n"
|
||||
"POT-Creation-Date: 2021-09-14 09:52-0700\n"
|
||||
"PO-Revision-Date: 2021-09-14 09:54-0700\n"
|
||||
"Last-Translator: Nirenjan Krishnan <nirenjan@gmail.com>\n"
|
||||
"Language-Team: Dummy Language for testing i18n\n"
|
||||
"Language: xx_PL\n"
|
||||
|
@ -143,10 +143,12 @@ msgid "Unknown LED state %d"
|
|||
msgstr "Unknownay EDLay atestay %d"
|
||||
|
||||
#: libx52/x52_stringify.c:47 daemon/x52d_clock.c:28
|
||||
#: daemon/x52d_mouse_evdev.c:35
|
||||
msgid "off"
|
||||
msgstr "offay"
|
||||
|
||||
#: libx52/x52_stringify.c:48 daemon/x52d_clock.c:28
|
||||
#: daemon/x52d_mouse_evdev.c:35
|
||||
msgid "on"
|
||||
msgstr "onay"
|
||||
|
||||
|
@ -763,3 +765,18 @@ msgstr "Erroray %d enwhay updatingay X52 arameterpay: %s"
|
|||
#, c-format
|
||||
msgid "Error %d when updating X52 device: %s"
|
||||
msgstr "Erroray %d enwhay updatingay X52 eviceday: %s"
|
||||
|
||||
#: daemon/x52d_mouse_evdev.c:34
|
||||
#, c-format
|
||||
msgid "Setting mouse enable to %s"
|
||||
msgstr "Ettingsay ousemay enableay otay %s"
|
||||
|
||||
#: daemon/x52d_mouse_evdev.c:44
|
||||
#, c-format
|
||||
msgid "Setting mouse speed to %d (delay %d ms)"
|
||||
msgstr "Ettingsay ousemay eedspay otay %d (elayday %d ms)"
|
||||
|
||||
#: daemon/x52d_mouse_evdev.c:48
|
||||
#, c-format
|
||||
msgid "Ignoring mouse speed %d outside supported range (0-%d)"
|
||||
msgstr "Ignoringay ousemay eedspay %d outsideay upportedsay angeray (0-%d)"
|
||||
|
|
Loading…
Reference in New Issue