This implements the suggested approach for disconnecting the LAN port of the NanoPi R2S.
Basically, the LAN port of the NanoPi R2S is a USB device and there's a GPIO pin that controls the 5V power supply to that device. This gpio pin is by default claimed by the vcc_rtl8153 regulator, so no luck controlling the pin directly from userspace. When a regulator has no consumers (nobody which uses it), it will automatically turn off. That is, unless the always-on property is set, which is true for the NanoPi R2S.
The trick is to remove the always-on property from the device tree and use a reg-userspace-consumer device to control whether this regulator should be switched on or not.
This requires changes to the NanoPi R2S device tree, a custom kernel config, and a small wrapper script to mimic the hub-ctrl tool used by Znail.
This implements the suggested approach for disconnecting the LAN port of the NanoPi R2S.
Basically, the LAN port of the NanoPi R2S is a USB device and there's a GPIO pin that controls the 5V power supply to that device. This gpio pin is by default claimed by the
vcc_rtl8153
regulator, so no luck controlling the pin directly from userspace. When a regulator has no consumers (nobody which uses it), it will automatically turn off. That is, unless thealways-on
property is set, which is true for the NanoPi R2S.The trick is to remove the
always-on
property from the device tree and use areg-userspace-consumer
device to control whether this regulator should be switched on or not.This requires changes to the NanoPi R2S device tree, a custom kernel config, and a small wrapper script to mimic the hub-ctrl tool used by Znail.