Make "elive-health" run when detecting new scanner

I just installed a fresh 3.8.12 and expectadely my Brother printer/scanner needs to be configured again.
The printer part is easy enough but .......
the scanner will ONLY get recognized and configured if "elive-health" is invoked, either manually or by loging out and back in...after which it takes a fairly long time (less then previously, but still) to come up with the questions about installing the drivers, It does so flawlessly.

I have done this before so I know what to do but ...
Any other user would expect the scanner to be detected shortly after the plugin, like the printer.
Subsequently, considering scanners are expected to be troublesome, that user will start to rummage around the net for solutions with all the dire results that can have.
Logging in and out of E16 is hardly a logical thing to do IMO neither is running "elive-health".

There definitely needs to be a pop-up clearing things up as the current method just doesn't work.

Agree, this installing of scanner is just a small added feature, but needs a better implementation, not exactly "un elive-health" but more like moving it out to a trigger

Like you said, when scanner is detected, run the tool for installing it

Probably the best way is to detect it from an UDEV rule, try to boot in live mode (this is needed in order to make sure that is not detected thanks to an installed driver) and see what is the udev values that detects it, probably running this command or similar:

udevadm monitor --environment --udev

more tips about udev in udev - ArchWiki

After we know the exact values that detects it, we can probably call the conf tool to be opened :thinking:

I was actually thinking about scanners in general not this brother in particular.
Starting off from udev is probably the best way. :smiley_cat:

Yeah, the tool can be generic for any scanner or hardware, for now we have only the installer for this one probably.

In any case, will be needed to know the specific info given by udev and note them, maybe for make a parser or a specific call for each hardware

when you plug the scanner, which info is returned with this command?:

sudo udevadm monitor

OK, booted into live mode and ran the command.

I put the output of udevadm up as udev.txt where it doesn't look like a scanner is recognized at all.
I added relevant "dmesg" and "syslog" output.

When plugging in on my installed system (where the scanner is already installed)

KERNEL[786.938070] add /devices/pci0000:00/0000:00:14.0/usb2/2-2 (usb)
KERNEL[786.939625] add /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0 (usb)
KERNEL[786.939831] add /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.1 (usb)
KERNEL[786.939890] bind /devices/pci0000:00/0000:00:14.0/usb2/2-2 (usb)
UDEV [791.517759] add /devices/pci0000:00/0000:00:14.0/usb2/2-2 (usb)
KERNEL[791.532681] add /module/usblp (module)
UDEV [791.538417] add /module/usblp (module)
KERNEL[791.655273] add /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/usbmisc/lp1 (usbmisc)
KERNEL[791.655370] bind /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0 (usb)
KERNEL[791.655417] add /bus/usb/drivers/usblp (drivers)
UDEV [791.659597] add /bus/usb/drivers/usblp (drivers)
UDEV [796.658736] add /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.1 (usb)
KERNEL[796.908798] remove /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/usbmisc/lp1 (usbmisc)
KERNEL[796.908869] unbind /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0 (usb)
KERNEL[796.916490] add /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/usbmisc/lp1 (usbmisc)
KERNEL[796.916583] bind /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0 (usb)
UDEV [801.082951] add /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0 (usb)
UDEV [801.222897] bind /devices/pci0000:00/0000:00:14.0/usb2/2-2 (usb)
UDEV [801.226211] add /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/usbmisc/lp1 (usbmisc)
UDEV [801.229017] bind /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0 (usb)
UDEV [801.231089] remove /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/usbmisc/lp1 (usbmisc)
UDEV [801.232956] unbind /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0 (usb)
UDEV [801.235581] add /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/usbmisc/lp1 (usbmisc)
UDEV [801.237953] bind /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0 (usb)

hum, that's the hard part, and the one we need lol,

some examples on internet:

# Used to connet the HP Laserjet 1200 to Computer
BUS="usb", SYSFS{idProduct}="0317", SYSFS{idVendor}="03f0", NAME="hp_lj_1200", SYMLINK="usblp", GROUP="lp"

and

SUBSYSTEM=="usbmisc", SUBSYSTEMS=="usb", SUBSYSTEMS=="usb", ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="002a", GROUP="lp", MODE="0666"

the problem is that if we don't have more specific details, and if we do a too-much generic check (for example, everytime an USB is plugged), it can lead to a bottleneck of useless wasted resources, for example when restoring from suspension they are always re-connected, or sometimes from a laptop-mode-tools or something there's a loop of triggers of reconnecting

By other side, the actual system is a bit "human behaviour", so, if an user doesn't has its hardware working it may attempt a reboot, in the next desktop started the check & install is made so it will make it working (and, forever for this install). Yeah it is not perfect but at least makes it working where it was not, the question is now "how to make it better?"

Ok let's try something in more detail:

Can you do this?

  • boot in live mode (so, no drivers installed), and without the scanner connected
  • run this command: sudo udevadm monitor --udev --environment > /tmp/udev-logs.txt
  • plug the scanner, wait 20 seconds and press Ctrl + C, then send me the file to gofile. It will include all the detailed udev data in the moment you plugged it

maybe we can make it dynamically / auto working by default, at least for this scanner model :thinking:

Maybe it would be better to allow the user to run "elive-health" through a pop-up if a new USB-printer is recognized?
Something saying:
"A new printer is recognized, if it's a multipurpose device click "probe" to search for scanner drivers"
followed by a "Please wait" pop-up on click.

That at least will prevent an unneeded reboot or an internet search for presumed unavailable drivers. :thinking:

nope, the detection is pretty light and fast, is better to just run it in silent mode than annoy the user with popups asking for run it (the tool will simply exit if there's no printer, and after it is correctly installed it will not install it again)

my only concern is about too much "usb connection detections" that will trigger the tool for nothing, that's why I need more details in order to specify better -when- to run the tool:

Will do, once Ive moored the ship...could be a few hours more :madness:

OK, ran the asked command on a live session and connected the scanner.

I was a bit hasty and Elive still wasn't finished booting up ... i.e I suspect" elive-health" was still running as it immediately popped up a question about installing the scanner drivers.
So that was logged as "udev-log.txt" after which I waited (didn't install anything as the internet hadn't been configured yet) and re-insertedthe USB again ... that event is saved as "udev-log2.txt".

Both have been put up here:
https://gofile.io/d/IY8VZv

This upload does not exist

damn, I think it expired (25 days later...) :confused:

and those files are on my dead SSD, so not accessible anymore. :frowning_face: