:: Re: [DNG] vdev - scanner
Góra strony
Delete this message
Reply to this message
Autor: fsmithred
Data:  
Dla: Ralph Ronnquist, dng
Temat: Re: [DNG] vdev - scanner
On 08/16/2016 07:54 PM, Ralph Ronnquist wrote:
> fsmithred wrote on 17/08/16 09:34:
>> On 08/16/2016 12:49 PM, shraptor wrote:
>>> On 2016-08-16 18:19, shraptor wrote:
>>>> On 2016-08-16 18:11, shraptor wrote:
>>>>>> I got the scanner working.
>>>>>>
>>>>>> If I boot with udev, the scanner works, and the permissions on the
>>>>>> device
>>>>>> look like this:
>>>>>>
>>>>>> ls -l /dev/bus/usb/002/
>>>>>> crw-rw-r--+ 1 root root 189, 137 Aug 16 10:30 010
>>>>>>
>>>>>> and with vdev, it looks like this:
>>>>>> crw------- 1 root root 189, 131 Aug 16 10:39 004
>>>>>>
>>>>>> I changed the permissions and added myself to the scanner group (oops!)
>>>>>> and now xsane finds the scanner when I'm running vdev. I hope someone
>>>>>> knows what to do with this information, because I'm in new territory
>>>>>> here.
>>>>>> (and I don't know C.)
>>>>>>
>>>>>> If udevadm output for the scanner would help, I'll post it. The udev
>>>>>> rules
>>>>>> for scanners are in /lib/udev/rules.d/60-libsane.rules
>>>>>
>>>>>
>>>>> Maybe you should write a vdev action for your scanner
>>>>> on my system they actions are in /etc/vdev/actions
>>>>>
>>>>> for instance optical.act contains
>>>>>
>>>>> [vdev-action]
>>>>> event=any
>>>>> path=^sr[0-9]*$
>>>>> VAR_OPTICAL_OWNER=root
>>>>> VAR_OPTICAL_GROUP=optical
>>>>> VAR_OPTICAL_MODE=0660
>>>>> helper=optical.sh
>>>>> daemonlet=true
>>>>> if_exists=run
>>>>>
>>>>>
>>>>>
>>>>> No C is needed. Write something that matches path like for optical
>>>>> path=^sr[0-9]*$
>>>>> then set needed permissions and group and vdev will fix it for you
>>>>>
>>>>>
>>>>> When you succeed you may contribute that .act file for others, yeah?
>>>>
>>>>
>>>> Maybe you can use something like null.act
>>>>
>>>> [vdev-action]
>>>> event=add
>>>> path=^null$
>>>> VAR_PERMISSIONS_MODE=0666
>>>> helper=permissions.sh
>>>> if_exists=run
>>>>
>>>>
>>>>
>>>> I mean the permissions.sh
>>>>
>>>>
>>>> so something like
>>>>
>>>> scanner.act
>>>>
>>>> [vdev-action]
>>>> event=add
>>>> path=^null$
>>>
>>>> VAR_PERMISSIONS_MODE=0664
>>>> helper=permissions.sh
>>>> if_exists=run
>>>>
>>>> Dunnow wot path you should use but maybe you could figure it out?
>>>
>>>
>>> perhaps?
>>>
>>> scanner.act
>>>
>>> [vdev-action]
>>> event=add
>>> path=^bus/usb/1$
>>> VAR_OWNER=root
>>> VAR_GROUP=scanner
>>> VAR_PERMISSIONS_MODE=0664
>>> helper=permissions.sh
>>> if_exists=run
>>>
>>>
>>> Does debian use something like /dev/usbscanner0 or /dev/usb/scanner0?
>>> Then maybe a new helper scanner.sh is needed, like optical.sh?
>>>
>>> In the beginning of vdev creation we dreamt of a udev rules to vdev action
>>> parser
>>>
>>>
>>
>> I now have a better idea of what such dreams would entail. Getting close...
>>
>>
>> This mostly works. I can get the right permissions on the device, but when
>> I add the setfacl command, vdev fails. Error is "Invalid action" and it
>> lists /usr/etc/vdev/actions/scanner.act. If I run the command in the
>> console, it works correctly. I tried it with the command before and after
>> "if_exists=run".
>>
>>
>> [vdev-action]
>> event=add
>> path=^bus/usb/*/[001-999]
>> OS_SUBSYSTEM=usb
>> OS_TYPE=255/255/255
>> VAR_OWNER=root
>> VAR_GROUP=scanner
>> VAR_PERMISSIONS_MODE=0664
>> helper=permissions.sh
>> if_exists=run
>> command:/usr/bin/setfacl -m g:scanner:rw $VDEV_MOUNTPOINT/$VDEV_PATH
>>
>> Any ideas on how to get setfacl to work are welcome. Thanks.
>>
>
> devuan% which setfacl
> /bin/setfacl
>
> maybe? Ralph.


That's weird. When I run 'which setfacl' I'm told it's at
/usr/bin/setfacl. On further examination, that's a symlink to
/bin/setfacl. Changing it in the action file didn't make a difference.

Assuming this will eventually work, would daemonlet=true need to be added
to get vdev to deal with plugging and unplugging the scanner after boot?

-fsr