SEO
NanoPi Neo Plus2 ethernet led disable
RTL8211E led control under linux
需求
使用NanoPi Neo Plus2开发办,希望关闭网卡指示灯。
探索
之前在树莓派3b上实现过,需要修改/boot/config.txt
对应friendlycore文档没有发现类似方法。
换个思路,参阅Schematic得知网卡LED分别为LNK和SPD且由板载RTL8211E直接控制。
既然没有系统层面/sys/class/leds
的直接抽象管理,只能通过驱动层面修改RTL8211E的寄存器实现功能。
实现
首先安装phytool工具获得MDIO register access
git clone https://github.com/wkz/phytool.git
cd phytool
make
sudo cp phytool /usr/bin
使用以下命令关闭LED
sudo -i
# set to extension page, extension Page44
phytool write eth0/0/31 0x0007
phytool write eth0/0/30 0x2c
# link rx/tx steady mode, no link up indicator
phytool write eth0/0/0x1a 0x0000
phytool write eth0/0/0x1c 0x0000
# switch to the PHY’s Page
phytool write eth0/0/31 0x0000
参考
Schematic_NanoPi_NEO_Plus2-v1.0-1704.pdf
Realtek RTL8211E(G)-VB(VL)-CG DataSheet 1.6
wkz/phytool: Linux MDIO register access
pine64-scripts/clusterboard-RTL8211E-led-ctrl.sh at master · pfeerick/pine64-scripts