使用自定义 INF 的微控制器的 USB 驱动程序安装问题

2024-03-28

我正在使用 NXP LPC1788 微控制器,并尝试在主机上创建一个驱动程序以通过 USB 与其进行通信。我相信我已经设法让设备正确处理标准 USB 请求(PC 能够正确读取字符串描述符)。

不过,我在编写示例 USB 驱动程序并为设备安装它时遇到了麻烦。我正在使用 Microsoft Visual Studio 2013。我的步骤是:

  • 创建一个 WinUSB 应用程序,生成“驱动程序”和“驱动程序包”项目。

  • 修改生成的 INF 文件以使用我的设备的 VID 和 PID。

  • 构建项目 - 均构建成功。输出文件夹包含 INF 文件、目录文件和 WdfCoinstaller01011.dll。

  • 通过 USB 插入微控制器,然后装置经理更新驱动软件...,浏览到包含 INF 文件的文件夹并选择它。

  • 这会导致出现以下屏幕:

  • 我选择“仍然安装此驱动程序软件”。过了一会儿,出现这样的画面:

我的INF文件如下:

;
; TestCubeDriver.inf
;
; Installs WinUsb
;

[Version]
Signature = "$Windows NT$"
Class     = USBDevice
ClassGUID = {88BAE032-5A81-49f0-BC3D-A4FF138216D6}
Provider = %ManufacturerName%
CatalogFile=TestCubeDriver.cat
DriverVer=04/16/2014,15.55.4.44

; ========== Manufacturer/Models sections ===========

[Manufacturer]
%ManufacturerName% = Standard,NTamd64

[Standard.NTamd64]
%DeviceName% =USB_Install, USB\VID_0483&PID_5720

; ========== Class definition ===========

[ClassInstall32]
AddReg = ClassInstall_AddReg

[ClassInstall_AddReg]
HKR,,,,%ClassName%
HKR,,NoInstallClass,,1
HKR,,IconPath,%REG_MULTI_SZ%,"%systemroot%\system32\setupapi.dll,-20"
HKR,,LowerLogoVersion,,5.2

; =================== Installation ===================

[USB_Install]
Include=winusb.inf
Needs=WINUSB.NT

[USB_Install.Services]
Include=winusb.inf
AddService=WinUsb,0x00000002,WinUsb_ServiceInstall

[WinUsb_ServiceInstall]
DisplayName     = %WinUsb_SvcDesc%
ServiceType     = 1
StartType       = 3
ErrorControl    = 1
ServiceBinary   = %12%\WinUSB.sys

[USB_Install.HW]
AddReg=Dev_AddReg

[Dev_AddReg]
; By default, USBDevice class uses iProduct descriptor to name the device in
; Device Manager on Windows 8 and higher.
; Uncomment for this device to use %DeviceName% on Windows 8 and higher:
;HKR,,FriendlyName,,%DeviceName%
HKR,,DeviceInterfaceGUIDs,0x10000,"{fcb251a5-6a1f-4e5b-9df8-e8de91d04cfe}"

[USB_Install.CoInstallers]
AddReg=CoInstallers_AddReg
CopyFiles=CoInstallers_CopyFiles

[CoInstallers_AddReg]
HKR,,CoInstallers32,0x00010000,"WdfCoInstaller01011.dll,WdfCoInstaller"

[CoInstallers_CopyFiles]
WdfCoInstaller01011.dll

[DestinationDirs]
CoInstallers_CopyFiles=11

; ================= Source Media Section =====================

[SourceDisksNames]
1 = %DiskName%

[SourceDisksFiles]
WdfCoInstaller01011.dll=1

; =================== Strings ===================

[Strings]
ManufacturerName=""
ClassName="Universal Serial Bus devices"
DiskName="TestCubeDriver Installation Disk"
WinUsb_SvcDesc="WinUSB Driver"
DeviceName="TestCubeDriver Device"
REG_MULTI_SZ = 0x00010000

.

给出了我的 setupapi.dev.log 文件的相关部分here http://pastebin.com/skP60hCj。以下类型的行在日志中多次出现:

     sig:                               Key      = testcubedriver.inf
     sig:                               FilePath = C:\Windows\System32\DriverStore\Temp\{1bf7c0e3-30cb-6135-d9b8-7d1ac87a6c7c}\testcubedriver.inf
     sig:                               Catalog  = C:\Windows\System32\DriverStore\Temp\{1bf7c0e3-30cb-6135-d9b8-7d1ac87a6c7c}\TestCubeDriver.cat
!    sig:                               Verifying file against specific (valid) catalog failed! (0x800b0109)
!    sig:                               Error 0x800b0109: A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.

还出现了以下内容:

     ndv:                Installing device...
     dvi:                {DIF_INSTALLDEVICE} 09:58:11.087
     dvi:                     No class installer for 'TestCubeDriver Device'
     dvi:                     CoInstaller 1: Enter 09:58:11.087
     inf:                          Opened PNF: 'C:\Windows\INF\oem68.inf' ([strings])
!!!  dvi:                     CoInstaller 1: failed(0xe0000101)!
!!!  dvi:                     Error 0xe0000101: The required section was not found in the INF.
     dvi:                {DIF_INSTALLDEVICE - exit(0xe0000101)} 09:58:11.907
!!!  ndv:                Error(e0000101) installing device!

.

我对 USB 设备使用以下描述符:

/*----------------------------------------------------------------------------
 *      U S B  -  K e r n e l
 *----------------------------------------------------------------------------
 *      Name:    USBDESC.C
 *      Purpose: USB Descriptors
 *      Version: V1.10
 *----------------------------------------------------------------------------
 *      This software is supplied "AS IS" without any warranties, express,
 *      implied or statutory, including but not limited to the implied
 *      warranties of fitness for purpose, satisfactory quality and
 *      noninfringement. Keil extends you a royalty-free right to reproduce
 *      and distribute executable files created using this software for use
 *      on NXP Semiconductors LPC family microcontroller devices only. Nothing
 *      else gives you the right to use this software.
 *
 *      Copyright (c) 2005-2009 Keil Software.
 *---------------------------------------------------------------------------*/
#include "lpc_types.h"
#include "usb.h"
#include "usbcore.h"
#include "usbhw.h"

/* USB Standard Device Descriptor */
const uint8_t USB_DeviceDescriptor[] = {
  USB_DEVICE_DESC_SIZE,              /* bLength */
  USB_DEVICE_DESCRIPTOR_TYPE,        /* bDescriptorType */
  WBVAL(0x0200), /* 2.00 */          /* bcdUSB */
  0xFF,                              /* bDeviceClass */
  0x00,                              /* bDeviceSubClass */
  0x00,                              /* bDeviceProtocol */
  USB_MAX_PACKET_SIZE,               /* bMaxPacketSize0 */
  WBVAL(0x0483),                     /* idVendor */
  WBVAL(0x5720),                     /* idProduct */
  WBVAL(0x0100), /* 1.00 */          /* bcdDevice */
  0x04,                              /* iManufacturer */
  0x30,                              /* iProduct */
  0x42,                              /* iSerialNumber */
  0x01                               /* bNumConfigurations */
};

/* USB Configuration Descriptor */
/*   All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
const uint8_t USB_ConfigDescriptor[] = {
/* Configuration 1 */
  USB_CONFIGURATION_DESC_SIZE,       /* bDescriptorType */
  USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
  WBVAL(                             /* wTotalLength */
    1*USB_CONFIGURATION_DESC_SIZE +
    1*USB_INTERFACE_DESC_SIZE     +
    2*USB_ENDPOINT_DESC_SIZE
  ),
  0x01,                              /* bNumInterfaces */
  0x01,                              /* bConfigurationValue */
  0x00,                              /* iConfiguration */
  USB_CONFIG_SELF_POWERED /*|*/      /* bmAttributes */
/*USB_CONFIG_REMOTE_WAKEUP*/,
  USB_CONFIG_POWER_MA(100),          /* bMaxPower */
/* Interface 0, Alternate Setting 0, MSC Class */
  USB_INTERFACE_DESC_SIZE,           /* bLength */
  USB_INTERFACE_DESCRIPTOR_TYPE,     /* bDescriptorType */
  0x00,                              /* bInterfaceNumber */
  0x00,                              /* bAlternateSetting */
  0x02,                              /* bNumEndpoints */
  0xFF,                              /* bInterfaceClass */
  0x0,                               /* bInterfaceSubClass */
  0x0,                               /* bInterfaceProtocol */
  0x5C,                              /* iInterface */
/* Interrupt In Endpoint */
  USB_ENDPOINT_DESC_SIZE,            /* bLength */
  USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType */
  USB_ENDPOINT_IN(2),                /* bEndpointAddress */
  USB_ENDPOINT_TYPE_INTERRUPT,       /* bmAttributes */
  WBVAL(0x0040),                     /* wMaxPacketSize */
  0xA,                               /* bInterval */
/* Interrupt Out Endpoint */
  USB_ENDPOINT_DESC_SIZE,            /* bLength */
  USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType */
  USB_ENDPOINT_OUT(2),               /* bEndpointAddress */
  USB_ENDPOINT_TYPE_INTERRUPT,       /* bmAttributes */
  WBVAL(0x0040),                     /* wMaxPacketSize */
  0xA,                               /* bInterval */
/* Terminator */
  0                                  /* bLength */
};

/* USB String Descriptor (optional) */
const uint8_t USB_StringDescriptor[] = {
/* Index 0x00: LANGID Codes */
  0x04,                              /* bLength */
  USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
  WBVAL(0x0409), /* US English */    /* wLANGID */
/* Index 0x04: Manufacturer */
  0x2C,                              /* bLength */
  USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
  'A',0,
  'T',0,
  'P',0,
  ' ',0,
  'I',0,
  'n',0,
  'd',0,
  'u',0,
  's',0,
  't',0,
  'r',0,
  'i',0,
  'e',0,
  's',0,
  ' ',0,
  'G',0,
  'r',0,
  'o',0,
  'u',0,
  'p',0,
  ' ',0,
/* Index 0x30: Product */
  0x12,                              /* bLength */
  USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
  'T',0,
  'e',0,
  's',0,
  't',0,
  'C',0,
  'u',0,
  'b',0,
  'e',0,
  ' ',0,
/* Index 0x42: Serial Number */
  0x1A,                              /* bLength */
  USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
  'D',0,
  'E',0,
  'M',0,
  'O',0,
  '0',0,
  '0',0,
  '0',0,
  '0',0,
  '0',0,
  '0',0,
  '0',0,
  '0',0,
/* Index 0x5C: Interface 0, Alternate Setting 0 */
  0x0E,                              /* bLength */
  USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
  'M',0,
  'e',0,
  'm',0,
  'o',0,
  'r',0,
  'y',0,
};

我尝试了 Daniel K 建议的 INF 模板here https://stackoverflow.com/questions/13134934/winusb-installation用我自己的配置:

;This .inf file is a modified version of the example INF provided
;in the Microsoft document:
;"How to Use WinUSB to Communicate with a USB Device"


[Version]
Signature = "$Windows NT$"
Class = USBDevices
ClassGuid= {88BAE032-5A81-49f0-BC3D-A4FF138216D6}
Provider = %MFGNAME%
DriverVer=04/17/2014,1.0.0.0
CatalogFile=winusb.cat    ;CAT file needed for a signed driver pacakage
;------------------------------------------------------------------------------
; ========== Manufacturer/Models sections ===========
;------------------------------------------------------------------------------
[Manufacturer]
%MFGNAME% = MyDevice_WinUSB,NTx86,NTamd64

;------------------------------------------------------------------------------
;  Vendor and Product ID Definitions
;------------------------------------------------------------------------------
; When developing your custom USB device, the VID and PID used in the PC side
; application program and the firmware on the microcontroller must match.
; Modify the below lines to use your VID and PID.  Use the format as shown below.
; Note: One INF file can be used for multiple devices with different VID and PIDs.
; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
; There is a maximum number of devices that can be supported per line however.
; If you append a large number of VID/PIDs to the end of the line, and get a:
; "The data area passed to a system call is too small." error when trying to install
; the INF, try removing some of the VIDs/PIDs.
;------------------------------------------------------------------------------
[MyDevice_WinUSB.NTx86]
%DESCRIPTION% =USB_Install, USB\VID_0483&PID_5720

[MyDevice_WinUSB.NTamd64]
%DESCRIPTION% =USB_Install, USB\VID_0483&PID_5720


;=========================================================================================
;ClassInstall32 and ClassInstall_AddReg sections used to make new device manager category.
;=========================================================================================
[ClassInstall32]
AddReg=ClassInstall_AddReg

[ClassInstall_AddReg]
HKR,,,,%DEVICEMANAGERCATEGORY%
HKR,,Icon,,"-20"


; =================== Installation ===================

[USB_Install]
Include=winusb.inf
Needs=WINUSB.NT

[USB_Install.Services]
Include=winusb.inf
AddService=WinUSB,0x00000002,WinUSB_ServiceInstall

[WinUSB_ServiceInstall]
DisplayName     = %WinUSB_SvcDesc%
ServiceType     = 1
StartType       = 3
ErrorControl    = 1
ServiceBinary   = %12%\WinUSB.sys

[USB_Install.Wdf]
KmdfService=WINUSB, WinUsb_Install

[WinUSB_Install]
KmdfLibraryVersion=1.11

[USB_Install.HW]
AddReg=Dev_AddReg

[Dev_AddReg]
HKR,,DeviceInterfaceGUIDs,0x10000,"{fcb251a5-6a1f-4e5b-9df8-e8de91d04cfe}"
;When editing the GUID (the big hex number with dashes inside the squiggly 
;braces), make sure to write the intended PC application to use the same GUID.
;Otherwise the application won't be able to find the USB device properly.

[USB_Install.CoInstallers]
AddReg=CoInstallers_AddReg
CopyFiles=CoInstallers_CopyFiles

[CoInstallers_AddReg]
HKR,,CoInstallers32,0x00010000,"WdfCoInstaller01011.dll,WdfCoInstaller",

[CoInstallers_CopyFiles]
;WinUSBCoInstaller2.dll
WdfCoInstaller01011.dll

[DestinationDirs]
CoInstallers_CopyFiles=11

; ================= Source Media Section =====================

[SourceDisksNames]
1 = %DISK_NAME%

[SourceDisksFiles]
WdfCoInstaller01011.dll=1

; =================== Strings ===================

[Strings]
MFGNAME="ATP Industries Group" ; ManufacturerName
DESCRIPTION="TestCube" ; DeviceName
WinUSB_SvcDesc="WinUSB Device"
DISK_NAME="TestCubeDriver Installation Disk" ; DiskName
DEVICEMANAGERCATEGORY="Universal Serial Bus devices" ; ClassName

我的设备驱动程序安装成功,设备管理器报告设备工作正常。我尝试运行我的应用程序,它能够找到我的设备并检索有关它的详细信息。现在一切正常了,我终于可以开始从事应用程序方面的工作了。

编辑:尽管现在一切正常,但我不知道原始模板出了什么问题 - 谁能向我解释为什么第二个模板有效而不是第一个模板?

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用自定义 INF 的微控制器的 USB 驱动程序安装问题 的相关文章

  • 如何在代码中设置控件模板?

    我在 XAML 中有这个
  • C++ 中的映射的多个键

    我有一个表 其中的条目是这样的 Row Column1 Column2 Column3 Column4 1 0X0A 1 2 A 2 0X0B 2 2 B 3 0x0C 3 2 C 现在我想使用映射 以便我可以使用第 1 列或第 2 列作为
  • 如何使用 C# 获取打印作业状态

    我可以打印文档 但不知道如何获取其状态 我查阅了很多资源 MSDN http support microsoft com kb 322091 检查工作状态的链接 https stackoverflow com questions 55637
  • 在 C 中从数组创建子数组的最佳方法

    我有一个数组说a 3 1 2 5 我必须创建另一个数组a2 2 2 5 我尝试过的是创建一个新数组a2 只需复制所需位置范围内的所有元素即可 在C语言中还有其他方法可以实现这一点吗 memcpy a2 a 1 2 sizeof a
  • libcurl HTTP HEAD 请求没有自动代理连接标头

    我需要关于使用 libcurl 进行以下操作的说明 我需要发送如下所示的 http HEAD 请求 HEAD mshare 3 30002 12 primary stream xNKNVH mpeg HTTP 1 1 Host 192 16
  • 线程忙等待

    基本上 我需要忙着等待一些 html 出现在网页上 我创建了以下代码来忙等我 public void ExecuteBusyWaitThreads foreach Canidate canidate in allCanidates Thre
  • C#:模拟内存泄漏

    我想用c 编写以下代码 a 模拟内存泄漏的小型控制台应用程序 b 小型控制台应用程序 它将调用上述应用程序并立即释放它 模拟管理内存泄漏问题 换句话说 应用程序 b 将不断调用并释放应用程序 a 以模拟如何遏制 叛逆 内存泄漏应用程序 而不
  • 在下载的同时从 UnityWebRequest 获取数据?

    我有这段代码可以进行 REST 调用 public IEnumerator GetCooroutine string route string finalURL URL route UnityWebRequest www UnityWebR
  • 树视图上的 VirtualizingStackPanel 不是虚拟化

    我在这里遇到一个问题 我想在 TreeView 中显示一些项目 大约 100 000 个元素 如果我使用默认的 WPF TreeView 一切似乎都可以工作 但如果我使用自定义 TreeView 目前只有 ItemsControl 虚拟化似
  • 推导具有两个以上参数的 std::function

    我想知道为什么std function http en cppreference com w cpp utility functional function只知道有两个参数的函数 我已经编写了一些运行良好的代码 但存在许多限制 欢迎任何反馈
  • C++ 抛硬币程序错误

    我正在尝试计算抛硬币中连续的正面朝上的次数 不幸的是 我的连续头计数器没有正确增加 有任何想法吗 代码和示例输出如下 include
  • 如何从函数调用事件处理程序?

    我有一个类 我从中调用一个函数ABC string st 带字符串参数 该函数定义在一个Form class Form1 我有一个列表视图 想要从函数中自动调用列表视图 mouse click 事件 我该如何做到这一点 您不能调用另一个类的
  • 哪个对缓存最友好?

    我试图很好地掌握面向数据的设计以及如何在考虑缓存的情况下进行最佳编程 基本上有两种情况我无法完全确定哪个更好以及为什么 是拥有一个对象向量更好 还是拥有对象原子数据的多个向量更好 A 对象向量示例 struct A GLsizei mInd
  • 使用 ViewBag 时出现 RuntimeBinderException

    我们收到 Layout cshtml 中使用的 Viewbag 项目的 RuntimeBinderException 我们在内存分析器中观察到这些异常 它们不是致命的 一切正常 但很烦人 我们想清除它们 例如 以下代码会导致异常 Rende
  • 在一个整数中找到另一个整数的 MSB 位置左侧的 N 个连续零位

    问题是 给定一个整数val1然后 给定第二个整数 找到最高位组 最高有效位 的位置val2找到第一个整数生成的位置左侧的未设置位的连续区域 width指定minimum必须在连续中找到的未设置位的数量 即width里面没有 0 这是我的解决
  • 重载解析:这如何不含糊不清?

    假设我们有这段代码 是从一个单独的问题复制的 namespace x void f class C void f using x f f lt 名字f在指定的行上明确指的是x f 至少根据 gcc 和 clang 为什么是x f优先于x C
  • 为什么IL代码中stloc.0后面有一个ldloc.0?

    我正在尝试通过编写小代码片段和检查编译的程序集来学习 CIL 所以我写了这个简单的 if 语句 public static void Main string args Int32 i Int32 Parse Console ReadLine
  • gcc 不会编译和运行 MySQL C 库

    include
  • Eigen 如何沿特定维度连接矩阵?

    我有两个特征矩阵 我想将它们连接起来 就像在 matlab 中一样cat 0 A B eigen 有等价物吗 Thanks 您可以使用逗号初始值设定项语法 水平方向 MatrixXd C A rows A cols B cols C lt
  • 使用 winforms 、 mdi 、父子窗体,在父窗体下指定空间打开子窗体

    我有一个 winform MAINFORM 需要以此形式打开子窗体 如图所示 黑色部分是一个面板并且包含一个编号 具有多个节点的 LinkLabels 和 Treeview 在其余部分中 我想在单击面板上的链接标签时显示子表单 子表单应完全

随机推荐

  • WordPress,使用 cookie 进行类别重定向

    我想要实现的目标 当用户访问该网站并选择特定类别时 他们下次访问该网站 回访用户 时 该页面将在该类别部分打开 我认为 通过在访问者单击类别链接 或加载类别页面时 时设置 cookie 这将相当容易做到 当它们返回以下时间时 将读取 coo
  • 在 Django/mod_wsgi 虚拟环境中配置 WSGIPythonHome 的问题

    我在 Windows 10 上运行 Python 3 7 1 和 Apache 2 4 38 我设置了一个虚拟环境 其中包含通过 pip 安装的 Django 2 2 5 和 mod wsgi 4 6 5 在 httpd conf 内部 我
  • 如何获取字符串中所有匹配的位置?

    我有一个专栏flag acumu在 PostgreSQL 的表中 其值如下 SSNSSNNNNNNNNNNNNNNNNNNNNNNNNNNNNSNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN 我需要用 S 显
  • “user-images.githubusercontent.com”上的图像可以删除吗?

    我不小心在 GitHub 上上传了一张我不想放的图片 我原以为出于示例目的 我已经从上传的图像中删除了私人信息 但私人信息仍然存在 它包含诸如主机名之类的内容 我希望这些内容不是公开的 有没有办法从 github 的图像注册表中删除该图像
  • 到本地主机的 New-PSSession 失败

    我有一个打开本地主机远程会话的脚本 我需要这个来从登录脚本中在某些设备上安装 NuGet Username Admin Password ConvertTo SecureString adminPW AsPlainText Force ad
  • getElementsByClassName onclick 问题[重复]

    这个问题在这里已经有答案了 我在用着罗伯特 尼曼的 http robertnyman com 2008 05 27 the ultimate getelementsbyclassname anno 2008 脚本来获取文档中具有相同类的所有
  • 使用非 root 且无需 CPAN 安装 Perl 模块和依赖项

    我一直在为我的工作编写 Perl 脚本 而我工作的机器使安装 Perl 模块变得困难 我们不能有gcc出于安全原因 在我的机器上 所以对于大多数模块 我无法使用 CPAN 来安装模块 我无权访问 root 帐户 通常 当我想安装模块时 我会
  • 朱莉娅:当我有情节时如何找到最佳拟合曲线/方程?

    朱莉娅 当我有情节时如何找到最佳拟合曲线 方程 我有一个用地图绘制的图 但我需要找到一个适合这个的二次方程 正如评论中所说 情节在这里并不重要 只有数据本身是 您可以使用诸如GLM构建数据的 广义 线性模型 并可能绘制它们或使用它们来预测新
  • 请求的运行时 (python-) 不适用于此堆栈 (heroku-20)

    我在尝试通过 Heroku 部署这个 Flask 应用程序时遇到了困难 我研究了多种方法来解决这个问题 但似乎找不到一种可行的方法 这就是当我推动时我得到的git push heroku master remote gt Building
  • Dev-C++ 输入已跳过

    include
  • .NET 4.0 解决方案中的 NHibernate 1.2

    我有一些基于 NHibernate 1 2 的项目 我想将它们添加到 NET 4 0 解决方案中 但我收到 AmbigeousMatchException 无论这些项目是针对2 0还是4 0框架 如果我将它们添加到 NET 3 5 解决方案
  • 将刻度转换为时间格式 (hh:mm:ss)

    我从网络服务器获取视频长度值作为刻度 我想以 hh mm ss 格式显示它 我怎样才能在 JavaScript 中做到这一点 假设刻度以秒为单位 如果不是 您可以先将其转换为秒 您可以通过查找时间跨度中的整分钟数和小时数 然后获取剩余的秒数
  • 我什么时候应该使用解析器?

    我在正则表达式中遇到了将代码划分为功能组件的问题 它们可能会破裂 也可能需要很长时间才能完成 这段经历提出了一个问题 我什么时候应该使用解析器 当您对以下内容感兴趣时 应该使用解析器文本的词汇或语义意义 当模式可以变化时 当您只是想了解时
  • Java正则表达式正向预测但仅匹配唯一字符?

    我正在尝试将字符串输入与以下条件进行匹配 第一个字符是unique小写英文字母 接下来的字符代表从 1500 到 2020 的当前年份 接下来的字符只能是 10 或 100 或 1000 最后一个字符是 0 到 9 之间的数字 我创建的正则
  • 在多个数据库上使用 ActiveRecord

    我正在编写一个工资系统 它将与现有系统集成 原始系统有一个主数据库 用于处理用户管理和一些全局配置 下面有多个结构相同的数据库 基本上每个数据库都是一个公司的工资数据库 所有这些都与主数据库绑定 因为它属于父数据库公司拥有多家子公司 每个子
  • 在 matplotlib 底图投影上绘制椭圆

    我正在尝试在底图投影上绘制椭圆 要画一个像多边形一样的圆 有tissot用于绘图的函数天梭的指标 http en wikipedia org wiki Tissot 27s indicatrix如下例所示 from mpl toolkits
  • BeautifulSoup XML 仅打印第一行

    我正在使用 BeautifulSoup4 和 lxml 来解析 XML 文件 由于某种原因 当我打印 soup prettify 时 它只打印第一行 from bs4 import BeautifulSoup f open xmlDoc x
  • 将复选框数据插入mysql

    我的问题如下 这是我的 mySQL 表和 HTML 表单 https i stack imgur com g4qp5 jpg 我需要找到一个 PHP 代码来将复选框数据插入到 mySQL 表中 如果选中一个复选框 我想将该特定列填充为 1
  • 如何编写包含引号的字符串文字?

    我想用这个确切的文本创建一个字符串 nuke execute Write1 1 10 1 只需用双引号将其引起来 例如 nuke execute Write1 1 10 1 不起作用 gt gt gt nuke execute Write1
  • 使用自定义 INF 的微控制器的 USB 驱动程序安装问题

    我正在使用 NXP LPC1788 微控制器 并尝试在主机上创建一个驱动程序以通过 USB 与其进行通信 我相信我已经设法让设备正确处理标准 USB 请求 PC 能够正确读取字符串描述符 不过 我在编写示例 USB 驱动程序并为设备安装它时