Jan Dittmer wrote: > Jan Dittmer wrote: > >>Greg KH wrote: >> >> >>>Please just add the "rescan" support to fakephp, and everyone will be >>>happy... >> >> >>Well, I started to work on this for fun. What I currently have is a >>stand-alone module which rescans the pci bus on insert and enables >>previously disabled devices. This works (at least with my ieee1394 port). >>Problem is, that fakephp does not get notified about this new pci device >>and no new file is created in /sys/bus/pci/slots. So I'm going to add >>this rescan functionality directly to fakephp. >>Question is: where? My current idea is a fake hotplug slot "rescan" in >>/sys/bus/pci/slots , where you can write "1" into the "power" attribute. >>FWIW I've attached the standalone module and a kernel patch which rips >>out the pci_bus_add_device functionality from pci_bus_add_devices. > > > Well, here is a quick & dirty hack, which adds this function to > enable_slot in fakephp. So if you write "1" in the power attribute of > any slot, the whole bus gets rescanned (you still need the > pci_bus_add_device.patch from the previous mail). Well one last update. This version also handles deactivation of subfunctions correctly, ie. when the parent should be disabled, all subfunctions will be disabled first. Small demo: # modprobe fakephp # ls /sys/bus/pci/slots | grep "0000:04" 0000:04:02.0 0000:04:02.1 0000:04:02.2 0000:04:03.0 0000:04:03.1 # echo -n 0 > /sys/bus/pci/slots/0000\:04\:02.0/power # ls /sys/bus/pci/slots | grep "0000:04" 0000:04:03.0 0000:04:03.1 # echo -n 1 > /sys/bus/pci/slots/0000\:03\:01.0/power # ls /sys/bus/pci/slots | grep "0000:04" 0000:04:02.0 0000:04:02.1 0000:04:02.2 0000:04:03.0 0000:04:03.1 #lspci | grep "0000:04" 0000:04:02.0 Multimedia audio controller: Creative Labs SB Audigy (rev 03) 0000:04:02.1 Input device controller: Creative Labs SB Audigy MIDI/Game port (rev 03) 0000:04:02.2 FireWire (IEEE 1394): Creative Labs SB Audigy FireWire Port 0000:04:03.0 SCSI storage controller: Adaptec AHA-3960D / AIC-7899A U160/m (rev 01) 0000:04:03.1 SCSI storage controller: Adaptec AHA-3960D / AIC-7899A U160/m (rev 01) Sound plays fine afterwards. Actually this only works only once or twice. At some point the removal command will hang (but I suppose this is a problem with either snd-emu10k1 or ieee1394). Jan