CN103246594A - Automatic user state network card detecting method based on Linux kernel - Google Patents
Automatic user state network card detecting method based on Linux kernel Download PDFInfo
- Publication number
- CN103246594A CN103246594A CN2013101197968A CN201310119796A CN103246594A CN 103246594 A CN103246594 A CN 103246594A CN 2013101197968 A CN2013101197968 A CN 2013101197968A CN 201310119796 A CN201310119796 A CN 201310119796A CN 103246594 A CN103246594 A CN 103246594A
- Authority
- CN
- China
- Prior art keywords
- network interface
- facility information
- interface card
- kernel
- equipment
- 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.)
- Pending
Links
Images
Landscapes
- Stored Programmes (AREA)
Abstract
The invention discloses an automatic user state network card detecting method based on Linux kernel. The automatic user state network card detecting method includes storing all equipment information of PCI (peripheral component interconnect) equipment detected by the Linux kernel, extracting equipment information of a network card from the equipment information of all the PCI equipment, and storing the equipment information of the network card so as to be used for driving a user state initialized network card. The equipment information of the PCI equipment detected by the kernel is stored in files, the stored files are opened when the user state driving is loaded, the equipment information of the network card is extracted from the stored files, and the kernel only needs to be slightly modified to realize automatic detection and acquisition of network card information of the user state network card, so that the kernel can be prevented from being modified for many times so as to influence equipment performance, the automatic user state network card detecting method is simple and easy to operate, and capable of improving reliability of an operating system.
Description
Technical field
The present invention relates to field of computer technology, relate in particular to a kind of automatic detection method of user's attitude network interface card based on linux kernel.
Background technology
Dress hardware device is to realize multi-purpose instrument outside in computing machine except CPU other, thereby driver shared status in system is very important, it is general after operating system installation finishes, the driver of hardware device also will be installed, as hardware devices such as sound card, video card, network interface cards, because the driving of these hardware devices can't be integrated in the operating system, just need other install driver.Device drives is divided into that user's attitude drives and the kernel state driving in linux system, wherein user's attitude and kernel state in system structure and function as shown in Figure 1.Call and be absorbed in when carrying out in the kernel code when a task (process) executive system, be in kernel state with regard to the title process, processor was in the highest (0 grade) kernel code of level of privilege and carried out this moment.When process was in kernel state, the kernel code of execution can use the kernel stack of current process.Each process has the kernel stack of oneself.When process when carrying out user's oneself code, then the title process is in user's attitude, namely processor moves in minimum (3 grades) personal code work of level of privilege at this moment.Enter kernel state during with system call, the operation of the hardware of Linux can only can be controlled by writing driver at kernel state, can cause core dump memory clear at user's attitude operational hardware.Generalized case, system call operates in kernel mode, and function operation is in user's attitude.
User's attitude driving for network interface card at present loads of common occurrence, wherein a kind of method is network interface card to be driven compiling advance kernel, when driving, the kernel initialization will preserve with the network card equipment information that drives coupling, return the network interface card that do not reinitialize then, the facility information that obtains the preservation of kernel stage when user's attitude initialization network interface card drives loading, realizes that loading is surveyed and driven to user's attitude of network interface card automatically.But also there is following shortcoming in the prior art:
Need to revise kernel;
Need be provided at the interface that user's attitude can't directly be called;
Use the standard interface definition among the linux, by the method for equipment ioctl kernel function is called, the characteristics of this class interface are if frequently call and can influence performance, with the kernel strong correlation and revise more, nimble inadequately.
Summary of the invention
(1) technical matters that will solve
At above-mentioned defective, the technical problem to be solved in the present invention is the modification that how can reduce linux kernel, user's attitude network interface card is driven automatic detection and the loading that realizes as linux kernel.
(2) technical scheme
For addressing the above problem, the invention provides a kind of automatic detection method of user's attitude network interface card based on linux kernel, described method specifically comprises:
S1: the facility information of preserving all PCI equipment that linux kernel detects with document form;
S2: the facility information that from the facility information of described all PCI equipment, extracts network interface card;
S3: preserve the facility information of described network interface card, drive for user's attitude initialization network interface card and use.
Further, described step S1 specifically comprises:
S11: in the linux kernel start-up course, carry out the script that adds, by the memory device in the Linux order carry hardware device, write in advance before the script startup linux kernel of wherein said interpolation and finish;
S12: in described step S11, create directory by the Linux order in the memory device of carry;
S13: be kept under the described catalogue by the facility information of Linux instruction with described all PCI equipment.
Further, the facility information of described PCI equipment comprises: bus number, device numbering, function numbering, device class sign indicating number, device vendors ID number and device type.
Further, also comprise before the described step S2: the facility information of in user's attitude program, opening the PCI equipment of preserving among the described step S1 with document form.
Further, the facility information that described step S2 extracts network interface card specifically comprises: find out network interface card according to the device class sign indicating number in the described facility information in described all PCI equipment, and go to extract the miscellaneous equipment information of network interface card.
(3) beneficial effect
The invention provides a kind of automatic detection method of user's attitude network interface card based on linux kernel, facility information by all PCI equipment that kernel is detected, preserve with document form, and when user's attitude drives loading, open this preservation file, and therefrom extract the facility information of network interface card, realize surveying automatically, obtaining automatically network interface card information for user's attitude network interface card, only need do minor modifications to kernel, can avoid repeatedly revising kernel influences equipment performance, simple, improves the reliability of operating system.
Description of drawings
Fig. 1 is user's attitude and kernel state structural representation;
Fig. 2 is the flow chart of steps of a kind of automatic detection method of user's attitude network interface card based on linux kernel in the embodiment of the invention;
Fig. 3 is a kind of flow chart of steps based on step S1 in the automatic detection method of user's attitude network interface card of linux kernel in the embodiment of the invention.
Embodiment
Below in conjunction with drawings and Examples, the specific embodiment of the present invention is described in further detail.Following examples are used for explanation the present invention, but are not used for limiting the scope of the invention.
A kind of automatic detection method of user's attitude network interface card based on linux kernel is provided in the embodiment of the invention, and steps flow chart specifically may further comprise the steps as shown in Figure 2:
Step S1: the facility information of preserving all PCI equipment that linux kernel detects with document form.
Wherein the facility information of PCI equipment comprises: bus number, device numbering, function numbering, device class sign indicating number, device vendors ID number and device type.
The steps flow chart of step S1 specifically may further comprise the steps as shown in Figure 3:
Step S11: in the linux kernel start-up course, carry out the script that adds, by the memory device in the Linux order carry hardware device.
Write in advance before the script startup linux kernel that wherein adds and finish, just after starting linux kernel, just carry out.
Step S12: in step S11, create directory by the Linux order in the memory device of carry.
Step S13: be kept under the catalogue by the facility information of Linux instruction with all PCI equipment.
In linux system, use lspci to instruct in the display system all pci bus equipment or be connected all devices on this bus, as sound card, network interface card etc.The display format that obtains after the general input lspci instruction is:
00:19.0Class0200:8086:10ef network card equipment
00:10.1Class0880:8086:d158 other equipment
Wherein the concrete implication of network card equipment information of first row is:
00:19.0 the bus number of indication equipment, device numbering, function are numbered respectively; 0200 is exactly the device class sign indicating number of network interface card; The venID(device vendors of the 8086th, intel ID number); 10ef is exactly the Devid(device type).In like manner second row is the facility information of other PCI equipment.
In the linux kernel start-up course, only need to add a little scriptlet, memory device in carry in script (mount) hardware device (as FLASH card, CF card), carry out lspci then 〉/cfcard/pcidev, the facility information that lspci is shown is kept under the memory device catalogue of carry with the pcidev document form, so just has been saved in all PCI facility informations that kernel detects.
Step S2: the facility information that from the facility information of all PCI equipment, extracts network interface card.
Also comprise before the step S2: with the facility information of the PCI equipment preserved among the document form opening steps S1, corresponding perform statement is: open(in user's attitude program "/cfcard/pcidev ", 0).
The facility information that step S2 extracts network interface card specifically comprises: 0x0200 finds out network interface card in all PCI equipment according to the device class sign indicating number in the facility information (Class Code), and go to extract the miscellaneous equipment information of network interface card, namely extract corresponding bus number, device numbering, function numbering, device vendors ID number and device type according to network card equipment classification sign indicating number 0200.
Step S3: preserve the facility information of network interface card, drive for user's attitude initialization network interface card and use.
The facility information of the network interface card that extracts among the step S2 is preserved (as being saved in the global variable), user's attitude of network interface card driven when needing realizing and realize surveying automatically and loading.
Pass through said method, facility information by all PCI equipment that kernel is detected, preserve with document form, and when user's attitude drives loading, open this preservation file, and therefrom extract the facility information of network interface card, realize surveying automatically, obtaining automatically network interface card information for user's attitude network interface card, only need do minor modifications to kernel, can avoid repeatedly revising kernel influences equipment performance, simple, improves the reliability of operating system.
Above embodiment only is used for explanation the present invention; and be not limitation of the present invention; the those of ordinary skill in relevant technologies field; under the situation that does not break away from the spirit and scope of the present invention; can also make a variety of changes and modification; therefore all technical schemes that are equal to also belong to category of the present invention, and scope of patent protection of the present invention should be defined by the claims.
Claims (5)
1. automatic detection method of user's attitude network interface card based on linux kernel is characterized in that described method specifically comprises:
S1: the facility information of preserving all PCI equipment that linux kernel detects with document form;
S2: the facility information that from the facility information of described all PCI equipment, extracts network interface card;
S3: preserve the facility information of described network interface card, drive for user's attitude initialization network interface card and use.
2. the method for claim 1 is characterized in that, described step S1 specifically comprises:
S11: in the linux kernel start-up course, carry out the script that adds, by the memory device in the Linux order carry hardware device, write in advance before the script startup linux kernel of wherein said interpolation and finish;
S12: in described step S11, create directory by the Linux order in the memory device of carry;
S13: be kept under the described catalogue by the facility information of Linux instruction with described all PCI equipment.
3. the method for claim 1 is characterized in that, the facility information of described PCI equipment comprises: bus number, device numbering, function numbering, device class sign indicating number, device vendors ID number and device type.
4. the method for claim 1 is characterized in that, also comprises before the described step S2: the facility information of opening the PCI equipment of preserving among the described step S1 in user's attitude program with document form.
5. as claim 1 or 3 described methods, it is characterized in that, the facility information that described step S2 extracts network interface card specifically comprises: find out network interface card according to the device class sign indicating number in the described facility information in described all PCI equipment, and go to extract the miscellaneous equipment information of network interface card.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2013101197968A CN103246594A (en) | 2013-04-08 | 2013-04-08 | Automatic user state network card detecting method based on Linux kernel |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2013101197968A CN103246594A (en) | 2013-04-08 | 2013-04-08 | Automatic user state network card detecting method based on Linux kernel |
Publications (1)
Publication Number | Publication Date |
---|---|
CN103246594A true CN103246594A (en) | 2013-08-14 |
Family
ID=48926124
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2013101197968A Pending CN103246594A (en) | 2013-04-08 | 2013-04-08 | Automatic user state network card detecting method based on Linux kernel |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103246594A (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103744703A (en) * | 2014-01-07 | 2014-04-23 | 汉柏科技有限公司 | Method for automatically detecting, driving and loading 3G-USB (Universal Serial Bus) network adapter by user mode based on Linux kernel |
CN103777978A (en) * | 2014-01-07 | 2014-05-07 | 汉柏科技有限公司 | Automatic user-mode 3G-USB network interface card detecting method based on Linux kernel |
CN104503792A (en) * | 2014-12-22 | 2015-04-08 | 山东超越数控电子有限公司 | Method for realizing equipment management function in VxWorks |
CN106095687A (en) * | 2016-06-22 | 2016-11-09 | 西安电子科技大学 | A kind of LinuxPCI trawl performance error-detecting method and device |
CN107402855A (en) * | 2017-06-30 | 2017-11-28 | 郑州云海信息技术有限公司 | A kind of detection method of hard disk, device and server |
CN109960534A (en) * | 2017-12-14 | 2019-07-02 | 迈普通信技术股份有限公司 | Equipment detection method, device, storage medium and electronic equipment |
CN114237725A (en) * | 2021-12-14 | 2022-03-25 | 龙芯中科技术股份有限公司 | Device driver calling method, device and system |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1866202A (en) * | 2005-05-18 | 2006-11-22 | 大唐移动通信设备有限公司 | Drive method for embedded apparatus |
CN101847101A (en) * | 2009-03-24 | 2010-09-29 | Tcl集团股份有限公司 | Method for automatically mounting USB storage device under embedded Linux |
CN102999330A (en) * | 2012-11-12 | 2013-03-27 | 北京神州绿盟信息安全科技股份有限公司 | Network card configuration method and device based on user mode network card drive |
-
2013
- 2013-04-08 CN CN2013101197968A patent/CN103246594A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1866202A (en) * | 2005-05-18 | 2006-11-22 | 大唐移动通信设备有限公司 | Drive method for embedded apparatus |
CN101847101A (en) * | 2009-03-24 | 2010-09-29 | Tcl集团股份有限公司 | Method for automatically mounting USB storage device under embedded Linux |
CN102999330A (en) * | 2012-11-12 | 2013-03-27 | 北京神州绿盟信息安全科技股份有限公司 | Network card configuration method and device based on user mode network card drive |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103744703A (en) * | 2014-01-07 | 2014-04-23 | 汉柏科技有限公司 | Method for automatically detecting, driving and loading 3G-USB (Universal Serial Bus) network adapter by user mode based on Linux kernel |
CN103777978A (en) * | 2014-01-07 | 2014-05-07 | 汉柏科技有限公司 | Automatic user-mode 3G-USB network interface card detecting method based on Linux kernel |
CN104503792A (en) * | 2014-12-22 | 2015-04-08 | 山东超越数控电子有限公司 | Method for realizing equipment management function in VxWorks |
CN106095687A (en) * | 2016-06-22 | 2016-11-09 | 西安电子科技大学 | A kind of LinuxPCI trawl performance error-detecting method and device |
CN106095687B (en) * | 2016-06-22 | 2018-06-15 | 西安电子科技大学 | A kind of Linux PCI trawl performances error-detecting method and device |
CN107402855A (en) * | 2017-06-30 | 2017-11-28 | 郑州云海信息技术有限公司 | A kind of detection method of hard disk, device and server |
CN109960534A (en) * | 2017-12-14 | 2019-07-02 | 迈普通信技术股份有限公司 | Equipment detection method, device, storage medium and electronic equipment |
CN114237725A (en) * | 2021-12-14 | 2022-03-25 | 龙芯中科技术股份有限公司 | Device driver calling method, device and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103246594A (en) | Automatic user state network card detecting method based on Linux kernel | |
CN103777978A (en) | Automatic user-mode 3G-USB network interface card detecting method based on Linux kernel | |
CN103150231B (en) | The method of computer booting and computer system | |
CN104102506B (en) | A kind of Android Acceleration of starting methods based on ARM platforms | |
US20120331449A1 (en) | Device, method and computer program product for evaluating a debugger script | |
CN102422299B (en) | Information device, method for preventing execution of unauthorized program code | |
CN102981830B (en) | A kind of configurable file identifies and has damaged the method that file intelligence is repaired fast | |
CN103778373A (en) | Virus detection method and device | |
WO2015074526A1 (en) | Method and apparatus for injecting java by tecode into target process | |
CN103577212A (en) | System starting preloading method and device | |
CN102214109A (en) | Method and device for loading plug-ins | |
CN106484719B (en) | Method and terminal for expanding mobile phone storage | |
CN105678160B (en) | For providing the system and method for the access to the original routine of boot driver | |
CN104077220A (en) | Method and device for debugging microprocessor without interlocked piped stages (MIPS) framework operating system kernel | |
US20060031669A1 (en) | Boot method and system | |
CN108647061A (en) | Call method, device and the computing device of system hidden method | |
CN103631639A (en) | Automatic detection method for user state virtual network interface card | |
CN106294089A (en) | The method and apparatus assisting the access monitoring to monitored memory headroom | |
US8468388B2 (en) | Restoring programs after operating system failure | |
CN103064767B (en) | Drive backup, the method recovered and device | |
CN103984572A (en) | Method and equipment for realizing computer installation and operating system switch without CD driver | |
CN105893221A (en) | Terminal operation time length alarming method and device | |
CN105528334A (en) | Document operation processing method and terminal | |
CN105446785A (en) | Method and system for unloading application program | |
US8819625B2 (en) | Sharable development environment bookmarks for functional/data flow |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20130814 |
|
RJ01 | Rejection of invention patent application after publication |