官术网_书友最值得收藏!

Overview

Before developing any code, let's identify the requirements and features our script must possess to accomplish the desired task. We will need to execute the following steps:

  1. Open the log file and read all lines
  2. In each line, check for indicators of a USB device entry
  3. Parse responsive lines for timestamp and device information
  4. Output the result to the user

Now, let's examine the log file of interest to determine repetitive structures that we can use as footholds in our script to parse the relevant data. In the following sample USB entry, we can see the device information on line 1 following the text Device Install (Hardware initiated). This device information contains the VID, PID, device revision, and the unique ID of the device. Each of these elements is separated by either a & or _ character and may contain some additional inconsequential characters. The installation time is recorded on line 2, following the Section start text. For our purposes, we are only interested in these two lines. All other surrounding lines will be ignored, as they relate to operating system driver information:

001 >>>  [Setup online Device Install (Hardware initiated) - pciven_15ad&dev_07a0&subsys_07a015ad&rev_013&18d45aa6&0&a9]
002 >>> Section start 2010/11/10 10:21:12.593
003 ump: Creating Install Process: DrvInst.exe 10:21:12.593
004 ndv: Retrieving device info...
005 ndv: Setting device parameters...
006 ndv: Searching Driver Store and Device Path...
007 dvi: {Build Driver List} 10:21:12.640
主站蜘蛛池模板: 湛江市| 晴隆县| 彭州市| 紫云| 酒泉市| 翁源县| 和林格尔县| 古交市| 江津市| 霍林郭勒市| 巴东县| 东至县| 克什克腾旗| 永春县| 哈巴河县| 含山县| 上思县| 静宁县| 天津市| 成武县| 祁阳县| 武定县| 沧州市| 固原市| 天水市| 宽甸| 兴山县| 新泰市| 弥渡县| 福清市| 太原市| 德保县| 遂宁市| 枣庄市| 通化县| 桓仁| 芦溪县| 平武县| 海林市| 台湾省| 磐安县|