mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-19 19:15:26 +00:00
evdev: log positive axis config
This commit is contained in:
parent
9c5b3a2300
commit
f8028bd880
2 changed files with 38 additions and 28 deletions
|
@ -18,6 +18,33 @@
|
|||
|
||||
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()
|
||||
: PadHandlerBase(pad_handler::evdev)
|
||||
{
|
||||
|
@ -110,7 +137,12 @@ bool evdev_joystick_handler::Init()
|
|||
if (m_is_init)
|
||||
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())
|
||||
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.
|
||||
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);
|
||||
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.
|
||||
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 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_y{ this, "ABS_MT_TOOL_Y", false };
|
||||
|
||||
bool load()
|
||||
{
|
||||
if (fs::file cfg_file{ cfg_name, fs::read })
|
||||
{
|
||||
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);
|
||||
}
|
||||
bool load();
|
||||
void save() const;
|
||||
bool exist() const;
|
||||
};
|
||||
|
||||
class evdev_joystick_handler final : public PadHandlerBase
|
||||
|
|
Loading…
Add table
Reference in a new issue