首页 > 代码库 > 自定义USB设备名称及驱动名称

自定义USB设备名称及驱动名称

==================================需要解决的问题==================================

问题1:

当我们把设备接上电脑后,电脑会发现新的硬件,其硬件的名称是MF事先定义好的,我们就是要把它改掉!!

 

问题2:

在MF编译完成以后系统自带的USB DEVICE是“iMXS_a7e70ea2”,如在VS2010调试的时候(如图2)看起非常不爽,呵呵。。。

 

问题3:

当我们把USB驱动安装成功后,在我们的设备管理器中会看到新设备,但设备名字是不是我们想要的呢?(我用的是大石头的MFUSB驱动,呵呵,不好意啦)

 

 ==================================开始动工==================================

 问题1,问题2一起解决:

方法1:直接在原路径文件更改。

  1、打开C:\PK\Solutions\STM32Stamp\TinyCLR\TinyCLR.proj文件,约369行可以看到USB配置的项目所在的地址;

  <ItemGroup>    <RequiredProjects Include="$(SPOCLIENT)\DeviceCode\Drivers\Stubs\USB_Config\dotNetMF.proj" />    <DriverLibs Include="usb_pal_config_stub.$(LIB_EXT)" />  </ItemGroup>

  2、打开C:\PK\DeviceCode\Drivers\Stubs\USB_Config\usb_config_stub.cpp文件,注意不是“dotNetMf.proj”(呵呵。。。我就犯过这错,注意!)

打开文件从9行开始就是我们要找的东西了

//string descriptor#define     MANUFACTURER_NAME_SIZE  9   /* "Freescale" */// NOTE: Having more than (probably) 32 characters causes the MFUSB KERNEL driver// to *CRASH* which, of course, causes Windows to crash#define     PRODUCT_NAME_SIZE      30   /* "Micro Framework MXS Reference " */// NOTE: If these two strings are not present, the MFUSB KERNEL driver will *CRASH*// which, of course, causes Windows to crash#define     DISPLAY_NAME_SIZE       4   /* "iMXS" */#define     FRIENDLY_NAME_SIZE      8   /* "a7e70ea2" */

  3、现在改成我们自己的标识

//string descriptor#define     MANUFACTURER_NAME_SIZE  6   /* "Aipeli" */// NOTE: Having more than (probably) 32 characters causes the MFUSB KERNEL driver// to *CRASH* which, of course, causes Windows to crash#define     PRODUCT_NAME_SIZE      38   /* "Micro Framework STM32F103ZE Reference " */// NOTE: If these two strings are not present, the MFUSB KERNEL driver will *CRASH*// which, of course, causes Windows to crash#define     DISPLAY_NAME_SIZE       22   /* "STM32F103ZE FIRE BOARD" */#define     FRIENDLY_NAME_SIZE      8   /* "a7e70ea2" */   //这一行改不改无所谓,自己看着办

 

自定义USB设备名称及驱动名称