You are not logged in.

#1 2004-07-02 20:54:28

correct
Member
Registered: 2004-07-01
Posts: 18

hotplug usb problem

When I boot my computer, I see a lot of script code of hotplug. It looks like the bash code  isn't executed. I want to use it for my scanner, such that non-root users can use the scanner.  I followed the wiki @ archlinux (http://wiki.archlinux.org/index.php/USB%20Scanner). Anyone having a setup that works?  Please post your relevant config files...

Offline

#2 2004-07-03 08:10:59

tpowa
Developer
From: Lauingen , Germany
Registered: 2004-04-05
Posts: 2,322

Re: hotplug usb problem

the new sane package has a preconfigured hotplug script
you have to change the permissions of the file
chmod 755 /etc/hotplug/usb/libusbscanner
and edit the libusbscanner file for your needs eg. :
#!/bin/sh

# This file is part of sane-backends.
#
# This script changes the permissions and ownership of a USB device under
# /proc/bus/usb to grant access to this device to users in the scanner group.
#
# Ownership is set to root:scanner, permissions are set to 0660.
#
# Arguments :
# -----------
# ACTION=[add|remove]
# DEVICE=/proc/bus/usb/BBB/DDD
# TYPE=usb

#if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then
#  chown root:users "$DEVICE"
#  chmod 0660 "$DEVICE"
#fi


# That's an insecure but simple alternative
# Everyone has access to the scanner

if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then
  chmod 0666 "$DEVICE"
fi

Offline

#3 2004-07-03 12:09:26

correct
Member
Registered: 2004-07-01
Posts: 18

Re: hotplug usb problem

Now, it does work, but only when I "hotplug". I read something about coldplugging, I have to figure out that. I just want that it works, without plugging the cable out and in.

Offline

#4 2004-07-03 12:26:11

tpowa
Developer
From: Lauingen , Germany
Registered: 2004-04-05
Posts: 2,322

Re: hotplug usb problem

hm
if you start hotplug by rc.conf it should work
rather strange don't know whats wrong with that
you rebooted your machine?

Offline

#5 2004-07-03 18:38:13

correct
Member
Registered: 2004-07-01
Posts: 18

Re: hotplug usb problem

Yes, I rebooted my computer. I am not that n00b anymore   big_smile

Offline

#6 2004-07-04 13:22:37

tpowa
Developer
From: Lauingen , Germany
Registered: 2004-04-05
Posts: 2,322

Re: hotplug usb problem

solution found for your coldplug problem :-)
do a sane-find-scanner after boot and scanner was turned on before boot
you get something like that:
found USB scanner (vendor=0x04b8 [EPSON], product=0x010b [Perfection1240]) at libusb:002:002
do as root:
chmod a+rw /proc/bus/usb/00x/00x
x means the number at the end
in my case:
chmod a+rw /proc/bus/usb/002/002
put that in your rc.local and all should work
or if you don't want you have to unplug and replug your scanner
or start your scanner after boot

Offline

#7 2004-07-04 21:03:40

correct
Member
Registered: 2004-07-01
Posts: 18

Re: hotplug usb problem

tpowa wrote:

solution found for your coldplug problem :-)
do a sane-find-scanner after boot and scanner was turned on before boot
you get something like that:
found USB scanner (vendor=0x04b8 [EPSON], product=0x010b [Perfection1240]) at libusb:002:002
do as root:
chmod a+rw /proc/bus/usb/00x/00x
x means the number at the end
in my case:
chmod a+rw /proc/bus/usb/002/002
put that in your rc.local and all should work
or if you don't want you have to unplug and replug your scanner
or start your scanner after boot

Thanks smile
Well, it works, but I don't think this is real coldplugging, or is it?
I consider this a hack. Don't you agree :?

Now *everything*(that's printer, scanner, sound(I just love ALSA), burner and all the standard stuff) works smile
That's some accomplishment.

I had RedHat 9->Debian->Gentoo->Arch, but this is the first distro on which it all actually works. This is probably caused by more experience wth Linux in general, but I am quite happy with it:)

Arch still has some problems, but I certainly can see some good points.

Offline

#8 2004-07-05 05:12:12

tpowa
Developer
From: Lauingen , Germany
Registered: 2004-04-05
Posts: 2,322

Re: hotplug usb problem

yeah it's a little hack from the sane README
but it works
i think it's a kernel or a hotplug problem in the end
my scanner is recognized by the kernel before hotplug starts
-->hotplug can't reset the permissions until it's replugged or set with the command in rc.local

Offline

#9 2004-07-12 21:30:20

filoktetes
Member
From: Skien, Norway
Registered: 2003-12-29
Posts: 287

Re: hotplug usb problem

This is a really poor hack; If I change usb slot, I'll have to change the rc.local again, woun't I?

I'm setting up a computer for my father. I'll have to find something better  :?

Offline

#10 2004-07-13 01:43:31

sarah31
Member
From: Middle of Canada
Registered: 2002-08-20
Posts: 2,975
Website

Re: hotplug usb problem

chmod a+rw /proc/bus/usb/* would cover it. of course you would have to rerun that command if you hotplug.


AKA uknowme

I am not your friend

Offline

#11 2004-07-13 05:11:22

tpowa
Developer
From: Lauingen , Germany
Registered: 2004-04-05
Posts: 2,322

Re: hotplug usb problem

i don't think you have to rerun if you have set up hotplug properly the problem is the "coldplug" that the kernel set the permissions so hotplug can reset the permissions after plug and unplug it but the command would perhaps help if you change your usb port often (i didn't check but if it works please post a bug that the sane package will be changed with the new command in sane.install)

Offline

#12 2004-07-13 05:22:49

sarah31
Member
From: Middle of Canada
Registered: 2002-08-20
Posts: 2,975
Website

Re: hotplug usb problem

well i don't use hotplug but i also use the same port each time so the chown line in rc.local works just fine for me. i only have to rerun my chown line if i unplug and replug. not a hassle really since i usually use my mac now which has brain free hotplugging smile


AKA uknowme

I am not your friend

Offline

#13 2004-07-13 05:29:31

tpowa
Developer
From: Lauingen , Germany
Registered: 2004-04-05
Posts: 2,322

Re: hotplug usb problem

i thought of replacing ;-)
chmod a+rw /proc/bus/usb/00x/00x
with
chmod a+rw /proc/bus/usb/*

Offline

Board footer

Powered by FluxBB