Commit Graph

10 Commits (7d757dd40f938f5f47224fa56c00a4fc567a51ca)

Author SHA1 Message Date
nirenjan 7d757dd40f Disable device check routine in daemon
Prior to this change, the device check was sending a vendor specific
command with wIndex and wValue both set to 0 every 50 ms. On some
systems, this was causing issues with the joystick flapping the state,
and reporting weird values from the stick, and generally sluggish
response.

This change uses the updated libx52 library which uses the hotplug
notification to determine if the device is connected, and should resolve
the issues seen.

Fixes #33
2021-09-14 09:10:52 -07:00
nirenjan f34f84a3ee Add routine to check device connectivity
Prior to this change, if the clock thread is disabled, then
disconnecting and reconnecting the X52 device would cause the daemon to
not detect the transition. As a result, the daemon would stay in a state
where it thinks the device is still connected, and therefore, not
actually apply any of the saved configuration, until it received a
SIGHUP to refresh the configuration.

This change adds a routine that sends a dummy vendor command. This
vendor command does nothing on my X52 Pro (VID 06a3, PID 0762), but
serves as a check to see if the daemon can send vendor commands to the
device. If the device is indeed disconnected, then that is a sufficient
indicator to disable the update thread and re-enable the acquisition
thread.
2021-08-30 12:33:52 -07:00
nirenjan 91f378c4fc Apply configuration immediately when device is connected 2021-08-30 10:41:21 -07:00
nirenjan bd2dbbb9cc Make thread startup and shutdown logs as INFO 2021-07-26 10:30:29 -07:00
nirenjan e4d1b6aff2 Add update thread enable flag
Prior to this change, the update thread was only checking on
device_update_needed. However, this causes an issue when calling any of
the set methods where the update thread fires, fails to find a device,
and signals the acquisition thread every 50 ms, since the update flag
was never cleared.

This change adds a thread enable flag for the update thread. The update
thread will check that both the thread enable flag and the update needed
flag are set before proceeding with the call to libx52_update.
2021-07-25 08:42:33 -07:00
nirenjan 2cecd1890a Allow set_led_state calls to ignore unsupported feature 2021-07-23 14:31:14 -07:00
nirenjan ae13480717 Allow libx52 calls to return TRY_AGAIN
Some libx52 APIs, notably the clock related ones, can return
LIBX52_ERROR_TRY_AGAIN. This is not a real error, but it is useful
information. It indicates to the application that there is no change
applied to the internal state, and that it should wait until trying
again.

Given that the clock thread calls the libx52_set_clock method every
second, treating the TRY_AGAIN state as a failure and logging it causes
a lot of spurious noise in the logs.  This change ensures that the API
returns a real error before logging it.
2021-07-23 09:43:02 -07:00
nirenjan 6175dcabe6 Remove trace logging in device update thread
Having the trace log in there adds unnecessary logging for no real
reason. It is better to disable the log here to help trace other
portions of the daemon.
2021-07-23 09:41:18 -07:00
nirenjan ac8bb6cdd9 Add threads to find and update X52 device 2021-07-21 00:01:49 -07:00
nirenjan ab946b4a1a Add device manager implementation 2021-07-16 00:30:27 -07:00