I have a question regarding the auto-mounting of my Nikon camera. When the camera is connected via USB the memory card of the camera is mounted and displays as a drive on the task bar. This causes conflict with tethering programs that need to take control of the camera. I can disable auto-mounting altogether using dconf, but it is a pain to keep turning it on and off all the time. How can just disable the behaviour for this camera alone and nothing else? Thanks in advance :)
Asked
Active
Viewed 2,426 times
1 Answers
0
Let's say your device is /dev/sdb1
. Using lsusb
get the ID of your device (it will be something like 0651:1722 or whatever)
Create a script called script.sh in /lib/udev
(you may have to use sudo
while creating the file) and put the following lines in it:
#!/bin/bash
udisks --unmount /dev/sdb1
udisks --detach /dev/sdb
Save it and make it executable with:
chmod +x /lib/udev/script.sh
Make a udev rule file called 100-unmount-SDcard.rules
in /etc/udev/rules.d/
(again you should use sudo
to create this file) and populate it with:
ACTION=="add", ATTRS{idVendor}=="<your-id>", ATTRS{idProduct}=="<your-id>", RUN+="/lib/udev/script.sh"
Save the file and run:
sudo udevadm control --reload-rules
For more options see Prevent a specific USB device from auto-mounting