mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-28 13:28:01 +03:00
evdev: log positive axis config
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
This commit is contained in:
parent
9c5b3a2300
commit
fcb6bc70f8
2 changed files with 38 additions and 28 deletions
|
@ -18,6 +18,33 @@
|
||||||
|
|
||||||
LOG_CHANNEL(evdev_log, "evdev");
|
LOG_CHANNEL(evdev_log, "evdev");
|
||||||
|
|
||||||
|
bool positive_axis::load()
|
||||||
|
{
|
||||||
|
if (fs::file cfg_file{ cfg_name, fs::read })
|
||||||
|
{
|
||||||
|
return from_string(cfg_file.to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
from_default();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void positive_axis::save() const
|
||||||
|
{
|
||||||
|
fs::pending_file file(cfg_name);
|
||||||
|
|
||||||
|
if (file.file)
|
||||||
|
{
|
||||||
|
file.file.write(to_string());
|
||||||
|
file.commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool positive_axis::exist() const
|
||||||
|
{
|
||||||
|
return fs::is_file(cfg_name);
|
||||||
|
}
|
||||||
|
|
||||||
evdev_joystick_handler::evdev_joystick_handler()
|
evdev_joystick_handler::evdev_joystick_handler()
|
||||||
: PadHandlerBase(pad_handler::evdev)
|
: PadHandlerBase(pad_handler::evdev)
|
||||||
{
|
{
|
||||||
|
@ -110,7 +137,12 @@ bool evdev_joystick_handler::Init()
|
||||||
if (m_is_init)
|
if (m_is_init)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
m_pos_axis_config.load();
|
if (!m_pos_axis_config.load())
|
||||||
|
{
|
||||||
|
evdev_log.notice("positive_axis config missing. Using defaults");
|
||||||
|
}
|
||||||
|
|
||||||
|
evdev_log.notice("positive_axis config=\n%s", m_pos_axis_config.to_string());
|
||||||
|
|
||||||
if (!m_pos_axis_config.exist())
|
if (!m_pos_axis_config.exist())
|
||||||
m_pos_axis_config.save();
|
m_pos_axis_config.save();
|
||||||
|
@ -783,7 +815,7 @@ std::shared_ptr<evdev_joystick_handler::EvdevDevice> evdev_joystick_handler::add
|
||||||
// Let's log axis information while we are in the settings in order to identify problems more easily.
|
// Let's log axis information while we are in the settings in order to identify problems more easily.
|
||||||
for (const auto& [code, axis_name] : axis_list)
|
for (const auto& [code, axis_name] : axis_list)
|
||||||
{
|
{
|
||||||
if (const input_absinfo *info = libevdev_get_abs_info(dev, code))
|
if (const input_absinfo* info = libevdev_get_abs_info(dev, code))
|
||||||
{
|
{
|
||||||
const char* code_name = libevdev_event_code_get_name(EV_ABS, code);
|
const char* code_name = libevdev_event_code_get_name(EV_ABS, code);
|
||||||
evdev_log.notice("Axis info for %s: %s (%s) => minimum=%d, maximum=%d, fuzz=%d, flat=%d, resolution=%d",
|
evdev_log.notice("Axis info for %s: %s (%s) => minimum=%d, maximum=%d, fuzz=%d, flat=%d, resolution=%d",
|
||||||
|
@ -857,7 +889,7 @@ std::shared_ptr<evdev_joystick_handler::EvdevDevice> evdev_joystick_handler::add
|
||||||
// A device must not mix regular directional axes and accelerometer axes on the same event node.
|
// A device must not mix regular directional axes and accelerometer axes on the same event node.
|
||||||
for (const auto& [code, axis_name] : axis_list)
|
for (const auto& [code, axis_name] : axis_list)
|
||||||
{
|
{
|
||||||
if (const input_absinfo *info = libevdev_get_abs_info(dev, code))
|
if (const input_absinfo* info = libevdev_get_abs_info(dev, code))
|
||||||
{
|
{
|
||||||
const bool is_accel = code == ABS_X || code == ABS_Y || code == ABS_Z;
|
const bool is_accel = code == ABS_X || code == ABS_Y || code == ABS_Z;
|
||||||
const char* code_name = libevdev_event_code_get_name(EV_ABS, code);
|
const char* code_name = libevdev_event_code_get_name(EV_ABS, code);
|
||||||
|
|
|
@ -57,31 +57,9 @@ struct positive_axis : cfg::node
|
||||||
cfg::_bool abs_mt_tool_x{ this, "ABS_MT_TOOL_X", false };
|
cfg::_bool abs_mt_tool_x{ this, "ABS_MT_TOOL_X", false };
|
||||||
cfg::_bool abs_mt_tool_y{ this, "ABS_MT_TOOL_Y", false };
|
cfg::_bool abs_mt_tool_y{ this, "ABS_MT_TOOL_Y", false };
|
||||||
|
|
||||||
bool load()
|
bool load();
|
||||||
{
|
void save() const;
|
||||||
if (fs::file cfg_file{ cfg_name, fs::read })
|
bool exist() const;
|
||||||
{
|
|
||||||
return from_string(cfg_file.to_string());
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void save()
|
|
||||||
{
|
|
||||||
fs::pending_file file(cfg_name);
|
|
||||||
|
|
||||||
if (file.file)
|
|
||||||
{
|
|
||||||
file.file.write(to_string());
|
|
||||||
file.commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool exist()
|
|
||||||
{
|
|
||||||
return fs::is_file(cfg_name);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class evdev_joystick_handler final : public PadHandlerBase
|
class evdev_joystick_handler final : public PadHandlerBase
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue