thomai n00b

Joined: 05 Jan 2015 Posts: 10
|
Posted: Fri Jan 09, 2015 10:19 am Post subject: /sys/bus/pci/rescan can only be enabled manually |
|
|
Hey!
My gentoo box didn't detect "hot-plugged" SD-Cards, so I found out, that I have to "echo 1 > /sys/bus/pci/rescan" to enable this feature.
Short version
I have to execute that command manually in a gnome-terminal otherwise it doesn't work, even it doesn't report any errors.
Long version
Since I didn't want to do this every time after inserting a card into the card reader, I wrote a script which should do that job for me on every boot. Easy - I thought.
Code: |
#!/bin/bash
LOG=/var/log/user.log
DATE=`date +"%y-%m-%d %H:%M:%S"`
echo 1 > /sys/bus/pci/rescan
ERROR=$?
if [ $ERROR -gt 0 ]
then
echo "$DATE Error $ERROR while enabling PCI Rescan" >> $LOG
else
echo "$DATE PCI Rescan enabled" >> $LOG
fi
|
If I execute that script manually (sudo script.sh) it works as expected.
Now, I wanted systemd to execute it on every start, so I added a new service and regarding to the log, the command got executed successfully BUT the feature seems not to be enabled.
Code: |
[Unit]
Description=Enables PCI Rescanning (for SD-Card detection)
After=display-manager.service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/enablePciRescan
[Install]
WantedBy=multi-user.target
|
Okay, I thought. Maybe I have to run that script after everything has loaded. So I created a gnome3 autorun entry, which executes the script exactly the same way as I would do it manually in the gnome-terminal (yes, with sudo ). Same thing. Successful log entry but the feature is still not activated until I run the same script manually (from gnome-terminal)
I even tried to "sleep 10" before execution so I can see the script running after autostart - no errors, but the feature is still not activated.
Whats wrong? Where's the difference? Any suggestions? |
|