Re: sane-backends permission problems

2021-05-18 Thread Antoine Jacoutot
On Tue, May 18, 2021 at 10:42:22AM +0200, Antoine Jacoutot wrote:
> On Tue, May 18, 2021 at 10:39:34AM +0200, Antoine Jacoutot wrote:
> > On Mon, May 17, 2021 at 05:21:16PM -0400, Allan Streib wrote:
> > > Predrag Punosevac  writes:
> > > 
> > > > predrag@oko$ scanimage -L
> > > >
> > > > No scanners were identified. If you were expecting something different,
> > > > check that the scanner is plugged in, turned on and detected by the
> > > > sane-find-scanner tool (if appropriate). Please read the documentation
> > > > which came with this software (README, FAQ, manpages).
> > > 
> > > Had the same problem today. sane-find-scanner returned...
> > > 
> > > found USB scanner (vendor=0x04a9 [Canon], product=0x2206 [CanoScan], 
> > > chip=LM9832/3) at libusb:002:002
> > > 
> > > ...but scanimage -L found no scanners. This scanner uses the
> > > sane-plustek backend, so I added my user to the _saned group, and I had
> > > changed the ownership on (in my case) /dev/ugen0.* and /dev/usb2 per the
> > > sane-backends pkg-readme. Something else was wrong.
> > > 
> > > Running the the scanimage program under ktrace revealed:
> > > 
> > >   98418 scanimage NAMI  "/var/spool/lock/LCK..libusb:002:002"
> > >   98418 scanimage RET   open -1 errno 13 Permission denied
> > > 
> > > Looking at /ver/spool/lock, it appears that this lockfile should be
> > > created in the sane/ subdirectory instead?
> > > 
> > > $ ls -l /var/spool/lock/
> > > total 4
> > > drwxrwxr-x  2 root  _saned  512 May 17 16:12 sane
> > > 
> > > I don't see anything in /etc/sane.d/plustek.conf that implies that I can
> > > change the lockfile location, so not sure how to correct this?
> > 
> > That comes from libusb, not sane itself I think.
> 
> Scratch that.
> It is sane, I will have a look.

I've committed a fix.
Thanks.

-- 
Antoine



Re: sane-backends permission problems

2021-05-18 Thread Antoine Jacoutot
On Tue, May 18, 2021 at 10:39:34AM +0200, Antoine Jacoutot wrote:
> On Mon, May 17, 2021 at 05:21:16PM -0400, Allan Streib wrote:
> > Predrag Punosevac  writes:
> > 
> > > predrag@oko$ scanimage -L
> > >
> > > No scanners were identified. If you were expecting something different,
> > > check that the scanner is plugged in, turned on and detected by the
> > > sane-find-scanner tool (if appropriate). Please read the documentation
> > > which came with this software (README, FAQ, manpages).
> > 
> > Had the same problem today. sane-find-scanner returned...
> > 
> > found USB scanner (vendor=0x04a9 [Canon], product=0x2206 [CanoScan], 
> > chip=LM9832/3) at libusb:002:002
> > 
> > ...but scanimage -L found no scanners. This scanner uses the
> > sane-plustek backend, so I added my user to the _saned group, and I had
> > changed the ownership on (in my case) /dev/ugen0.* and /dev/usb2 per the
> > sane-backends pkg-readme. Something else was wrong.
> > 
> > Running the the scanimage program under ktrace revealed:
> > 
> >   98418 scanimage NAMI  "/var/spool/lock/LCK..libusb:002:002"
> >   98418 scanimage RET   open -1 errno 13 Permission denied
> > 
> > Looking at /ver/spool/lock, it appears that this lockfile should be
> > created in the sane/ subdirectory instead?
> > 
> > $ ls -l /var/spool/lock/
> > total 4
> > drwxrwxr-x  2 root  _saned  512 May 17 16:12 sane
> > 
> > I don't see anything in /etc/sane.d/plustek.conf that implies that I can
> > change the lockfile location, so not sure how to correct this?
> 
> That comes from libusb, not sane itself I think.

Scratch that.
It is sane, I will have a look.

-- 
Antoine



Re: sane-backends permission problems

2021-05-18 Thread Antoine Jacoutot
On Mon, May 17, 2021 at 05:21:16PM -0400, Allan Streib wrote:
> Predrag Punosevac  writes:
> 
> > predrag@oko$ scanimage -L
> >
> > No scanners were identified. If you were expecting something different,
> > check that the scanner is plugged in, turned on and detected by the
> > sane-find-scanner tool (if appropriate). Please read the documentation
> > which came with this software (README, FAQ, manpages).
> 
> Had the same problem today. sane-find-scanner returned...
> 
> found USB scanner (vendor=0x04a9 [Canon], product=0x2206 [CanoScan], 
> chip=LM9832/3) at libusb:002:002
> 
> ...but scanimage -L found no scanners. This scanner uses the
> sane-plustek backend, so I added my user to the _saned group, and I had
> changed the ownership on (in my case) /dev/ugen0.* and /dev/usb2 per the
> sane-backends pkg-readme. Something else was wrong.
> 
> Running the the scanimage program under ktrace revealed:
> 
>   98418 scanimage NAMI  "/var/spool/lock/LCK..libusb:002:002"
>   98418 scanimage RET   open -1 errno 13 Permission denied
> 
> Looking at /ver/spool/lock, it appears that this lockfile should be
> created in the sane/ subdirectory instead?
> 
> $ ls -l /var/spool/lock/
> total 4
> drwxrwxr-x  2 root  _saned  512 May 17 16:12 sane
> 
> I don't see anything in /etc/sane.d/plustek.conf that implies that I can
> change the lockfile location, so not sure how to correct this?

That comes from libusb, not sane itself I think.

-- 
Antoine



Re: sane-backends permission problems

2021-05-17 Thread Allan Streib
Predrag Punosevac  writes:

> predrag@oko$ scanimage -L
>
> No scanners were identified. If you were expecting something different,
> check that the scanner is plugged in, turned on and detected by the
> sane-find-scanner tool (if appropriate). Please read the documentation
> which came with this software (README, FAQ, manpages).

Had the same problem today. sane-find-scanner returned...

found USB scanner (vendor=0x04a9 [Canon], product=0x2206 [CanoScan], 
chip=LM9832/3) at libusb:002:002

...but scanimage -L found no scanners. This scanner uses the
sane-plustek backend, so I added my user to the _saned group, and I had
changed the ownership on (in my case) /dev/ugen0.* and /dev/usb2 per the
sane-backends pkg-readme. Something else was wrong.

Running the the scanimage program under ktrace revealed:

  98418 scanimage NAMI  "/var/spool/lock/LCK..libusb:002:002"
  98418 scanimage RET   open -1 errno 13 Permission denied

Looking at /ver/spool/lock, it appears that this lockfile should be
created in the sane/ subdirectory instead?

$ ls -l /var/spool/lock/
total 4
drwxrwxr-x  2 root  _saned  512 May 17 16:12 sane

I don't see anything in /etc/sane.d/plustek.conf that implies that I can
change the lockfile location, so not sure how to correct this?

Allan



Re: sane-backends permission problems

2020-06-09 Thread Maurice McCarthy
Hmm, interesting.
Thanks both



Re: sane-backends permission problems

2020-06-09 Thread Stuart Henderson
On 2020-06-09, Maurice McCarthy  wrote:
> Add your user to the operator group.
> Regards
>
>

operator is quite powerful, but it doesn't normally have access to
USB device nodes. It is mostly meant for backup operators, it has rw
access to tape devices and read access to disk device nodes in /dev.

i.e. group operator can scrabble through your disk looking for things
even when it doesn't have filesystem access permissions.




Re: sane-backends permission problems

2020-06-09 Thread Predrag Punosevac
Maurice McCarthy  wrote:

> Add your user to the operator group.
> Regards

Hi Maurice,

My user is already in the operator group and for that matter in wheel
group. However, your email made me poke little bit more into this issue.
These are the changes that coused the "problem" for me personally.

On 6.6 stable 

OpenBSD atlas.int.autonlab.org 6.6 GENERIC.MP#0 amd64

atlas# ls -l /dev/usb0 
crw-rw  1 root  wheel   61,   0 Oct 22  2019 /dev/usb0

atlas# ls -l /dev/ugen0*
crw-rw  1 root  wheel   63,   0 Oct 22  2019 /dev/ugen0.00
crw-rw  1 root  wheel   63,   1 Oct 22  2019 /dev/ugen0.01
crw-rw  1 root  wheel   63,   2 Oct 22  2019 /dev/ugen0.02
crw-rw  1 root  wheel   63,   3 Oct 22  2019 /dev/ugen0.03
crw-rw  1 root  wheel   63,   4 Oct 22  2019 /dev/ugen0.04
crw-rw  1 root  wheel   63,   5 Oct 22  2019 /dev/ugen0.05
crw-rw  1 root  wheel   63,   6 Oct 22  2019 /dev/ugen0.06
crw-rw  1 root  wheel   63,   7 Oct 22  2019 /dev/ugen0.07
crw-rw  1 root  wheel   63,   8 Oct 22  2019 /dev/ugen0.08
crw-rw  1 root  wheel   63,   9 Oct 22  2019 /dev/ugen0.09
crw-rw  1 root  wheel   63,  10 Oct 22  2019 /dev/ugen0.10
crw-rw  1 root  wheel   63,  11 Oct 22  2019 /dev/ugen0.11
crw-rw  1 root  wheel   63,  12 Oct 22  2019 /dev/ugen0.12
crw-rw  1 root  wheel   63,  13 Oct 22  2019 /dev/ugen0.13
crw-rw  1 root  wheel   63,  14 Oct 22  2019 /dev/ugen0.14
crw-rw  1 root  wheel   63,  15 Oct 22  2019 /dev/ugen0.15



On 6.7 stable

minix# ls -l /dev/usb0  
crw-r-  1 root  wheel   61,   0 Jun  8 22:16 /dev/usb0

minix# ls -l /dev/ugen0*
crw---  1 root  wheel   63,   0 Jun  8 22:16 /dev/ugen0.00
crw---  1 root  wheel   63,   1 Jun  8 22:16 /dev/ugen0.01
crw---  1 root  wheel   63,   2 Jun  8 22:16 /dev/ugen0.02
crw---  1 root  wheel   63,   3 Jun  8 22:16 /dev/ugen0.03
crw---  1 root  wheel   63,   4 Jun  8 22:16 /dev/ugen0.04
crw---  1 root  wheel   63,   5 Jun  8 22:16 /dev/ugen0.05
crw---  1 root  wheel   63,   6 Jun  8 22:16 /dev/ugen0.06
crw---  1 root  wheel   63,   7 Jun  8 22:16 /dev/ugen0.07
crw---  1 root  wheel   63,   8 Jun  8 22:16 /dev/ugen0.08
crw---  1 root  wheel   63,   9 Jun  8 22:16 /dev/ugen0.09
crw---  1 root  wheel   63,  10 Jun  8 22:16 /dev/ugen0.10
crw---  1 root  wheel   63,  11 Jun  8 22:16 /dev/ugen0.11
crw---  1 root  wheel   63,  12 Jun  8 22:16 /dev/ugen0.12
crw---  1 root  wheel   63,  13 Jun  8 22:16 /dev/ugen0.13
crw---  1 root  wheel   63,  14 Jun  8 22:16 /dev/ugen0.14
crw---  1 root  wheel   63,  15 Jun  8 22:16 /dev/ugen0.15


The device nodes' permissions have changed. I am too busy to go now
through CVS commits to pin point the date and the reason.

Cheers,
Predrag



Re: sane-backends permission problems

2020-06-09 Thread Maurice McCarthy
Add your user to the operator group.
Regards



Re: sane-backends permission problems

2020-06-08 Thread Predrag Punosevac
Predrag Punosevac wrote:

> Hi Misc,
> 
> I am trying for the first time to scan a document on
> 
> predrag@oko$ uname -a
> OpenBSD oko.int.bagdala2.net 6.7 GENERIC.MP#2 amd64
> 
> Can somebody familiar with the changes in permissions between releases
> and 6.6 and 6.7 help me out how to enable scanning for a non root user
> This is what I am talking about
> 
> predrag@oko$ scanimage -L
> 
> No scanners were identified. If you were expecting something different,
> check that the scanner is plugged in, turned on and detected by the
> sane-find-scanner tool (if appropriate). Please read the documentation
> which came with this software (README, FAQ, manpages).
> 
> 
> now as a root
> 
> predrag@oko$ doas scanimage -L
> doas (pred...@oko.int.bagdala2.net) password: 
> device `snapscan:libusb:000:003' is a EPSON EPSON Scanner flatbed
> scanner
> 
> 
> I can confirm that the scanning works as expected on 6.7 minus
> permission problem. Actually even changing permission on /dev/ugen* from
> current 600 to 660 (as it was on 6.6) would not allow me to use XSane
> for scanning.
> 
> Cheers,
> Predrag

Solved per pkg-readme of course :-)

predrag@oko$ pwd   
/usr/local/share/doc/pkg-readmes
predrag@oko$ cat sane-backends 
$OpenBSD: README,v 1.17 2019/12/14 13:02:28 ajacoutot Exp $

+---
| Running sane-backends on OpenBSD
+---

First read /usr/local/share/doc/sane-backends/PROBLEMS.

USB
===
Since USB scanning will be handled by libusb, you need to allow
the user access to the corresponding USB endpoint. To do so, find
where your scanner is attached to using:
$ usbdevs -v
then change the ownerships accordingly.

e.g.
  
Controller /dev/usb0:
  
<...>
  
addr 05: 03f0:4812 HP, Officejet 7500 E910
  
 high speed, self powered, config 1, rev 1.00, iSerialNumber
MY2793100Q05JB
 driver: umass0
  
 driver: ugen1
  

  
# chown  /dev/ugen1.* /dev/usb0

To preserve your changes after a system update, use rc.local(8).
Alternatively, hotplugd(8) attach/detach scripts can automate this.

You can grant multiple users direct access to the scanner by adding them
to the
_saned group and allowing access to its ugen(4) device.
e.g. chgrp _saned /dev/ugen1.* && chmod 660 /dev/ugen1.*