Repository: pwr-Solaar/Solaar

Issue:
installation problem: time_ns requires Python 3.7
I am using Ubuntu 18.04 and I am not able to make solaar work (even if I succeeded on another computer with Ubuntu a few months ago...).
I cloned the repository and followed the installation instructions but I am not able to install one of the dependecies: hid-logitech-dj. The command `sudo apt install hid-logitech-dj` gives me: Unable to locate package hid-logitech-dj. Was this package removed from the repositories recently? 

Do you know how I could install it? I was not able to find any help with google. 
It just lead me to a file [hid-logitech-dj.c](https://github.com/torvalds/linux/blob/master/drivers/hid/hid-logitech-dj.c) but I don't know what to do with it.

Without this package, I get the following error: 

```
solaar: error: Traceback (most recent call last):
  File "/home/zach/.local/lib/python3.6/site-packages/solaar/cli/__init__.py", line 198, in run
    c = list(_receivers(hidraw_path))
  File "/home/zach/.local/lib/python3.6/site-packages/solaar/cli/__init__.py", line 104, in _receivers
    from logitech_receiver import Receiver
  File "/home/zach/.local/lib/python3.6/site-packages/logitech_receiver/__init__.py", line 36, in <module>
    from . import listener, status  # noqa: F401
  File "/home/zach/.local/lib/python3.6/site-packages/logitech_receiver/listener.py", line 28, in <module>
    from . import base as _base
  File "/home/zach/.local/lib/python3.6/site-packages/logitech_receiver/base.py", line 39, in <module>
    from .base_usb import ALL as _RECEIVER_USB_IDS
  File "/home/zach/.local/lib/python3.6/site-packages/logitech_receiver/base_usb.py", line 32, in <module>
    from .descriptors import DEVICES as _DEVICES
  File "/home/zach/.local/lib/python3.6/site-packages/logitech_receiver/descriptors.py", line 27, in <module>
    from .settings_templates import FeatureSettings as _FS
  File "/home/zach/.local/lib/python3.6/site-packages/logitech_receiver/settings_templates.py", line 27, in <module>
    from solaar.ui import notify as _notify
  File "/home/zach/.local/lib/python3.6/site-packages/solaar/ui/__init__.py", line 29, in <module>
    from logitech_receiver.status import ALERT  # NOQA: E402 # isort:skip
  File "/home/zach/.local/lib/python3.6/site-packages/logitech_receiver/status.py", line 29, in <module>
    from . import settings as _settings
  File "/home/zach/.local/lib/python3.6/site-packages/logitech_receiver/settings.py", line 27, in <module>
    from time import time_ns as _time_ns
ImportError: cannot import name 'time_ns'
```


Discussion:

Resolving patch:
diff --git a/lib/logitech_receiver/settings.py b/lib/logitech_receiver/settings.py
--- a/lib/logitech_receiver/settings.py
+++ b/lib/logitech_receiver/settings.py
@@ -24,7 +24,9 @@
 from copy import copy as _copy
 from logging import DEBUG as _DEBUG
 from logging import getLogger
-from time import time_ns as _time_ns
+## use regular time instead of time_ns so as not to require Python 3.7
+# from time import time_ns as _time_ns
+from time import time as _time
 
 from . import hidpp20 as _hidpp20
 from . import special_keys as _special_keys
@@ -1093,7 +1095,7 @@ def push_mouse_event(self):
     def handle_move_event(self, dx, dy):
         # This multiplier yields a more-or-less DPI-independent dx of about 5/cm
         # The multiplier could be configurable to allow adjusting dx
-        now = _time_ns() / 1e6
+        now = _time() * 1000  # _time_ns() / 1e6
         dpi = self.dpiSetting.read() if self.dpiSetting else 1000
         dx = float(dx) / float(dpi) * 15.
         self.dx += dx
@@ -1113,7 +1115,7 @@ def handle_keys_event(self, cids):
                 self.fsmState = 'pressed'
                 self.dx = 0.
                 self.dy = 0.
-                self.lastEv = _time_ns() / 1e6
+                self.lastEv = _time() * 1000  # _time_ns() / 1e6
                 self.skip = True
         elif self.fsmState == 'pressed' or self.fsmState == 'moved':
             if self.key not in cids:
@@ -1135,7 +1137,7 @@ def handle_keys_event(self, cids):
                     self.data.append(1)
                     self.data.append(list(last)[0])
                     self.data[0] += 1
-                    self.lastEv = _time_ns() / 1e6
+                    self.lastEv = _time() * 1000  # _time_ns() / 1e6
                     return True
 
 


Test patch: