[CentOS] USB devices - libgphoto2 - PTP - hplip

Wed Dec 9 10:36:58 UTC 2015
Michael H <michael at wemoto.com>

Hi All,

I'm trying to disable USB storage devices in Centos7.1.1503.

I've setup udev rules to block all usb devices and then additional rules
to allow specific vendors / products to be used (mainly keyboards and
mice). This is all working perfectly.

cat /etc/udev/rules.d/01-usblockdown.rules
# Block all USB devices
ACTION=="add", SUBSYSTEMS=="usb", RUN+="/bin/sh -c 'for host in
/sys/bus/usb/devices/usb*; do echo 0 > $host/authorized_default; done'"
# Allow devices
# Keyboards
ACTION=="add", ATTR{idVendor}=="04f3", ATTR{idProduct}=="0103"
RUN+="/bin/sh -c 'echo 1 >/sys$DEVPATH/authorized'"

Now I'm testing against mobile devices and when I connect an Asus mobile
telephone it's mounting the camera using PTP even though the device is
not allowed in my udev rules.

I removed libgphoto2 which has now stopped the PTP from automounting.

My issue is that I require hplip on my systems for certain printer
drivers and this package was removed along with libgphoto2. I added an
'exclude=libgphoto2*' to my /etc/yum.repos.d/CentOS-Base.repo and
installing hplip now fails on dependencies.

Is there a method of disable libgphoto2 PTP without having to remove the
package? or can I create further udev rules to stop PTP mounts?

thanks in advance,