Para resolver isso, faça os passos abaixo:
1. Crie o arquivo "scan_sd_reader.sh" em /etc/init.d/ e adicione o script abaixo:
Código: Selecionar todos
touch /etc/init.d/scan_sd_reader.sh
Código: Selecionar todos
#!/bin/bash
SCAN_FREQUENCY=2
function scan {
echo "Aguardando inserção de disco no leitor JMicron SD"
# Scan every few seconds for the reader until it is found
while true; do
sleep $SCAN_FREQUENCY
# break if the kernel sees the JMicron reader
pciscan=`lspci|grep JMicron`
if [ "$pciscan" != "" ]; then break; fi
sh -c "echo 1 > /sys/bus/pci/rescan" # rescan
done
echo "Leitor JMicron SD detectado, possivel disco inserido."
}
function stop {
for val in `pidof -x "$0"`; do if [ $ != $val ]; then kill $val ; fi ; done
}
function start {
$0 scan &disown
}
function restart {
stop
start
}
# start/stop
case "$1" in
start) start ;;
scan) scan ;;
stop) stop ;;
restart) restart ;;
force-reload) restart ;;
status) ;;
esac
exit 0
Código: Selecionar todos
chmod +x /etc/init.d/scan_sd_reader.sh
update-rc.d scan_sd_reader.sh defaults
Bom proveito
