尝试在内核2.6.35上以root权限运行以下命令会导致错误:
% echo 0000:00:03.0 > /sys/bus/pci/drivers/foo/bind
-bash: echo: write error: No such device
更新 设备确实存在于/ sys / bus / pci / devices /中,lspci的输出如下:
% lspci -v -s 0000:00:03.0
00:03.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
Subsystem: Intel Corporation PRO/1000 MT Desktop Adapter
Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 10
Memory at f0000000 (32-bit, non-prefetchable) [size=128K]
I/O ports at d010 [size=8]
Capabilities: <access denied>
Kernel driver in use: e1000
答案 0 :(得分:1)
我想我已经解决了这个问题。看来驱动程序首先需要取消绑定设备。
shell似乎还有用户权限处理重定向(echo ..&gt; / sys / bus / ..),'sudo'只处理命令,即'echo',但不处理后面的整个命令行它,因此它必须以这种方式执行:
% sudo sh -c "echo 0000:00:03.0 > /sys/bus/pci/drivers/foo/unbind"
% sudo sh -c "echo 0000:00:03.0 > /sys/bus/pci/drivers/foo_new/bind"