ST's STM32 Nucleo dev boards show up as a mass storage device on ubuntu by default. This is annoying and messes up flashing, so here's how to disable it. This should work for ST-LINK v1 - v3
Create a file stlink.conf
with
# Prevent ST-LINK from showing up as a USB disk
options usb-storage quirks=483:3744:i,483:374e:i
Note: To ignore multiple devices add them using a comma separated list NOT newlines
Now copy the file to /etc/modprobe.d/
.
sudo cp etc/modprobe.d/stlink.conf /etc/modprobe.d/
Verify that modprobe sees it by running modprobe -c | grep options
and make sure you see the lines from that file. You may need to reboot, or unplug the board and run rmmod uas
and rmmod usb_storage
.
Now run dmesg -w
and plug in the board and you should see "device ignored":
[ 1557.403841] usb 1-1: New USB device found, idVendor=0483, idProduct=374e, bcdDevice= 1.00
[ 1557.403845] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1557.403849] usb 1-1: Product: ST-LINK/V3
[ 1557.403852] usb 1-1: Manufacturer: STMicroelectronics
[ 1557.403854] usb 1-1: SerialNumber: xxx
[ 1557.462826] cdc_acm 1-1:1.2: ttyACM0: USB ACM device
[ 1557.497218] usb-storage 1-1:1.1: USB Mass Storage device detected
[ 1557.500314] usb-storage 1-1:1.1: device ignored
And the disk device notifier should not popup anymore.
Cheers!