Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
/sys/bus/pci/rescan can only be enabled manually
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
thomai
n00b
n00b


Joined: 05 Jan 2015
Posts: 10

PostPosted: Fri Jan 09, 2015 10:19 am    Post subject: /sys/bus/pci/rescan can only be enabled manually Reply with quote

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 :wink: ). 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?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum