CN100501710C - Peripheral apparatus access state checking method - Google Patents

Peripheral apparatus access state checking method Download PDF

Info

Publication number
CN100501710C
CN100501710C CNB200710120499XA CN200710120499A CN100501710C CN 100501710 C CN100501710 C CN 100501710C CN B200710120499X A CNB200710120499X A CN B200710120499XA CN 200710120499 A CN200710120499 A CN 200710120499A CN 100501710 C CN100501710 C CN 100501710C
Authority
CN
China
Prior art keywords
peripheral apparatus
peripheral
item
access state
key assignments
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CNB200710120499XA
Other languages
Chinese (zh)
Other versions
CN101105778A (en
Inventor
舒娟媚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Priority to CNB200710120499XA priority Critical patent/CN100501710C/en
Publication of CN101105778A publication Critical patent/CN101105778A/en
Application granted granted Critical
Publication of CN100501710C publication Critical patent/CN100501710C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a method for checking the access status of peripheral devices and relates to a peripheral device checking technique. To solve the problem that peripheral devices can not be checked in time currently, the invention adopts the following proposal: a method for checking the access status of peripheral devices. A sub-key of peripheral devices is added under the registry of the operating system of the host, and a thread is provided to checking the sub-key of peripheral devices. Triggered by changes of the sub-key of peripheral devices, the thread can determine the access status of peripheral devices according to the read sub-key and sub-key value of peripheral devices. The invention can be used in all computers with peripheral devices. The invention can accurately and easily check the access status of peripheral devices in time.

Description

Peripheral apparatus access state checking method
Technical field
The present invention relates to the peripheral apparatus monitoring technology, relate in particular to a kind of computer peripheral equipment access state checking method.
Background technology
Universal day by day along with computing machine, computer peripheral equipment is also contacted by people more and more.Portable hard drive, modulator-demodular unit, flash disk etc. all are computer peripheral equipments of using always.The interface mode of peripheral apparatus and computing machine is also very flexible, commonly used have PC RAM (random access memory) card international federation (PCMCIA, PersonalComputer Memory Card International Association) interface, USB interface, expansion card (Express Card) interface etc.Compare with pcmcia interface, Express Card interface has that volume is littler, transmission speed is faster, power consumption is lower, be more suitable for lot of advantages such as mobile system.The application of USB interface is extensive especially, and present nearly all notebook, desktop computer are provided with USB interface, and the user utilizes these USB interface can realize easily supporting that the peripheral apparatus of USB interface inserts computing machine.
After peripheral apparatus inserts computing machine, by additional application software together, can provide profuse function service for the user, this also is the main cause that the user accepts peripheral apparatus.For example use more modulator-demodular unit, can order between application software and the modulator-demodular unit that (by Hayes company invention is the employed Modem commands language of all modem manufacturers by AT.Every order is with letter " AT " beginning, heel letter and number) communication realizes miscellaneous service.
But, when peripheral apparatus when computing machine is extracted, application software need be learnt this information rapidly and in time carry out corresponding state variation, just can accomplish the response of intelligence, avoid simultaneously allowing certain operations to proceed, may cause the unusual of program because not detecting variation.
At the problems referred to above, method commonly used at present is to give peripheral apparatus by application program timed sending sense command, and whether whether have response to detect peripheral apparatus by order online.Another kind method is to report the heartbeat instruction by peripheral apparatus to application program, does not prove promptly that when a period of time application program receives the heartbeat instruction peripheral apparatus has broken away from computing machine.
There is the real-time inadequately problem that detects in above-mentioned peripheral apparatus access state checking method, getting nowhere of one-time detection order, can not prove peripheral apparatus divorced from computer, so also need to wait certain number of times could proof after the success equipment divorced from computer, especially use AT to order the equipment of communication, because an order itself also has the overtime of certain hour, so judge more untimely.
Summary of the invention
In view of this, fundamental purpose of the present invention is to provide a kind of peripheral apparatus access state checking method, so that the access state of peripheral apparatus to be provided timely and accurately.
For achieving the above object, technical scheme of the present invention is achieved in that
A kind of peripheral apparatus access state checking method is set up the peripheral apparatus item under the operating system registration table item of main frame, and the thread that detects the peripheral apparatus item is set, and this method comprises:
Described thread is triggered when the peripheral hardware equipment item changes, and described thread is determined peripheral apparatus access state according to the peripheral apparatus item and the key assignments thereof that read.
Wherein, the described peripheral apparatus item of setting up specifically comprises:
When being written into host operating system, the peripheral hardware appliance applications under registry entry, sets up the peripheral apparatus item.
Wherein, comprise peripheral apparatus information subitem in the described peripheral apparatus item; When peripheral apparatus access or Offhost, host operating system is added in the peripheral hardware equipment item or is deleted peripheral apparatus information subitem, and revises the key assignments of relevant peripheral apparatus item.
Wherein, comprise at least in the key assignments of peripheral apparatus information subitem: peripheral apparatus type information, supplier identify VID information, manufacturer pid information and peripheral apparatus link position information.
Wherein, described thread is triggered and comprises:
The application programming interfaces api function that described thread dispatching monitoring registry entry changes, described api function monitor and trigger described thread when registry entry to be monitored changes.
Wherein, described thread is determined peripheral apparatus access state according to the peripheral apparatus item and the key assignments thereof that read, specifically comprises:
Described thread reads the key assignments of peripheral hardware facility information subitem in the peripheral apparatus item, promptly determines the peripheral apparatus of current access main frame according to reading key assignments.
Wherein, described thread is determined peripheral apparatus access state according to the peripheral apparatus item and the key assignments thereof that read, comprising:
Described thread reads the key assignments of peripheral hardware facility information subitem in the peripheral apparatus item, determines the peripheral apparatus of new access or Offhost according to peripheral apparatus that is read and the peripheral apparatus that inserts before.
Peripheral apparatus inserts computing machine, need set up applications to support the use of described peripheral apparatus, during set up applications, computer operating system can be created a Registry Subkeys for this peripheral apparatus under corresponding registry entry, and when peripheral apparatus access or divorced from computer, computer operating system will be revised described peripheral apparatus Registry Subkeys, the present invention is provided with one and detects the thread that the peripheral apparatus Registry Subkeys changes, when detecting the variation of peripheral apparatus Registry Subkeys, read the key assignments of peripheral apparatus Registry Subkeys again and can determine which the peripheral apparatus of current access is, insert or the peripheral apparatus of divorced from computer main frame thereby can determine to make new advances.It is to utilize the api function in the operating system to detect the variation of peripheral apparatus Registry Subkeys that the present invention detects thread, and operating system modification peripheral apparatus Registry Subkeys is faster, therefore whole detection is not only fast and accurate, and correct instruction of handling at peripheral apparatus is very useful for operating system for this.
Description of drawings
Fig. 1 is the process flow diagram of peripheral apparatus access state checking method of the present invention;
Fig. 2 is the Registry Subkeys synoptic diagram that peripheral apparatus is created for operating system;
Fig. 3 inserts its Registry Subkeys synoptic diagram behind the main frame for peripheral apparatus.
Embodiment
Core concept of the present invention is: of a great variety and insert flexible characteristic relatively at the peripheral apparatus of present main frame, the detection peripheral apparatus access state is not prompt enough, this may cause the unusual of peripheral apparatus application program, even has influence on the operating system of main frame.Behind the peripheral apparatus access state computing machine, need set up applications to support the use of described peripheral apparatus, during set up applications, computer operating system can be created a Registry Subkeys for this peripheral apparatus under corresponding registry entry, when peripheral apparatus access or divorced from computer main frame, operating system will be revised the peripheral apparatus Registry Subkeys, the present invention utilizes and detects the variation that thread detects the peripheral apparatus Registry Subkeys, determine peripheral apparatus access state with this, at the right time, and accuracy of judgement.Describe the present invention below in conjunction with accompanying drawing.
Fig. 1 is the process flow diagram of peripheral apparatus access state checking method, and as shown in Figure 1, peripheral apparatus access state checking method of the present invention comprises:
Step 101: under the operating system registration table item of main frame, set up the peripheral apparatus Registry Subkeys, and the thread that detects the peripheral apparatus item is set.This step is the preparation process of access state checking method of the present invention, is the prerequisite that realizes detection method of the present invention.
When peripheral apparatus is linked into main frame, the application program that peripheral apparatus need be installed could realize the application of this peripheral apparatus, the peripheral apparatus of USB interface for example, why the user can use USB device easily, is to support the corresponding program that USB device inserts because installed in operating system.Equipment such as some printers also is could use after installing application program for another example.And when the application program of peripheral apparatus was installed, operating system can be created a Registry Subkeys for peripheral apparatus in registry entry.Fig. 2 is the Registry Subkeys synoptic diagram that peripheral apparatus is created for operating system, as shown in Figure 2, Registry Subkeys comprises acquiescence item, number of devices (Count) item, next example (NextInstance) item, REG_SZ, REG_DWORD are above-mentioned key assignments item, the key assignments that numeric representation thereafter is concrete.Registry Subkeys can place an order to create and build in corresponding registry entry, and the peripheral apparatus of a plurality of same types also can a shared Registry Subkeys.Fig. 3 inserts its Registry Subkeys synoptic diagram behind the main frame for peripheral apparatus, as shown in Figure 3, after peripheral apparatus inserts main frame, operating system can be revised its Registry Subkeys immediately, wherein, the subitem of a reflection equipment essential information will be increased, be second of Registry Subkeys shown in Figure 3, the key assignments of its key assignments item REG_SZ reflected peripheral apparatus type information (USB), supplier identify VID information (Vid_19d2), manufacturer pid information (Pid_0001) and peripheral apparatus link position information (MI_02 7﹠amp; 12519522﹠amp; 6﹠amp; 002).Number of devices (Count) item, next example (NextInstance) corresponding key assignments are modified to " 1 ".
Detection thread of the present invention mainly is that the api function that calls in the host operating system detects the Registry Subkeys of peripheral apparatus to be detected, when detecting the Registry Subkeys variation, promptly show the main frame that has peripheral apparatus to insert main frame or disengaging, detection thread of the present invention is triggered immediately, detecting thread determines to have inserted peripheral apparatus the peripheral apparatus Offhost is still arranged by reflecting equipment essential information subitem in the Registry Subkeys, detection by this thread, operating system can in time be made adjustment, and avoids procedure operation unusual.Can realize in the following manner as an example, thread of the present invention:
CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)StartMonitorThread,NUL
L,0,NULL);
StartMonitorThread(LPVOID?context)
{
long?ret;
DWORD?dwEvent;
HKEY?hKey;
if(ERROR_SUCCESS != (ret =
RegOpenKey(HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Services\\ZTEusbnmea",
&hKey)))
{
return-1;
}
HANDLE?hEvent=CreateEvent(NULL,true,true,"RegEvent");
ret=::RegNotifyChangeKeyValue(hKey,TRUE,REG_NOTIFY_CHANGE_LAST_S
ET,hEvent,true);
if(ret==0)
{
dwEvent=WaitForSingleObject(hEvent,INFINITE);
if(dwEvent==WAIT_OBJECT_0)
{
// detect registry entry to change, return the access state information of peripheral apparatus
}
::ResetEvent(hEvent);
}
return?0;
}
Step 102: when peripheral hardware device registry subitem changed, described thread was triggered, and described thread is determined peripheral apparatus access state information according to the peripheral apparatus item and the key assignments thereof that read, returns to operating system.As required, also peripheral apparatus access state information can be back to the user.
The application programming interfaces api function that described thread dispatching monitoring registry entry changes, described api function monitor and trigger described thread when registry entry to be monitored changes.Wherein, described thread is determined peripheral apparatus access state according to the peripheral apparatus item and the key assignments thereof that read, specifically comprise: described thread reads the key assignments of peripheral hardware facility information subitem in the peripheral apparatus Registry Subkeys, return the peripheral apparatus information that is read, promptly only return the peripheral apparatus information of current access main frame, operating system or user only understand the current peripheral apparatus that inserts and get final product.Certainly, after described thread reads the key assignments of peripheral hardware facility information subitem in the peripheral apparatus item, also can be according to peripheral apparatus information that is read and the peripheral apparatus information that inserts before, determine which peripheral apparatus is newly to insert main frame, which equipment has broken away from main frame, and the peripheral apparatus information that newly inserts or broken away from main frame is back to operating system or/and the user.
The present invention determines the access state of peripheral apparatus according to the variation of peripheral apparatus registry entry, and detected peripheral apparatus access state promptly and accurately.The present invention utilizes a thread can realize detection to the access state of peripheral apparatus, realizes simple.
The above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention.

Claims (5)

1, a kind of peripheral apparatus access state checking method is characterized in that, sets up the peripheral apparatus item when the peripheral hardware appliance applications is written into host operating system under registry entry, and the thread that the peripheral apparatus item is surveyed in monitoring is set, and this method comprises:
When the peripheral hardware equipment item changes, the application programming interfaces api function that thread dispatching monitoring registry entry changes, when described api function monitors registry entry to be monitored when changing, described thread is triggered, and described then thread is determined peripheral apparatus access state according to the peripheral apparatus item and the key assignments thereof that read.
2, peripheral apparatus access state checking method according to claim 1 is characterized in that, comprises peripheral apparatus information subitem in the described peripheral apparatus item; When peripheral apparatus access or Offhost, host operating system is added in the peripheral hardware equipment item or is deleted peripheral apparatus information subitem, and revises the key assignments of relevant peripheral apparatus item.
3, peripheral apparatus access state checking method according to claim 2, it is characterized in that, comprise at least in the key assignments of peripheral apparatus information subitem: peripheral apparatus type information, supplier identify VID information, manufacturer pid information and peripheral apparatus link position information.
4, peripheral apparatus access state checking method according to claim 3 is characterized in that, described thread is determined peripheral apparatus access state according to the peripheral apparatus item and the key assignments thereof that read, specifically comprises:
Described thread reads the key assignments of peripheral hardware facility information subitem in the peripheral apparatus item, promptly determines the peripheral apparatus of current access main frame according to reading key assignments.
5, peripheral apparatus access state checking method according to claim 3 is characterized in that, described thread is determined peripheral apparatus access state according to the peripheral apparatus item and the key assignments thereof that read, comprising:
Described thread reads the key assignments of peripheral hardware facility information subitem in the peripheral apparatus item, determines the peripheral apparatus of new access or Offhost according to peripheral apparatus that is read and the peripheral apparatus that inserts before.
CNB200710120499XA 2007-08-20 2007-08-20 Peripheral apparatus access state checking method Expired - Fee Related CN100501710C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB200710120499XA CN100501710C (en) 2007-08-20 2007-08-20 Peripheral apparatus access state checking method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB200710120499XA CN100501710C (en) 2007-08-20 2007-08-20 Peripheral apparatus access state checking method

Publications (2)

Publication Number Publication Date
CN101105778A CN101105778A (en) 2008-01-16
CN100501710C true CN100501710C (en) 2009-06-17

Family

ID=38999680

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB200710120499XA Expired - Fee Related CN100501710C (en) 2007-08-20 2007-08-20 Peripheral apparatus access state checking method

Country Status (1)

Country Link
CN (1) CN100501710C (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101291376B (en) * 2008-06-18 2011-08-17 北京中星微电子有限公司 Method and apparatus for determining equipment object
CN102063320B (en) * 2011-01-06 2013-08-28 华为终端有限公司 Work mode switching methods, USB (Universal Serial Bus) equipment and host machine equipment
CN102111446B (en) * 2011-01-12 2013-04-24 华为终端有限公司 Device connection handling method, combination equipment and host equipment
CN105426330B (en) * 2015-11-05 2018-08-28 飞天诚信科技股份有限公司 A kind of method and device automatically opening extended channel
CN111540133B (en) * 2020-04-27 2022-07-05 中国银行股份有限公司 Method and device for detecting state of external equipment and related equipment

Also Published As

Publication number Publication date
CN101105778A (en) 2008-01-16

Similar Documents

Publication Publication Date Title
US7051149B2 (en) Method for transceiving non-USB device by an adapter and apparatus using the same
TW201416853A (en) Method and system for cloud testing and remote monitoring of integrated circuit device in validation of computerized system
CN100501710C (en) Peripheral apparatus access state checking method
CN105573743A (en) Chip burning system and method and electronic equipment
US8074000B2 (en) Hotkey processing method and computer system
JP6171386B2 (en) Controller, information processing apparatus and program
CN101330399A (en) Method for upgrading built-in equipment
CN101902355A (en) Server, computer system, and method for monitoring computer system
US20140068350A1 (en) Self-checking system and method using same
CN104199767A (en) Test method and device
CN103257922A (en) Method for quickly testing reliability of BIOS (basic input output system) and OS (operating system) interface codes
CN107894935B (en) OPS computer module detection processing method and device and electronic equipment
TW201324141A (en) Testing method and testing apparatus for testing function of electronic apparatus
US9749189B2 (en) Generating graphical diagram of physical layout of computer platforms
CN102708032B (en) Method and device for detecting hot plug of secure digital card
US7213159B2 (en) Method for testing and verifying power management features of computer system
CN104063297A (en) Method and device capable of diagnosing computer hardware through USB interfaces
US10962593B2 (en) System on chip and operating method thereof
US20090265580A1 (en) Error detection method for a computer system, and electronic device
CN101562007A (en) Display control device capable of automatically updating firmware and update method thereof
CN102421004B (en) Debugging method and device for television software system
CN102243601B (en) Debugging system and relevant method for detecting and controlling state of computer host
KR101103940B1 (en) Method for powerless identification of server i/o slots
CN111143153B (en) Server management method capable of remotely acquiring system operation information
CN102841798A (en) Method for improving software driver compatibility

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20090617

Termination date: 20210820

CF01 Termination of patent right due to non-payment of annual fee