GM-Script-Writer-62850 / PHP-Scanner-Server

Allows you to use your Linux install as a web based scanner server thus allowing you to scan with any web enabled device; Now supports server side printing! (As of 1.4.11)
59 stars 17 forks source link

Scanner access enabler #24

Closed ghost closed 9 years ago

ghost commented 9 years ago

If a usb scanner is unplugged and plugged in again, the enabler needs to be run again. Can it be added to the udev rule ?

I presume then it would not be needed in /etc/rc.local

GM-Script-Writer-62850 commented 9 years ago

the udev rule should replace the enabler make sure you have the current version installed of the scanner software the ID of scanners can change (non-HP ones in my exp) i know at some point i made the scanner detected and change the id to the new one, before this was done you had to recheck for scanners to get it working

the udev rule is made by the main installer, not the updater

edit check your /etc/udev/rules.d/40-scanner.rules file for example on a ubuntu install

cat /etc/udev/rules.d/40-scanner.rules
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1606", ATTRS{idProduct}=="0060", ENV{libsane_matched}="yes", GROUP="lp"

that grants non root access to all users of the lp group (and unless my system i acting odd the lpadmin group also) the 1606 and 0060 can be found in the output of lsusb

ghost commented 9 years ago

The clone of this git repository is current. The scanner is a Canon, it is very new and does not have support in the current Ubuntu repositories. Support is via PPA at https://launchpad.net/~rolfbensch/+archive/ubuntu/sane-git

After unplugging and plugging in the scanner, running the udev rule script gives the following output:

You have rules, but something is different /etc/udev/rules.d/40-scanner.rules has:

---START-OF-FILE---

 1  Bus 004 Device 004: ID 04a9:190f Canon, Inc. 
#----END-OF-FILE----

These are the new rules:

---START-OF-FILE---

 1  Bus 004 Device 007: ID 04a9:190f Canon, Inc. 
#----END-OF-FILE----

No action taken, you can edit /etc/udev/rules.d/40-scanner.rules as you see fit

However, running the enabler allows it to work again.

GM-Script-Writer-62850 commented 9 years ago

the rule was not created cause the script avoids altering you existing configs however it looks like when i made that script i forgot to have it tell you the rule it would have added

if you had said rule it would/should work, but you lack said rule

edit: odd it looks like the script is dumping the lsusb output to it, guess the script is broken

GM-Script-Writer-62850 commented 9 years ago

http://pastebin.com/NTsSKR4z can you post the output of this one so i can find the issue?

ghost commented 9 years ago

Debug: genesys:libusb:004:007 Debug: 004:007 Debug: Bus 004 Device 007: ID 04a9:190f Canon, Inc. You have rules, but something is different /etc/udev/rules.d/40-scanner.rules has:

---START-OF-FILE---

 1  Bus 004 Device 004: ID 04a9:190f Canon, Inc. 
#----END-OF-FILE----

These are the new rules:

---START-OF-FILE---

 1  Bus 004 Device 007: ID 04a9:190f Canon, Inc. 
#----END-OF-FILE----

No action taken, you can edit /etc/udev/rules.d/40-scanner.rules as you see fit

ghost commented 9 years ago

The one with Device 004 would have been created when I first ran the script last weekend. Unplugging the scanner and plugging it in again gives it a new Device ID of 007

GM-Script-Writer-62850 commented 9 years ago

http://pastebin.com/n4jtv3Gk try that script see if it makes a rule that looks right and works if you don't want to make the file manually delete /etc/udev/rules.d/40-scanner.rules sudo rm /etc/udev/rules.d/40-scanner.rules your current file is useless and was made by my broken code, no idea when it broke but it did

ghost commented 9 years ago

chown: cannot access ‘/dev/bus/usb/04a9’: No such file or directory chown: cannot access ‘190f’: No such file or directory /etc/udev/rules.d/40-scanner.rules is good to go

looking in the usb devices: bananapi@lemaker:~/PHP-Scanner-Server$ ls /dev/bus/usb/00 001/ 002/ 003/ 004/ 005/

Each of these usb directories has a single file 001 listed as a character device:

bananapi@lemaker:~/PHP-Scanner-Server$ ls /dev/bus/usb/001/ -la total 0 drwxr-xr-x 2 root root 60 Jan 1 1970 . drwxr-xr-x 7 root root 140 Jan 1 1970 .. crw-rw-r-- 1 root root 189, 0 Jan 1 2010 001

GM-Script-Writer-62850 commented 9 years ago

try this one http://pastebin.com/fxytaDJG (nrv, not ready)

*the only scanner i have to test this is not plugged in and need BIOS settings changed

i think this is what you should have in the rule file

~$ cat /etc/udev/rules.d/40-scanner.rules
SUBSYSTEMS=="usb", ATTRS{idVendor}=="04a9", ATTRS{idProduct}=="190f", ENV{libsane_matched}="yes", GROUP="lp"
GM-Script-Writer-62850 commented 9 years ago

This one should work http://pastebin.com/fttFAj7x if it gives no errors and you can unplug and plug it back a few times without issues i will update the file to this one

ghost commented 9 years ago

The script at http://pastebin.com/fttFAj7x works. Configure, Search For Scanners button finds it.

I have removed the access enabler from running at boot. After rebooting, unplugging and plugging a few times, I can still scan.

GM-Script-Writer-62850 commented 9 years ago

Thanks for letting me know that script broke