Commit Graph

28 Commits

Author SHA1 Message Date
pixl 168c28d1e4 Wait for device to initialize before addDevice
For some reason, hidpp20 device names were badly set (e.g.
'Wireless Mouse MWireless' instead of 'Wireless Mouse MX Master').
Adding a 100ms delay to addDevice seems to have fixed it.
2020-07-19 01:35:26 -04:00
pixl 9607c32520 Fix issue where I/O would hang
RawDevice will now interruptRead() on pushing an event to the I/O
queue. This will prevent the listener from waiting for an event to
be received before handling an I/O request.
2020-07-19 01:22:56 -04:00
pixl f51ba0f681 Remove unused assert warnings when building Release 2020-07-15 13:27:21 -04:00
pixl 56d10898fb Print CIDs on device connect 2020-07-15 00:26:39 -04:00
pixl 0f60c3896c Fix usbhid-dump SIGSEGV on #100 2020-07-13 15:12:28 -04:00
pixl dde2993223 Fix crashes when logid starts as root
If logid scans every device, it will either SIGSEGV or not work at all.
This commit should fix bug #100.
2020-07-13 01:14:15 -04:00
pixl 4ce76f5927 Listen for events on receiver device on timeout
Previously, if a receiver device didn't respond during the initial scan,
logid would not recognize it until it sent a wakeup/connect event.

This makes it so if the device times out, logid will listen for the next
event from the device and try detecting it. (e.g. shaking the mouse will
make it become detected)
2020-07-12 16:16:50 -04:00
pixl f7638b0905 Properly output TimeoutError
Fixed issue where receiver devices aren't detected (hopefully).
2020-07-12 16:16:50 -04:00
pixl de8e453bd3 Fix deadlock issue
RawDevice would deadlock in some situations because I/O occured while
the listener was turning on. This also seems to have fixed logid
sometimes not detecting devices on receivers.
2020-07-12 16:16:24 -04:00
pixl 1f3fa53721 Add workqueue system 2020-07-12 16:16:24 -04:00
pixl bc8f1a983a Add configurable I/O timeout 2020-07-12 16:16:24 -04:00
pixl 5bf5dc75b5 Implement RemapButton feature
Many changes were made here, too many to list here.
2020-07-12 16:16:22 -04:00
pixl 1106133f3c Move logger into util/log.h 2020-07-12 16:15:48 -04:00
pixl 4ba9248038 Use safe thread class instead of std::thread 2020-07-12 16:15:48 -04:00
pixl 1d001237ba Monitor wake up/sleep events with Receiver 2020-07-12 16:15:48 -04:00
pixl 22455af615 Add GPL copyright notice in all C++ source files 2020-07-12 16:15:32 -04:00
pixl dd75df8c18 Use consistent code style
Only files that are currently used in logid are changed.
2020-07-12 16:14:25 -04:00
pixl bd080e7ef6 Fix bug described in 698971a
Feels like a hacky workaround, may come back to this later.
2020-07-12 16:14:24 -04:00
pixl 261d82390b Assert report ID and length before sending 2020-07-12 16:14:24 -04:00
pixl e40da5f0c0 Implement receiver HID++ connect/disconnect events
Many changes were made here but that was the biggest one.

There's currently a bug where std::system_error: Broken pipe is thrown
after launching the daemon with a receiver connector.

A workaround for this bug is to simply shake the mouse while starting
the daemon. I will investigate this soon.
2020-07-12 16:14:24 -04:00
pixl b05e525bbc Add RawReport log level 2020-07-12 16:14:24 -04:00
pixl fb0b8e88ef Clean up temporary code 2020-07-12 16:14:24 -04:00
pixl b41649b0de Implement dj::Receiver class
Again, many things were done here.
2020-07-12 16:13:54 -04:00
pixl 7571be1f54 Don't create a new thread for each raw event
Threads should be created as necessary, there is no reason to
launch a simple event handler in a new thread.
2020-07-12 16:13:53 -04:00
pixl c21a923ab2 Print version number of device 1 on each raw dev.
Only works on HID++ >=2.0 so far. Also solves a race condition where
the wrong response can be sent to a request.
2020-07-12 16:13:53 -04:00
pixl 91954e8a73 Use shared_ptr for devices in DeviceMonitor 2020-07-12 16:13:53 -04:00
pixl 6b895b3015 Monitor all HID++ reports on wireless device 1
Again, many things were done in this commit such as implementing an
I/O queue, a mutex_queue, and implementing the hidpp::Report class.

I'm expecting commits to be like this until I can get a clean
codebase for the backend.
2020-07-12 16:13:53 -04:00
pixl ec4ae56bc4 Implement raw DeviceMonitor
Multiple things have been done in this commit; the base of the new
backend has effectively been created. This branch currently has many
vital parts commented out. Therefore, this branch is currently only
intended for debugging.
2020-07-12 16:13:40 -04:00