better error dialog on receiver permission error; fixes #17

The problem is caused by starting Solaar right after installing it; while udev
does have the new rule loaded, the /dev/hidraw* device nodes already exist
with the old permissions.

Rather than doing a "udevadm --reload-rules" (which could have unknown side-
effects on other devices), instruct the user to remove and re-insert the usb
receiver. The new /dev/hidraw* device nods will be created with the right
permissions.
This commit is contained in:
Daniel Pavel 2013-05-05 10:35:03 +02:00
parent 1b4bf7918b
commit a4ec8ec05d
2 changed files with 8 additions and 7 deletions

View File

@ -69,11 +69,12 @@ def _run(args):
except OSError:
# permission error, blacklist this path for now
listeners.pop(device.path, None)
import logging
logging.exception("failed to open %s", device.path)
# ui.error_dialog(window, 'Permissions error',
# 'Found a possible Unifying Receiver device,\n'
# 'but did not have permission to open it.')
GLib.idle_add(ui.error_dialog, 'Permissions error',
'Found a Logitech Unifying Receiver device,\n'
'but did not have permission to open it.\n'
'\n'
'If you\'ve just installed Solaar, try removing\n'
'the receiver and plugging it back in.')
# elif action == 'remove':
# # we'll be receiving remove events for any hidraw devices,

View File

@ -37,8 +37,8 @@ from gi.repository import GLib, Gtk
GLib.threads_init()
def error_dialog(window, title, text):
m = Gtk.MessageDialog(window, Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE, text)
def error_dialog(title, text):
m = Gtk.MessageDialog(None, Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE, text)
m.set_title(title)
m.run()
m.destroy()