LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Setting up a scanner in Slackware (https://www.linuxquestions.org/questions/slackware-14/setting-up-a-scanner-in-slackware-450939/)

Yalla-One 06-02-2006 11:33 AM

Setting up a scanner in Slackware
 
I just got my first Linux scanner, and need some help setting it up to work under Slackware.

sane-find-scanner gives:
Code:

found USB scanner (vendor=0x04a9 [Canon], product=0x221c [CanoScan], chip=GL841) at libusb:001:008
and when running "scanimage -L" as root I get
Code:

device `genesys:libusb:001:008' is a Canon LiDE 60 flatbed scanner
However, running it as a normal user does not work, which tells me there's a permissions problem, and chmod'ing it won't probably help after I reboot/unplug the device.

dmesg shows activity when I plug/unplug, and lsusb gives
Code:

Bus 001 Device 008: ID 04a9:221c Canon, Inc.
According to udev-howto, it's not possible to write udev rules for scanners, but the sane-documentation refers to udev frequently. I'm having a hard time finding out which is true..

I have not done any changes to /etc/sane.d/* files, but /etc/sane.d/genesys.conf contains my scanner, uncommented.

I'm on 2.6.15.7 vanilla on Slackware-current.

Anyone?

-Y1

jimX86 06-02-2006 12:14 PM

Is your user a member of the group "scanner"?

Yalla-One 06-02-2006 12:26 PM

Yes.

The problem is though that I don't know which devicefile the scanner corresponds to, and how to manipulate the permissions on that file.

/dev/usb contains only lp0

So my question remains - can I manipulate this with udev?

-Y1

Alien Bob 06-02-2006 01:27 PM

You could try this to mount the usbfs:
Code:

mount none -t usbfs /proc/bus/usb -o devgid=10,devmode=0660
and make yourself member of group 'wheel' (gid=10). This corresponds to this line in /etc/fstab:
Code:

usbfs            /proc/bus/usb    usbfs      devgid=10,devmode=0660        0  0
It is not elegant, but I have been trying to get the hotplug usbscanner scripts ported to usb and only had partial success. The above works for 'wheel' members, but it also gives access to all other USB devices (and you might not want that).

Eric

Old_Fogie 06-02-2006 02:37 PM

Hey Yalla, if you can please. Let us know how you make out. I'm looking to buy a scanner so I can use it with slackware, and they have that model here for 79 bux at a local store. Seems like a nice every day scanner to use. Thanks.

Yalla-One 06-02-2006 03:17 PM

Thanks for the input Eric,

I guess I could be blamed for putting the standards too high, but what I'd really really like is to be able to just have the scanner work automagically whenever it's plugged in, just like other USB devices... Mounting it means it'll be more complex than in Windows, and my (silly?) quest is to prove my Linux system is both easier and more userfriendly than Windows...

I added the following line to my /etc/udev/rules.d/10-local.rules
Code:

BUS="usb", SYSFS{product}="CanoScan", MODE="0666", SYMLINK="scanner"
This gave me /dev/scanner -> /dev/usbdev1.8 with permission 0666.
However, the scanner still only works for the super-user, which leads me to believe this is a userspace/sane problem rather than a udev/file permission problem.

I noticed that Slackware comes with 0.1.8 rather than the latest 0.1.12 (which according to Pat is because the lates version breaks kernel 2.4), so maybe that's where the problem is.

Will investigate and reporat back when/if I find something. This is an *annoying* problem, as permission-based issues such as programmes/systems functioning as root but breaking as normal users are normally so lame...

-Y1

jimX86 06-02-2006 07:21 PM

Quote:

Originally Posted by Yalla-One
I guess I could be blamed for putting the standards too high, but what I'd really really like is to be able to just have the scanner work automagically whenever it's plugged in, just like other USB devices...

That's how my usb scanner works.

Please be patient with me... I know I'm not answering your udev question and maybe I'm missing the point. My understanding is that hotplug uses the entries in libsane.usermap to detect the scanner, and then the libusbscanner script changes the device ownership to root:scanner. Why not just add an entry for your scanner to libsane.usermap and let hotplug take care of this?

allend 06-03-2006 01:36 AM

This sounds like the problem that I encountered with my Brother DCP-110C scanner/copier/printer. In my case the problem was resolved by adding this line to my /etc/fstab file.

scanner /proc/bus/usb usbfs auto,devmode=0666 0 0

Old_Fogie 06-03-2006 02:07 AM

I havent' done scanners before, but allend this line you typed
Quote:

/proc/bus/usb usbfs auto,devmode=0666 0 0
sounds almost like what we all have to do to get DRI working. I'm glad you mentioned it I'll make a note of it for myself.

Yalla-One 06-03-2006 03:36 AM

Once again plenty thanks to Alien_Bob and allend and the rest for coming to the rescue.

Adding a line to fstab was all it took and now the scanner works perfectly well for all users!

I guess I read the initial advise wrong, thinking each user would have to manually "mount" the scanner before it would function..

As I still don't understand the underlaying fundamentals of this, I would greatly appreciate if someone could point me towards where i can read up on how the architecture behind this system is designed, and why the scanner must be "mounted"...

Also - I noticed that the /etc/hotplug/usb/libsane.usermap does not contain an entry for my precice scanner, but /etc/sane.d/genesys.conf does - could this cause problems, or is one selectd over the other?
The sane.conf contains both my model (LiDE 60) as well as LiDE 50, 25 and 30. However, the libsane.usermap contains only the LiDE 50.

Thanks again!

-Y1

jimX86 06-03-2006 06:39 AM

Quote:

Originally Posted by Yalla-One
Also - I noticed that the /etc/hotplug/usb/libsane.usermap does not contain an entry for my precice scanner, but /etc/sane.d/genesys.conf does - could this cause problems, or is one selectd over the other?

Now I'm curious. I understand why changing fstab works. I've just never done it that way. The reason I like using hotplug is that it changes the permissions for just that specific device.

I think that the sane.d stuff recognizes your scanner but doesn't change any permissions. Hotplug does. Would you be up for confirming this? I'd be interested in knowing what happens if you comment out the new fstab line, add your scanner to libsane.usermap, and then plug the scanner in again.

Anyway, I'm glad it works for you now.

rkelsen 06-03-2006 07:28 PM

Quote:

Originally Posted by Yalla-One
Also - I noticed that the /etc/hotplug/usb/libsane.usermap does not contain an entry for my precice scanner

That's the problem.

When you plug in a USB scanner, hotplug searches thru the libsane.usermap file. If it finds a match, then it'll change the associated device's ownership to 'root:scanner'.

This obviously wasn't happening in your case, hence the inability to use the scanner as a normal user.

Personally, all I had to do was add my user to the 'scanner' group and it worked without having to do anything else. Our scanner is a CanoScan N1240U.

thick_guy_9 10-06-2007 09:38 AM

Guys,
Can someone summarize what needs to be done for Slackware 12?
I have read this thread, and want to setup a USB Canoscan N 656U under Slackware 12.

Many thanks

Alien Bob 10-06-2007 09:45 AM

Try adding yourself to the groups 'scanner' and 'plugdev' and see if it works.
Code:

gpasswd -a your_account scanner
gpasswd -a your_account plugdev

Add the correct name for "your_account" in the commands above.

Don't forget to logoff and login again after you added yourself to these groups if you are logged in at the time you run the commands. After that, also restart the messagebus:
Code:

/etc/rc.d/rc.messagebus reload
...and if X is running, restart your X session as well.

Eric

justwantin 10-06-2007 05:57 PM

I have been sharing a scanner from a slackware server for awhile now. The server is running Slack-11.0 with a 2.6 kernel. I have no doubt that the way I set up sane in 11.0 will work in 12.0. HPLIP worked just fine for my hp psc2355 on a single machine but sane with hpoj was the way I went for a shared scanner. After it's working on one box its not to hard to share it. Here are my notes (below) for setinng up the first box. The complete networking setup is here: http://www.turtlespond.net/scripts/s...t_server_notes.

Quote:

5. HPOJ and CUPS
As far as I know, my options are rather limited when it comes to networking my HP-PSC scanner. I can do it with Sane but I need hpoj to access the scanner across the lan. Hpoj is no longer in development and has been replaced by HPLIP but the source is still available and it is an easy compile and there is good documentation avaialble in the source's /doc directory. As of yet HPLIP can not be used to network HP scanners

All I need is is to untar the source, then cd into the directory and:

./configure --prefix=/usr
make
checkinstall
installpkg hpoj-0.91-i386-1.tgz

I'm lazy. In this instance I have let checkinstall make the slack pack for me.

After I have connected my two printers and turned them on I will run "ptal-init-setup" a CLI wizard used to set up hpoj-managed devices.

Note that ptal-init has to start before the print spooler (CUPS). I have made up an rc.hpoj script for starting hpoj.

#! /bin/bash
#
# Startup/shutdown script for hpoj
# Note: This script must start before cupsd.

case "$1" in
start)
echo "Starting hpoj"
echo "ptal-init start"
ptal-init start
echo "ptal-init start"
ptal-cups
;;
stop)
echo "Stopping hpoj"
ptal-init stop
;;

restart)
echo "Stopping hpoj"
ptal-init stop
echo "Restarting hpoj"
ptal-init start
;;

*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
;;
esac

exit $?

In order to get /etc/rc.d/rc.hpoj to run before /etc/rc.d/rc.cups put the following lines into /etc/rc.d/rc.M just befor the stanza for CUPS

# Start hpoj before CUPS:
if [ -x /etc/rc.d/rc.hpoj ]; then
/etc/rc.d/rc.hpoj start
fi

If you already have an hpoj stanza in rc.M make sure it is called befor CUPS.

Since I started ptal-init when I set up my devices I will have to restart CUPS "with /etc/rc/rc.cups restart" before I can open up my CUPS server at 192.168.1.1:631.

I will then have to delete any previously configured printers on the server and set up new ones because I will now access printers as ptal devices and not usb devices. For example, when configuring my HP-PSC , I would select "Device URI: ptal:/mlc:usb:PSC_2350_series".


All times are GMT -5. The time now is 04:50 PM.