windows 插入USB设备时自动加载驱动程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5853095/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Make driver load automatically when USB device is inserted
提问by SamB
I'm using a Limited User account under Windows XP, and I'm having a bit of trouble getting my Adaptoid (the most coveted N64 controller -> USB adapter, because of it's support for sending raw N64 controller commands + the fact that it's been discontinued) to work smoothly: as installed, the included software requires Administrator privileges to load the driver.
我在 Windows XP 下使用受限用户帐户,但在获取 Adaptoid(最令人梦寐以求的 N64 控制器 -> USB 适配器,因为它支持发送原始 N64 控制器命令+事实上它是已停产)运行顺利:安装后,随附的软件需要管理员权限才能加载驱动程序。
Presumably, it is possible to arrange for the driver to be loaded automatically when the Adaptoid is inserted by adding some stuff to the INF file for the driver (wishna1.inf): the question is, whatstuff?
据推测,可以通过在驱动程序的 INF 文件(Wishna1.inf)中添加一些东西来安排在插入 Adaptoid 时自动加载驱动程序:问题是,什么东西?
(It would also suit me just as well if the driver could be automatically loaded when anything attempted to open \Device\Wish_NA1
, or even to have it automatically loaded at every boot, really, but doing it on insertion seems like the rightway.)
(如果驱动程序可以在任何尝试打开时自动加载\Device\Wish_NA1
,或者甚至在每次启动时自动加载,这也同样适合我,真的,但在插入时这样做似乎是正确的方法。)
Note:I do have access to an administrative account, it's just that I prefer not to have to useit day-to-day.
注意:我确实可以访问管理帐户,只是我不想每天都使用它。
回答by Ilya
First of all, let's clarify that a USB device has a Plug & Play driver on Windows 2000 and higher, so services start modes are irrelevant. The driver will have an entry as a "service" in the registry, but its start mode is irrelevant here.
首先,让我们澄清一下,USB 设备在 Windows 2000 及更高版本上具有即插即用驱动程序,因此服务启动模式无关紧要。驱动程序将在注册表中有一个作为“服务”的条目,但它的启动模式在这里无关紧要。
Let's split the problem into two parts:
让我们把问题分成两部分:
Installing driver for the device:This requires administrative privileges. This happens when you insert a USB device into a port for the first time. Windows goes over your .INF files to find one that matches your hardware. If the driver is WHQL-certified, it'll load automatically. Otherwise, you'd see the dreaded Add New Hardware wizard. If you're running as admin, a few clicks on Next should be enough to install it. Otherwise, better have that Administrator password ready.
Loading the driver for the device:Once the device is installed, the driver will be loaded each time thisdevice is inserted into thisUSB port without requiring any additional user intervention. Ever noticed how a USB printer, camera or disk drive load much faster the second time you plug it in? That's because that's just loading, without installing.
为设备安装驱动程序:这需要管理权限。第一次将 USB 设备插入端口时会发生这种情况。Windows 会检查您的 .INF 文件以找到与您的硬件匹配的文件。如果驱动程序经过 WHQL 认证,它将自动加载。否则,您会看到可怕的添加新硬件向导。如果您以管理员身份运行,单击“下一步”应该足以安装它。否则,最好准备好管理员密码。
加载设备驱动程序:安装设备后,每次将此设备插入此USB 端口时都会加载驱动程序,无需任何额外的用户干预。有没有注意到 USB 打印机、相机或磁盘驱动器在您第二次插入时加载速度要快得多?那是因为那只是加载,没有安装。
From looking at the .INF, it looks valid. Also, it's not WHQL-certified, so you'd have to install it manually.
从 .INF 来看,它看起来是有效的。此外,它没有经过 WHQL 认证,因此您必须手动安装它。
I'm assuming when you insert the Adaptoid, you get an Add New Hardware wizard. If you point it manually to the installation directory, does the Adaptoid install and function? Does it appear in the Device Manager?
我假设当您插入 Adaptoid 时,您会得到一个添加新硬件向导。如果您手动将其指向安装目录,Adaptoid 是否安装并运行?它是否出现在设备管理器中?
P.S. USB devices which have a serial number are an exception. They're installed once for allUSB ports. Those devices are rather uncommon, though.
具有序列号的 PS USB 设备是个例外。它们为所有USB 端口安装一次。不过,这些设备并不常见。