38 lines
1.2 KiB
Bash
38 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
if [ "$EUID" -ne 0 ]
|
|
then echo "Please run as root"
|
|
exit
|
|
fi
|
|
|
|
cat <<EOF > /lib/udev/rules.d/71-nrf.rules
|
|
ACTION!="add", SUBSYSTEM!="usb_device", GOTO="nrf_rules_end"
|
|
|
|
# Set /dev/bus/usb/*/* as read-write for all users (0666) for Nordic Semiconductor devices
|
|
SUBSYSTEM=="usb", ATTRS{idVendor}=="1915", MODE="0666"
|
|
|
|
# Flag USB CDC ACM devices, handled later in 99-mm-nrf-blacklist.rules
|
|
# Set USB CDC ACM devnodes as read-write for all users
|
|
KERNEL=="ttyACM[0-9]*", SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{idVendor}=="1915", MODE="0666", ENV{NRF_CDC_ACM}="1"
|
|
|
|
LABEL="nrf_rules_end"
|
|
EOF
|
|
|
|
cat <<EOF > /lib/udev/rules.d/99-mm-nrf-blacklist.rules
|
|
# 99-modemmmanager-acm-fix.rules
|
|
# Previously flagged nRF USB CDC ACM devices shall be ignored by ModemManager
|
|
ENV{NRF_CDC_ACM}=="1", ENV{ID_MM_CANDIDATE}="0", ENV{ID_MM_DEVICE_IGNORE}="1"
|
|
EOF
|
|
|
|
if [ -x /bin/systemctl ]; then
|
|
systemctl reload systemd-udevd.service || true
|
|
else
|
|
udevadm control --reload-rules || true
|
|
fi
|
|
udevadm trigger || true
|
|
|
|
cat <<EOF
|
|
Now install nrfutil from https://www.nordicsemi.com/Products/Development-tools/nRF-Util/Download#infotabs
|
|
as well as J-Link from https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack
|
|
EOF
|