Invention content
The implementation method and device of mouse roller provided by the invention based on vxworks operating system, Neng GouUsing mouse roller come the scroll bar of operation pages window in vxworks operating system, so that processing carries scroll barOperation is more convenient during page window, while is also avoided that due to cpu resource consumption caused by the mobile mouse of long-time.
In a first aspect, the present invention provides a kind of implementation method of the mouse roller based on vxworks operating system, it is applied toMain frame, including:When the startup for detecting vxworks operating system the enabled instruction of compiling generation be sent to mouse so thatThe idler wheel pattern of the energy mouse;Receive the displacement data packet that the mouse is sent;The displacement data packet is read to obtainState the target location coordinate of mouse rollovers;The cursor for controlling the mouse according to the target location coordinate of the mouse rollovers movesTo the corresponding position of screen.
Further, if the mouse is the PS/2 mouses of standard, the idler wheel pattern packet for enabling the mouseIt includes:The sample rate of the PS/2 mouses is set;It sends mouse ID and obtains order to the PS/2 mouses;Receive the PS/2 mousesThe mouse ID response commands of feedback, and determine whether the PS/2 mouses support idler wheel work(according to the mouse ID response commandsEnergy;If the PS/2 mouses support roller function, the idler wheel pattern of the mouse is enabled.
Optionally, if the mouse is USB mouse, the idler wheel pattern for enabling the mouse includes:ByThe operating mode of setting mouse is idler wheel pattern in the configuration interface of the USB mouse.
Further, the offset of the horizontal direction of the displacement data packet including the PS/2 mouses, vertical directionOffset and idler wheel offset;It is described to read the displacement data packet to obtain the target location coordinate of the mouse rollovers, it wrapsIt includes:Read the offset of horizontal direction, the offset of vertical direction and the idler wheel offset in the mobile data packet;According to instituteState the mesh that the offset of horizontal direction, the offset of the vertical direction and the idler wheel offset determine the mouse rolloversCursor position coordinate.
Optionally, the key-press status of the displacement data packet including the USB mouse, horizontal direction offset, verticalThe offset in direction and idler wheel offset;It is described to read the displacement data packet to obtain the target location of mouse rollovers seatMark, including:Read key-press status, the offset of horizontal direction, the offset of vertical direction and the rolling in the mobile data packetTake turns offset;According to the key-press status, the offset of the horizontal direction, the offset of the vertical direction and the rollingWheel offset determines the target location coordinate of the mouse rollovers.
Second aspect, the present invention provides a kind of realization device of the mouse roller based on vxworks operating system, positioned at meterMachine host is calculated, including:
Enabled module, for when the startup for detecting vxworks operating system the enabled instruction of compiling generation be sent to mouseIt is marked with the idler wheel pattern of the enabled mouse;
Receiving module, for receiving the displacement data packet that the mouse is sent;
Read module, for reading the displacement data packet to obtain the target location coordinate of the mouse rollovers;
Control module, the cursor for controlling the mouse according to the target location coordinate of the mouse rollovers are moved to screenThe corresponding position of curtain.
Further, if the mouse is the PS/2 mouses of standard, the enabled module includes:
Setting unit, for setting the sample rate of the PS/2 mouses;
Transmitting element obtains order to the PS/2 mouses for sending mouse ID;
Receiving unit, for receiving the mouse ID response commands of the PS/2 mouses feedback;
Determination unit, for determining whether the PS/2 mouses support roller function according to the mouse ID response commands;
Enabling unit if determining that the PS/2 mouses support roller function for the determination unit, enables describedThe idler wheel pattern of mouse.
Optionally, if the mouse is USB mouse, the enabled module, for passing through matching in the USB mouseThe operating mode for putting setting mouse in interface is idler wheel pattern.
Further, the offset of the horizontal direction of the displacement data packet including the PS/2 mouses, vertical directionOffset and idler wheel offset;
The read module, for reading the offset of the key-press status in the mobile data packet, horizontal direction, verticalThe offset in direction and idler wheel offset, and according to the key-press status, the offset of the horizontal direction, the vertical directionOffset and the idler wheel offset determine the target location coordinates of the mouse rollovers.
Optionally, the key-press status of the displacement data packet including the USB mouse, horizontal direction offset, verticalThe offset in direction and idler wheel offset;
The read module, for reading the offset of the key-press status in the mobile data packet, horizontal direction, verticalThe offset in direction and idler wheel offset, and according to the key-press status, the offset of the horizontal direction, the vertical directionOffset and the idler wheel offset determine the target location coordinates of the mouse rollovers.
The implementation method and device of mouse roller provided in an embodiment of the present invention based on vxworks operating system, work as inspectionThe enabled instruction of compiling generation is sent to mouse to enable the idler wheel mould of the mouse when measuring the startup of vxworks operating systemFormula;Receive the displacement data packet that the mouse is sent;The displacement data packet is read to obtain the target position of the mouse rolloversPut coordinate;The cursor of the mouse is controlled to be moved to the corresponding position of screen according to the target location coordinate of the mouse rollovers.Compared with prior art, can in vxworks operating system using mouse roller come the scroll bar of operation pages window, so as toSo that operation is more convenient during page window of the processing with scroll bar, while also it is avoided that since the mobile mouse of long-time is broughtCpu resource consumption.
Specific embodiment
Purpose, technical scheme and advantage to make the embodiment of the present invention are clearer, below in conjunction with the embodiment of the present inventionIn attached drawing, the technical solution in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is onlyOnly it is part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skillPersonnel's all other embodiments obtained without making creative work, shall fall within the protection scope of the present invention.
The present invention provides a kind of implementation method of the mouse roller based on vxworks operating system, applied to calculating ownerMachine, there are many kinds of the forms of mouse, with interface point, common are at present (personal 2, the PS/2) mouse of personal system 2 andUSB mouse.Following embodiment is described in detail with PS/2 mouses and USB, as shown in Figure 1, the method for the present embodiment includes:
S11, when the startup for detecting vxworks operating system the enabled instruction of compiling generation be sent to the mouse so thatThe idler wheel pattern of the energy mouse.
It in the present embodiment can be by compiling the enabled instruction of mouse-driven generation.
When the mouse is PS/2 mouses, then the idler wheel pattern for enabling the mouse includes:The PS/2 is setThe sample rate of mouse;It sends mouse ID and obtains order to the PS/2 mouses;The mouse ID for receiving the PS/2 mouses feedback is rungIt should order, and determine whether the PS/2 mouses support roller function according to the mouse ID response commands;If the PS/2Mouse supports roller function, then enables the idler wheel pattern of the mouse.
When the mouse is USB mouse, then the idler wheel pattern for enabling the mouse includes:By in the USBThe operating mode of setting mouse is idler wheel pattern in the configuration interface of mouse.
S12, the displacement data packet that the mouse is sent is received.
When mouse is PS/2 mouses, the displacement data packet includes the offset of the offset, vertical direction of horizontal directionAmount and idler wheel offset.Specifically, the displacement data packet includes for 3 byte datas, wherein, the 1st byte, the 2nd byte and the 3rdByte represents the offset of horizontal direction, the offset of vertical direction and idler wheel offset of the PS/2 mouses respectively.
When mouse is USB mouse, the displacement data packet includes key-press status, the offset of horizontal direction, Vertical SquareTo offset and idler wheel offset.Specifically, the displacement data packet is 4 byte data packets, wherein, the 1st byte, the 2nd wordSection, the 3rd byte and the 4th byte represent the key-press status of the USB mouse, the offset of horizontal direction, vertical direction respectivelyOffset and idler wheel offset.
S13, the displacement data packet is read to obtain the target location coordinate of the mouse rollovers.
It is described to read the displacement data packet to obtain the target location of the mouse rollovers when mouse is PS/2 mousesCoordinate, including:Read the offset of horizontal direction, the offset of vertical direction and the idler wheel offset in the mobile data packetAmount;The mouse is determined according to the offset of the horizontal direction, the offset of the vertical direction and the idler wheel offsetMark the target location coordinate rolled.
It is described to read the displacement data packet to obtain the target position of the mouse rollovers when the mouse is USB mouseCoordinate is put, including:Read key-press status in the mobile data packet, horizontal direction offset, the offset of vertical directionWith idler wheel offset;According to the key-press status, the offset of the horizontal direction, the offset of the vertical direction and instituteState the target location coordinate that idler wheel offset determines the mouse rollovers.
S14, the cursor of the mouse is controlled to be moved to the corresponding of screen according to the target location coordinate of the mouse rolloversPosition.
The implementation method of mouse roller provided in an embodiment of the present invention based on vxworks operating system, with the prior artCompare, can in vxworks operating system using mouse roller come the scroll bar of operation pages window so that processing bandOperation is more convenient when having the page window of scroll bar, while is also avoided that due to cpu resource caused by the mobile mouse of long-timeConsumption.
The embodiment of the present invention provides a kind of realization device of the mouse roller based on vxworks operating system, positioned at calculatingMachine host, as shown in Fig. 2, the device of the present embodiment includes:
Enabled module 21, for when the startup for detecting vxworks operating system the enabled instruction of compiling generation be sent toMouse is with the idler wheel pattern of the enabled mouse;
Receiving module 22, for receiving the displacement data packet that the mouse is sent;
Read module 23, for reading the displacement data packet to obtain the target location coordinate of the mouse rollovers;
Control module 24, the cursor for controlling the mouse according to the target location coordinate of the mouse rollovers are moved toThe corresponding position of screen.
The realization device of mouse roller provided in an embodiment of the present invention based on vxworks operating system, with the prior artCompare, can in vxworks operating system using mouse roller come the scroll bar of operation pages window so that processing bandOperation is more convenient when having the page window of scroll bar, while is also avoided that due to cpu resource caused by the mobile mouse of long-timeConsumption.
In the above-described embodiments, if the mouse is PS/2 mouses, the enabled module 21 specifically includes:
Setting unit, for setting the sample rate of the PS/2 mouses;
Transmitting element obtains order to the PS/2 mouses for sending mouse ID;
Receiving unit, for receiving the mouse ID response commands of the PS/2 mouses feedback;
Determination unit, for determining whether the PS/2 mouses support roller function according to the mouse ID response commands;
Enabling unit if determining that the PS/2 mouses support roller function for the determination unit, enables describedThe idler wheel pattern of mouse.
Correspondingly, the offset of the horizontal direction of the displacement data packet including the PS/2 mouses, vertical direction it is inclinedShifting amount and idler wheel offset.
Specifically, the displacement data packet includes for 3 byte datas, wherein, the 1st byte, the 2nd byte and the 3rd byte pointThe offset of horizontal direction, the offset of vertical direction and idler wheel offset of the PS/2 mouses are not represented.
Correspondingly, the read module 23, for read the key-press status in the mobile data packet, horizontal direction it is inclinedShifting amount, the offset of vertical direction and idler wheel offset, and according to the key-press status, the offset of the horizontal direction, instituteIt states the offset of vertical direction and the idler wheel offset determines the target location coordinate of the mouse rollovers.
In the above-described embodiments, if the mouse is USB mouse, the enabled module, specifically for by instituteThe operating mode for stating setting mouse in the configuration interface of USB mouse is idler wheel pattern.
Correspondingly, the key-press status of the displacement data packet including the USB mouse, horizontal direction offset, verticalThe offset in direction and idler wheel offset.
Specifically, the displacement data packet is 4 byte data packets, wherein, the 1st byte, the 2nd byte, the 3rd byte and the 4thByte represents the key-press status of the USB mouse, the offset of horizontal direction, the offset of vertical direction and idler wheel offset respectivelyAmount.
Correspondingly, the read module 23, for read the key-press status in the mobile data packet, horizontal direction it is inclinedShifting amount, the offset of vertical direction and idler wheel offset, and according to the key-press status, the offset of the horizontal direction, instituteIt states the offset of vertical direction and the idler wheel offset determines the target location coordinate of the mouse rollovers.
One of ordinary skill in the art will appreciate that realizing all or part of flow in above-described embodiment method, being can be withRelevant hardware is instructed to complete by computer program, the program can be stored in a computer read/write memory mediumIn, the program is when being executed, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, the storage medium can be magneticDish, CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random AccessMemory, RAM) etc..
The above description is merely a specific embodiment, but protection scope of the present invention is not limited thereto, anyThose familiar with the art in the technical scope disclosed by the present invention, all should by the change or replacement that can be readily occurred inIt is included within the scope of the present invention.Therefore, protection scope of the present invention should be subject to the protection scope in claims.