The officially official Devuan Forum!

You are not logged in.

#1 Yesterday 23:17:36

vi.joe
Member
Registered: 2026-07-14
Posts: 4  

RTL9210 quirks

hi there !

you know those little enclosures to have ssd or nvme storage attached via usb ?

some are great ... some fail ...

long story, short ending ...

most times it's the RTL9210 built in firmware doing AUTOSUSPEND ... wtf ...

so .. keep that thingee alive ... ;-)

my solution:

# SysVinit
# --------

cat << 'EOF' > /etc/init.d/rtl9210-fix
#!/bin/sh
### BEGIN INIT INFO
# Provides:          rtl9210-fix
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Prevent autosuspend for Realtek RTL9210 adapters
# Description:       Read SMART every 10 seconds to prevent autosuspend
### END INIT INFO

DAEMON=/usr/local/sbin/rtl9210-fix.sh
INTERVAL=10

case "$1" in
  start)
    echo "Starting RTL9210 Autosuspend Fix ..."
    # Background Loop
    nohup /bin/bash -c \
      "while true; do $DAEMON; sleep $INTERVAL; done" >/dev/null 2>&1 &
    # remember PID
    echo $! > /var/run/rtl9210-fix.pid
    PID=$(cat /var/run/rtl9210-fix.pid 2>/dev/null)
    echo "Service rtl9210-fix active, PID: $PID"
    ;;
  stop)
    echo "Stopping RTL9210 Autosuspend Fix ..."
    PID=$(cat /var/run/rtl9210-fix.pid 2>/dev/null)
    if [ -n "$PID" ]; then
      echo "Service rtl9210-fix PID: $PID stopping"
      kill $PID
      rm -f /var/run/rtl9210-fix.pid
    fi
    ;;
  status)
    echo "Status RTL9210 Autosuspend Fix ..."
    PID=$(cat /var/run/rtl9210-fix.pid 2>/dev/null)
    if [ -z "$PID" ]; then
      echo "Service rtl9210-fix not active, no PID found"
    else
      echo "Service rtl9210-fix active, PID: $PID "
      smartctl --scan 2>/dev/null | grep -i realtek
    fi
    ;;
  restart)
    $0 stop
    $0 start
    ;;
  *)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
    ;;
esac

exit 0

# eof
EOF

chmod +x /etc/init.d/rtl9210-fix

# DAEMON
# ------

cat << 'EOF' > /usr/local/sbin/rtl9210-fix.sh
#!/bin/bash

# get all Storage Devices with Realtek Controller

disks=$(sudo smartctl --scan 2>/dev/null | grep -i realtek | sed 's/ .*$//')

if [ -z "$disks" ]; then
    exit 0
fi

for disk in $disks; do

    # read SMART Data to keep Realtek Device(s) "alive"

    smartctl -a $disk >/dev/null 2>&1

done

# eof
EOF

chmod +x /usr/local/sbin/rtl9210-fix.sh

# activate Service for all Runlevels
# ----------------------------------

update-rc.d rtl9210-fix defaults

any reactions are welcome ... ;-)

greets

Offline

Board footer