简体   繁体   English

更新同一 model 网络适配器之一的驱动程序

[英]Update driver for one of the same model network adapters

There are multiple network adapters of the same model in the target computer.目标计算机中存在同一个model的多个网卡。 As below, they are all Intel I211.如下,都是Intel I211。

PCI\VEN_8086&DEV_1539&SUBSYS_00008086&REV_03\0060E0FFFF6336A000
    Name: Intel(R) I211 Gigabit Network Connection
    Hardware IDs:
        PCI\VEN_8086&DEV_1539&SUBSYS_00008086&REV_03
        PCI\VEN_8086&DEV_1539&SUBSYS_00008086
        PCI\VEN_8086&DEV_1539&CC_020000
        PCI\VEN_8086&DEV_1539&CC_0200
    Compatible IDs:
        PCI\VEN_8086&DEV_1539&REV_03
        PCI\VEN_8086&DEV_1539
        PCI\VEN_8086&CC_020000
        PCI\VEN_8086&CC_0200
        PCI\VEN_8086
        PCI\CC_020000&DT_0
        PCI\CC_020000
        PCI\CC_0200&DT_0
        PCI\CC_0200
PCI\VEN_8086&DEV_1539&SUBSYS_00008086&REV_03\0060E0FFFF6336A100
    Name: Intel(R) I211 Gigabit Network Connection #2
    Hardware IDs:
        PCI\VEN_8086&DEV_1539&SUBSYS_00008086&REV_03
        PCI\VEN_8086&DEV_1539&SUBSYS_00008086
        PCI\VEN_8086&DEV_1539&CC_020000
        PCI\VEN_8086&DEV_1539&CC_0200
    Compatible IDs:
        PCI\VEN_8086&DEV_1539&REV_03
        PCI\VEN_8086&DEV_1539
        PCI\VEN_8086&CC_020000
        PCI\VEN_8086&CC_0200
        PCI\VEN_8086
        PCI\CC_020000&DT_0
        PCI\CC_020000
        PCI\CC_0200&DT_0
        PCI\CC_0200

How do I update driver for a specific one of these same model adapters by devcon, C++ or C#?如何通过 devcon、C++ 或 C# 更新这些相同 model 适配器中的特定一个的驱动程序? For example, update by the unique device instance ID ( ex: PCI\VEN_8086&DEV_1539&SUBSYS_00008086&REV_03\0060E0FFFF6336A100 )例如,通过唯一的设备实例 ID进行更新(例如:PCI\VEN_8086&DEV_1539&SUBSYS_00008086&REV_03\0060E0FFFF6336A100

Thanks谢谢

EDIT : I've searched APIs for this but they all use hardware ID to update the driver, which will update all of the same model adapters' drivers.编辑:我已经为此搜索了 API,但它们都使用硬件 ID来更新驱动程序,这将更新所有相同的 model 适配器的驱动程序。 Ex: C++'s UpdateDriverForPlugAndPlayDevicesA and devcon's update command.例如:C++ 的UpdateDriverForPlugAndPlayDevicesA和 devcon 的更新命令。

EDIT2 : The motivation of this issue is that we are using an RTOS (real-time OS, RTX64 ) and we want to establish a real-time network communication (EtherCAT connection) with other devices by the RTOS. EDIT2 :这个问题的动机是我们正在使用 RTOS(实时操作系统, RTX64 ),我们希望通过 RTOS 与其他设备建立实时网络通信(EtherCAT 连接)。 We need to update one of the adapters' driver to the driver provided by RTX64, so that this adapter can be used by it.我们需要将其中一个适配器的驱动程序更新为RTX64提供的驱动程序,以便它可以使用该适配器。

The only workable solution for us to just update one of them is using Windows' "Device Manager".我们只更新其中一个的唯一可行解决方案是使用 Windows 的“设备管理器”。 (There's no same model adapters in the below picture, it's just shows how to update by device manager manually) (下图中没有相同的model适配器,只是显示如何通过设备管理器手动更新) 在此处输入图像描述

We are asking our users to do this manual update after installing our software.我们要求我们的用户在安装我们的软件后进行此手动更新。 It's not convenient for them.这对他们来说并不方便。 So we are trying to find an automatic way to do this.所以我们正试图找到一种自动的方法来做到这一点。

Since Device Manager in Windows can do this, we suppose that there's an API can do this too.由于 Windows 中的设备管理器可以做到这一点,我们假设 API 也可以做到这一点。

This is not really a average Programmer Problem.这不是一个真正的普通程序员问题。

Driver Programming - as a subset of Realtime Programming - is a highly specialized field.驱动程序编程——作为实时编程的一个子集——是一个高度专业化的领域。 The average C# or C++ .NET Programmer will rarely have to deal with stuff like pointers and neer with assembler level code.普通的 C# 或 C++ .NET 程序员很少需要处理指针之类的东西,而无需处理汇编级代码。 But for those two, it is their daily bread and butter.但对于这两个人来说,这是他们的日常面包和黄油。 I can not give you little more then general advice:我不能给你更多的一般建议:

My first advice for you is to get somebody elses code to make that decision and installation.我对您的第一个建议是获取其他人的代码来做出决定和安装。 Usually drivers of one Manufacturer are distributed in packages.通常一个制造商的驱动程序以包的形式分发。 Wich do understand how to deal with idenitifcation of the hardware. Wich 确实了解如何处理硬件的识别。 Usually those installers also have a silent mode.通常这些安装程序也有静默模式。 So it comes down to calling them and intercepting the console output/looking for the return value.所以归结为调用它们并拦截控制台输出/寻找返回值。

My second advice , is to use their name as listed in the Device Manager.我的第二个建议是使用设备管理器中列出的名称。 Optionally get them renamed manually.可以选择手动重命名它们。 It is not that reliable as strings are quite patient and easily changed/missmatched, but it would get you somewhere to start from.它不是那么可靠,因为字符串非常有耐心并且很容易更改/不匹配,但它会让你从某个地方开始。

But as I understand it your problem is worse then just general driver updates.但据我了解,您的问题比一般驱动程序更新更糟糕。 You have two instances of the same Hardware, and want to use different drivers for each.您有两个相同硬件的实例,并希望为每个实例使用不同的驱动程序。 Wich is a order worse:更糟糕的是:

  1. I am not even sure this is possible .我什至不确定这是可能的 Since the driver folder still uses the good old "only one file of each name" approach, it is propable that you can not use different drivers for different instances of the same hardware.由于驱动程序文件夹仍然使用旧的“每个名称只有一个文件”方法,因此您可能无法对同一硬件的不同实例使用不同的驱动程序。 Unless you define your own driver storage location.除非您定义自己的驱动程序存储位置。

  2. I have no idea why you would do that.我不知道你为什么要那样做。 The average enduser programm does not need to worry about even selecting wich interface it will use.普通的最终用户程序甚至不需要担心选择它将使用的接口。 It just hands it's request off the to network stack and does not deal with layer 3 or below .它只是将它的请求从网络堆栈传递出去,而不处理第 3 层或更低的层。 Servers may have to pick a specific adapter to listen on, or just listen on both in paralell.服务器可能必须选择一个特定的适配器来监听,或者只是并行监听两者。 But even those do not care for the driver version in use.但即使是那些也不关心正在使用的驱动程序版本 They do not even care if it is a real, physical interface - after all missclassification like with early Bluetooth and Virtual Devices like for Virtual Machine Monitors/PDF printers are a thing.他们甚至不在乎它是否是一个真实的物理接口——毕竟像早期的蓝牙和虚拟设备(如虚拟机监视器/PDF 打印机)这样的错误分类是一回事。

So it honestly sounds like you got a XY Problem, with this idea being the (propably wrong) Y, to your real X.所以老实说,听起来你遇到了一个 XY 问题,这个想法对于你的真实 X 来说是(可能是错误的)Y。

Two workarounds.两种解决方法。 One minimizes manual customer interaction when updating the device driver, the other fully automates the process, but requires coding in a BASIC like language.一个在更新设备驱动程序时最大限度地减少手动客户交互,另一个完全自动化该过程,但需要使用类似 BASIC 的语言进行编码。

The first one consists on automatically showing the Hardware Update Wizard for that particular device instance, using the API function DiShowUpdateDevice as described in the previous link.第一个包括自动显示该特定设备实例的硬件更新向导,使用 API function DiShowUpdateDevice ,如上一个链接中所述。

The second one is to use the free AutoIt automation software.第二种是使用免费AutoIt自动化软件。 With it you can automate basically everything in a Windows system, it's very powerful and I've used it in conjunction with web bots and automatic web testing (non-headless).有了它,您基本上可以自动化 Windows 系统中的所有内容,它非常强大,我已经将它与 web 机器人和自动 web 测试(非无头)结合使用。 I've also used it in double-click roll-outs of Windows systems and many sysadmin tasks.我还在 Windows 系统和许多系统管理员任务的双击推出中使用了它。

As a remark, you could also mix both approaches.作为备注,您也可以混合使用这两种方法。 First, use DiShowUpdateDevice to show the wizard and then an AutoIt script can automatically perform UI interaction, the client won't have to do anything at all.首先,使用DiShowUpdateDevice显示向导,然后 AutoIt 脚本可以自动执行 UI 交互,客户端根本不需要做任何事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM