Page 2 of 2

Re: Scanners

Posted: Tue Sep 06, 2016 6:59 am
by ParisYank
Bravo, xfrank

I spent hours trying to solve this problem of XSane access to my Brother MFC-J870DW scanner on Linux Mint 18 Cinnamon.
$ sudo cd /dev/bus/usb/003
$ sudo chmod 666 002

or just:

$ sudo chmod 666 /dev/bus/usb/003/002

Scanimage need to fix the message when it can not access the scanner to have the right bus and dev number and also tell the user that the problem is a write access problem.
Your solution worked in 10 seconds after I identified the scanner bus & port. Thanks for your post. :D :shock: :D

Re: Scanners

Posted: Tue Feb 07, 2017 3:29 pm
by tlmcca
I'm running Linux Mint 17.3 Rosa Cinnamon and using a Brother MFC-L2700DW and I found a post identifying changing the <dev>/<bus> permissions to 666 as part of the set up for using xsane. That eliminated the "Invalid argument" error when starting xsane. However, the <dev>/<bus> assignment seems to change periodically even though I'm not rebooting or recabling the device. Since I was unable to find and correct the issue I wrote the following script to run out of root's crontab on a daily basis to assure permissions are set to 666:

#!/bin/bash
#
# This script changes permissions on the dev file associated with the multi-funcion printer
# to allow the xsane software access. The script must run as root passing on parameter which
# is used to identify the printer in the output from the lsusb command.
#
# The text which will identify the line from the lsusb output associated with the scanner is passed
# as the one and only parameter:
#
# /home/bin/change_permissions_for_MFP.bash Brother
#

echo "`date`" >> /home/terry/Documents/change_permissions_for_MFP_BUS-DEV_history.txt

if [ ${#*} -ne 1 ]
then
echo "There must be 1 and only parm passed" >> /home/terry/Documents/change_permissions_for_MFP_BUS-DEV_history.txt
exit
fi

BUS_DEV=`lsusb |grep $1 |tr -d ':' |awk '{print $2, $4}'`

if [ `echo $BUS_DEV |wc -w` -ne 2 ]
then
echo "Unexpected result from lsusb command" >> /home/terry/Documents/change_permissions_for_MFP_BUS-DEV_history.txt
exit
fi

BUS=`echo "$BUS_DEV" |awk '{print $1}'`
DEV=`echo "$BUS_DEV" |awk '{print $2}'`

echo "BUS=$BUS DEV=$DEV" >> /home/terry/Documents/change_permissions_for_MFP_BUS-DEV_history.txt

echo "State before chmod:" >> /home/terry/Documents/change_permissions_for_MFP_BUS-DEV_history.txt
ls -l /dev/bus/usb/$BUS/$DEV >> /home/terry/Documents/change_permissions_for_MFP_BUS-DEV_history.txt

chmod a+w /dev/bus/usb/$BUS/$DEV

echo "State after chmod:" >> /home/terry/Documents/change_permissions_for_MFP_BUS-DEV_history.txt
ls -l /dev/bus/usb/$BUS/$DEV >> /home/terry/Documents/change_permissions_for_MFP_BUS-DEV_history.txt


Feel free to use it if you wish and post any improvements.

Terry