A keyboard-mouse switching linkage method for multiple devices

By constructing a continuous coordinate mapping table and adaptive protocol conversion, the problems of cumbersome switching, poor compatibility, and inaccurate triggering in multi-device keyboard and mouse control are solved, achieving seamless and stable multi-device collaborative control.

CN122111897APending Publication Date: 2026-05-29SHENZHEN BAILIHE TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN BAILIHE TECH CO LTD
Filing Date
2026-04-14
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing multi-device keyboard and mouse control solutions suffer from cumbersome switching operations, poor protocol compatibility, and inaccurate switching triggers, resulting in low efficiency and poor user experience in multi-device collaborative control.

Method used

By constructing a continuous coordinate mapping table covering the display areas of multiple controlled devices, the automatic switching of keyboard and mouse input control is realized. Precise switching triggering is achieved by combining the connection coordinate threshold, and adaptive protocol conversion is performed according to the system input interface protocols of different controlled devices to ensure stable cross-device keyboard and mouse signal transmission.

Benefits of technology

It enables automatic switching of keyboard and mouse control without manual intervention, improving the efficiency and accuracy of multi-device collaborative control, and is compatible with various heterogeneous system environments, ensuring stable and smooth cross-device keyboard and mouse signal transmission and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122111897A_ABST
    Figure CN122111897A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of multi-device cooperative control, and specifically provides a keyboard and mouse switching control linkage method for multi-devices, which comprises the following steps: obtaining device parameters of multiple controlled devices connected with a keyboard and mouse input unit, generating a continuous coordinate mapping table containing device coordinate intervals and connection coordinate thresholds according to the display resolution and display boundary coordinates of each device; real-time receiving of pointer displacement and key trigger data of the keyboard and mouse, mapping of the pointer displacement to the coordinate mapping table to match corresponding intervals, and obtaining of real-time coordinate positions of the pointer; when the real-time coordinate positions reach the connection coordinate thresholds, switching of the keyboard and mouse input control right from an original controlled device to a corresponding target controlled device; conversion and synchronous transmission of the keyboard and mouse data according to a system input interface protocol of the target controlled device, and completion of the switching of the keyboard and mouse control right. The application effectively solves the problems of complicated switching, poor protocol adaptability and inaccurate triggering of the traditional scheme, and improves the multi-device cooperative control efficiency and use experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of multi-device collaborative control technology, specifically to a method for keyboard and mouse control linkage of multiple devices. Background Technology

[0002] With the increasing demand for multi-device collaboration in office and production scenarios, most users typically need to operate two or more controlled devices simultaneously (such as desktop and laptop computers, or computer and tablet combinations). However, traditional keyboard and mouse control solutions have significant limitations, such as:

[0003] Switching between multiple devices relies on manual operation: Existing multi-device keyboard and mouse control mostly adopts pairing switching or shortcut key switching mode. Users need to switch keyboard and mouse control by manually pressing keys, re-pairing via Bluetooth, etc., which is cumbersome and has obvious delays. This seriously interrupts the user's continuous operation process (such as cross-device document editing, video editing, data interaction) and reduces the efficiency of multi-device collaboration.

[0004] Poor device protocol compatibility: Different controlled devices have different system types (such as Windows, macOS, Android) and hardware configurations, and their system input interface protocols are incompatible with each other; existing solutions mostly use a single protocol transmission or post-adaptation mode, which is prone to problems such as data transmission failure, key / pointer signal packet loss, and response delay, and cannot adapt to heterogeneous environments with multiple devices;

[0005] The switching trigger logic lacks precision: Some simple cross-screen solutions rely solely on screen boundary triggers, lacking clear criteria for determining switching thresholds. This can easily lead to unexpected switching due to accidental boundary touches or switching failures due to ambiguous trigger conditions, further reducing operational reliability.

[0006] In summary, existing multi-device keyboard and mouse control solutions suffer from problems such as cumbersome switching operations, poor protocol compatibility, and inaccurate switching triggers, resulting in low efficiency and poor user experience in multi-device collaborative control, failing to meet users' needs for "seamless, continuous, and efficient" cross-device keyboard and mouse operation.

[0007] Therefore, the present invention provides a method for switching and linking keyboard and mouse controls across multiple devices to solve the above-mentioned problems. Summary of the Invention

[0008] To overcome the shortcomings of the prior art, the present invention provides a method for switching and linking keyboard and mouse controls across multiple devices, thereby solving the problems in the prior art.

[0009] One embodiment of the present invention provides a method for switching keyboard and mouse controls across multiple devices, comprising the following steps:

[0010] S10. Obtain device parameters of at least two controlled devices that have established wired or wireless connections with the keyboard and mouse input unit. The device parameters include the display resolution, display boundary coordinates, and system input interface protocol of each controlled device.

[0011] S20. Based on the display resolution and display boundary coordinates of all controlled devices, generate a continuous coordinate mapping table covering the display areas of all controlled devices. The continuous coordinate mapping table contains the corresponding interval of the display area of ​​each controlled device in the overall continuous coordinates, and the connection coordinate threshold of the display areas of adjacent controlled devices.

[0012] S30. Receive pointer displacement data and key trigger data output by the keyboard and mouse input unit in real time, map the pointer displacement data to the continuous coordinate mapping table, match the corresponding interval where the pointer is located, and obtain the real-time coordinate position of the pointer in the overall continuous coordinate.

[0013] S40. When the real-time coordinate position reaches the connection coordinate threshold of the display area of ​​the adjacent controlled device, the current keyboard and mouse input control is switched from the original controlled device to the target controlled device. The target controlled device is the controlled device corresponding to the display area that the real-time coordinate position is about to enter.

[0014] S50. Based on the system input interface protocol in the device parameters of the target controlled device, perform protocol conversion on the pointer displacement data and key trigger data output by the keyboard and mouse input unit, and synchronously transmit the converted pointer displacement data and key trigger data to the target controlled device to complete the switching of keyboard and mouse input control.

[0015] The keyboard and mouse control linkage method for multiple devices provided in the above embodiments has the following beneficial effects:

[0016] 1. This invention establishes a unified cross-device coordinate determination rule by constructing a continuous coordinate mapping table covering the display area of ​​multiple controlled devices. Compared with the traditional manual pairing and shortcut key switching methods, it can achieve automatic switching of keyboard and mouse control without manual intervention by the user, making the operation simpler and avoiding the interruption of continuous operation process by switching delay, thus greatly improving the efficiency of multi-device collaborative control.

[0017] 2. By implementing precise switching trigger logic based on the connection coordinate threshold, the critical judgment criteria for cross-device switching are clarified, effectively avoiding unexpected switching problems caused by accidental touch of the screen boundary. The switching trigger is more stable and reliable, improving the accuracy of keyboard and mouse control.

[0018] 3. This invention can adaptively convert keyboard and mouse data according to the system input interface protocols of different controlled devices. It is compatible with various heterogeneous system environments such as Windows, macOS, and Android. It solves the problems of poor protocol adaptability, easy packet loss in data transmission, and slow response in traditional solutions, ensuring stable and smooth cross-device keyboard and mouse signal transmission and a more consistent overall user experience. Attached Figure Description

[0019] Figure 1 The flowchart illustrates a method for multi-device keyboard and mouse control linkage provided in an embodiment of the present invention. Detailed Implementation

[0020] The technical solutions in the embodiments of the present invention will now be clearly and completely described in conjunction with the accompanying drawings.

[0021] One embodiment of the present invention provides a method for multi-device keyboard and mouse control linkage. The method relies on a keyboard and mouse input unit, which integrates a microcontroller chip (MCU), a data storage unit, a wireless / wired communication circuit, and an input acquisition circuit. The MCU integrates a cross-device control module, a storage module, a communication module, an input processing module, and a coordinate calculation module. The cross-device control module, storage module, communication module, input processing module, and coordinate calculation module mentioned in this embodiment are all functional modules implemented based on the aforementioned hardware. Specifically: the cross-device control module is responsible for device permission identification, power consumption control, wake-up recovery, and other logic; the storage module is responsible for data caching and compressed storage; the communication module is responsible for wired / wireless data transmission with the controlled device; the input processing module is responsible for keyboard and mouse operation state parsing and feature extraction; and the coordinate calculation module is responsible for building a multi-device coordinate system, calculating coordinate intervals, generating a continuous coordinate mapping table, and calibrating cross-device connection thresholds. Each module is not an independent physical device and can be implemented by those skilled in the art through conventional hardware programming and circuit integration methods.

[0022] Reference Figure 1 The keyboard and mouse control linkage method in this embodiment includes the following steps:

[0023] S10. Obtain device parameters of at least two controlled devices that have established wired or wireless connections with the keyboard and mouse input unit. The device parameters include the display resolution, display boundary coordinates, and system input interface protocol of each controlled device.

[0024] In this embodiment, this step is the initial data acquisition step of the entire keyboard and mouse switching linkage method, which is the foundation for subsequent cross-device switching and protocol adaptation. The keyboard and mouse input unit is a standardized keyboard and mouse combination. This input unit has multi-device connectivity and can establish stable communication connections with at least two controlled devices simultaneously through conventional communication methods in the field, such as wired USB direct connection, 2.4G wireless adapter, and Bluetooth 5.0 or higher. The controlled devices are intelligent terminal devices equipped with a visual display interface, including but not limited to desktop computers, laptops, Android tablets, all-in-one computers, and other electronic devices with independent data processing capabilities.

[0025] Specifically, the cross-device control module built into the keyboard and mouse input unit control chip sends standardized device parameter query commands to each connected controlled device; upon receiving the query command, each controlled device automatically reports its own core device parameters, including:

[0026] Display resolution: the total number of horizontal and vertical pixels on the screen of a controlled device, used to determine the size base of the display area of ​​a single device;

[0027] Display boundary coordinates: These are the coordinates of the edge points of the controlled device's display area in a multi-device layout, used to define the independent range of each device's display area.

[0028] System input interface protocol: This refers to the keyboard and mouse data transmission protocol adapted to the controlled device system, such as USB HID protocol, Bluetooth HID protocol, etc., which provides an adaptation basis for subsequent keyboard and mouse data protocol conversion.

[0029] S20. Based on the display resolution and display boundary coordinates of all controlled devices, generate a continuous coordinate mapping table covering the display areas of all controlled devices. The continuous coordinate mapping table contains the corresponding interval of the display area of ​​each controlled device in the overall continuous coordinates, and the connection coordinate threshold of the display areas of adjacent controlled devices.

[0030] In this embodiment, this step is the core coordinate system construction step of the entire keyboard and mouse control linkage method. By integrating the basic device data collected in S10, the independent coordinate limitation of a single device is broken, and a unified coordinate judgment benchmark across devices is established, which is the key to realizing continuous pointer movement and precise switching.

[0031] Specifically, the cross-device control module built into the keyboard and mouse input unit control chip executes the coordinate mapping table generation logic, and the core implementation process is as follows:

[0032] Establishment of the overall continuous coordinate system: Determine the origin of the overall continuous coordinate system according to preset rules (for example, select the upper left corner of the initial main control device display area among all controlled devices as the origin, the horizontal axis to the right as the positive direction of the X axis, and the vertical axis downward as the positive direction of the Y axis), and establish a two-dimensional rectangular coordinate system. The coordinate range of this system must cover the maximum boundary of the display area of ​​all controlled devices.

[0033] Single-device coordinate range matching: For each controlled device, based on its display resolution (horizontal / vertical pixel count) and display boundary coordinates, calculate the specific coordinate range of the device's display area in the overall continuous coordinate system; for example, if a controlled device has a display resolution of 1920×1080, and its display boundary coordinates correspond to the upper left corner (0,0) and lower right corner (1920,1080) of the overall coordinate system, then its coordinate range is X∈[0,1920], Y∈[0,1080], and this range uniquely corresponds to this controlled device, serving as the basis for subsequent pointer positioning;

[0034] Connecting coordinate threshold marking: For adjacent controlled devices, the adjacent edge coordinates of their coordinate intervals are extracted as the connecting coordinate threshold; for example, if the coordinate interval of device A is X∈[0,1920], Y∈[0,1080], and device B is adjacent to the right of device A, with a coordinate interval of X∈[1920,3840], Y∈[0,1080], then the connecting coordinate threshold between the two is X=1920 (vertical critical line). This threshold is used as the core judgment criterion for triggering the switching of keyboard and mouse control rights.

[0035] The generated continuous coordinate mapping table is a structured data table that stores the following information: the device identifier of each controlled device, the corresponding coordinate range (X-axis start and end values, Y-axis start and end values), the identifiers of adjacent devices, and the connection coordinate threshold. This table is cached in the storage module of the keyboard and mouse input unit for real-time retrieval during subsequent S30 coordinate matching and S40 switching judgments. This step ensures the continuity of the pointer's trajectory when moving between multiple devices through a unified coordinate system, while providing clear critical judgment criteria for precise switching, thus solving the switching chaos problem caused by the lack of a unified coordinate reference in traditional solutions.

[0036] S30. Receive pointer displacement data and key trigger data output by the keyboard and mouse input unit in real time, map the pointer displacement data to the continuous coordinate mapping table, match the corresponding interval where the pointer is located, and obtain the real-time coordinate position of the pointer in the overall continuous coordinate system.

[0037] In this embodiment, this step is a real-time data acquisition and coordinate positioning step. The core is to associate the dynamic data of keyboard and mouse operation with the unified coordinate system constructed in S20 to achieve cross-device accurate tracking of pointer position. It is a key link connecting operation input and switching trigger, ensuring the real-time performance and accuracy of control switching judgment.

[0038] Specifically, the cross-device control module built into the keyboard and mouse input unit control chip performs data processing and coordinate matching logic. The core implementation process is as follows:

[0039] Real-time data reception: The keyboard and mouse input unit collects pointer displacement data (such as the horizontal / vertical pixel increment of mouse movement and the scroll wheel scrolling amount) and key trigger data (such as keyboard key press / release signals and mouse left / right click signals) at a preset scanning frequency (such as 125Hz and 250Hz to adapt to the response requirements of conventional keyboard and mouse operations). The data is then transmitted in real time to the cross-device control module through the built-in communication module, maintaining the integrity and timing consistency of the data frames during the transmission process.

[0040] Pointer displacement data mapping: The cross-device control module calls the continuous coordinate mapping table cached in S20, and calculates the absolute coordinates of the pointer in the overall continuous coordinate system based on the pointer's "real-time coordinates at the previous moment" and the current "pointer displacement data". For example, if the pointer coordinates at the previous moment were (1800, 500), and the mouse moves 150 pixels to the right and 30 pixels down without crossing the interval boundary, then the current absolute coordinates are (1950, 530). If the displacement data causes the coordinates to approach or touch the connecting coordinate threshold, the absolute position is still calculated according to the unified coordinate system, and the positioning logic is not interrupted.

[0041] Coordinate range matching: The cross-device control module matches the calculated absolute coordinates with the coordinate ranges (X-axis start and end values, Y-axis start and end values) of each controlled device in the continuous coordinate mapping table to determine the target coordinate range to which the absolute coordinates belong, thereby locking the controlled device (i.e. the original controlled device) corresponding to the current pointer, and finally outputting real-time coordinate position data containing the absolute coordinate value and the device identifier, and caches it in the temporary storage unit for immediate retrieval during S40 switching judgment.

[0042] This step ensures the continuity and accuracy of position tracking by using a coherent logic of real-time data reception, displacement mapping, and interval matching. It avoids the problems of pointer position jumps or positioning delays in traditional solutions, and provides a clear and real-time basis for the S40 switching trigger.

[0043] S40. When the real-time coordinate position reaches the connection coordinate threshold of the display area of ​​the adjacent controlled device, the current keyboard and mouse input control is switched from the original controlled device to the target controlled device. The target controlled device is the controlled device corresponding to the display area that the real-time coordinate position is about to enter.

[0044] In this embodiment, this step is the core judgment and execution step for automatic switching of keyboard and mouse input control. Based on the continuous coordinate system and real-time coordinate positioning results constructed in the previous steps, automatic cross-device control switching is achieved without manual intervention, solving the cumbersome problem of manual operation switching required by traditional solutions.

[0045] Specifically, the cross-device control module built into the keyboard and mouse input unit control chip continuously compares the real-time coordinate position with the connection coordinate threshold in the continuous coordinate mapping table. When the real-time coordinate position of the pointer reaches or touches the critical coordinate value, the cross-device switching condition is immediately triggered. The original controlled device is the device corresponding to the display area where the pointer is currently located, and the target controlled device is the device corresponding to the adjacent display area that the pointer is about to enter along the movement direction.

[0046] During the control handover process, the cross-device control module immediately closes the transmission path of keyboard and mouse input data to the original controlled device and simultaneously opens the data transmission path to the target controlled device, completing a seamless transfer of keyboard and mouse input control. The entire handover process is automatically triggered based on coordinate thresholds, eliminating the need for manual operations such as user button presses or pairing. This ensures both the immediacy of the handover action and the continuity of the pointer movement trajectory, achieving seamless connection of keyboard and mouse control across multiple devices.

[0047] S50. Based on the system input interface protocol in the device parameters of the target controlled device, perform protocol conversion on the pointer displacement data and key trigger data output by the keyboard and mouse input unit, and synchronously transmit the converted pointer displacement data and key trigger data to the target controlled device to complete the switching of keyboard and mouse input control.

[0048] In this embodiment, this step is the protocol adaptation and data delivery execution step, which is used to solve the problem of incompatibility of input protocols of different controlled device systems, and to ensure that the keyboard and mouse data can be normally recognized and responded to by the target controlled device after switching. It is the final implementation link to achieve stable control switching in a multi-device heterogeneous environment.

[0049] Specifically, after the S40 control handover decision is completed, the cross-device control module built into the keyboard and mouse input unit control chip retrieves the system input interface protocol corresponding to the target controlled device from the pre-cached device parameters. Based on the protocol format, the original collected pointer displacement data and key trigger data are encapsulated into data frames, converted into protocol formats, and filled with check codes to ensure that the converted data fully conforms to the input recognition standard of the target controlled device.

[0050] After the protocol conversion is completed, the cross-device control module will synchronously transmit the compliant data to the target controlled device through the established wired or wireless communication link, and the input processing module of the target controlled device will parse and execute the corresponding operation; at the same time, the data transmission of keyboard and mouse to the original controlled device will be stopped, and the transfer of keyboard and mouse input control will be completely completed.

[0051] This step uses adaptive protocol conversion to be compatible with the input interface specifications of different systems such as Windows, macOS, and Android, avoiding problems such as data packet loss, response delays, or unrecognized commands. It ensures that keyboard and mouse operations take effect immediately after switching between devices, achieving seamless connection of multi-device control.

[0052] In one embodiment, after step S10, the method further includes:

[0053] S101. Identify the master device that currently holds the control of keyboard and mouse input and the slave devices that do not hold the control of keyboard and mouse input based on the device parameters of each controlled device.

[0054] In this embodiment, this step is used to distinguish among the multiple controlled devices that have established a connection from the device that currently actually controls the keyboard and mouse input, and the device that has not yet obtained the control, so as to clarify the working permission status of each device.

[0055] Specifically, the cross-device control module built into the keyboard and mouse input unit control chip identifies and distinguishes device permissions based on the parameters of each controlled device collected in step S10, combined with the current connection and interaction status between the device and the keyboard and mouse input unit: the device that is currently establishing data interaction with the keyboard and mouse input unit and can receive and respond to keyboard and mouse operation commands is identified as the master device holding keyboard and mouse input control rights; the device that only maintains a basic connection with the keyboard and mouse input unit, has not yet received keyboard and mouse operation commands, and has no keyboard and mouse input control rights is identified as a slave device; and the permission identification result is cached in the storage module for subsequent steps to call.

[0056] It should be noted that the permission identification logic of the above-mentioned cross-device control module for master and slave devices, including multi-device connection priority determination, permission mutual exclusion management, and dynamic status update, are all conventional wireless peripheral connection management methods well known to those skilled in the art. They can be implemented through conventional embedded state machine programming, and their specific implementation methods are clear to those skilled in the art.

[0057] S102. Close the data transmission channel of the wired or wireless connection between the slave device that does not have control over the keyboard and mouse input and the keyboard and mouse input unit, retain the low-power heartbeat link to maintain the connection state, extract the system input interface protocol of each slave device and cache it in the keyboard and mouse input unit, and stop the protocol parsing operation on the slave device side.

[0058] In this embodiment, this step is used to optimize the communication link and data processing logic of the slave device, reduce invalid data transmission and redundant calculations while maintaining the basic connection, and reduce the power consumption of the keyboard and mouse input unit and the slave device.

[0059] Specifically, the cross-device control module built into the keyboard and mouse input unit control chip performs the following operations: For identified slave devices, it actively closes the wired or wireless data transmission channel between the slave device and the keyboard and mouse input unit for transmitting keyboard and mouse operation data; it retains only the low-power heartbeat link, using periodic simple heartbeat signals to maintain an effective connection between the keyboard and mouse input unit and the slave device, preventing connection loss; at the same time, it extracts the system input interface protocol corresponding to each slave device from the device parameters collected and cached in step S10 and stores it in the storage module of the keyboard and mouse input unit; in addition, it sends control commands to the slave devices to stop local protocol parsing calculations for keyboard and mouse input, retaining only basic connection response capabilities.

[0060] S103. Real-time monitoring of the keyboard and mouse input status corresponding to the main control device, and dynamic generation of personalized idle threshold range based on pre-stored user historical keyboard and mouse operation data; execution of graded power consumption control based on the matching relationship between the keyboard and mouse input status and the personalized idle threshold range; wherein, graded power consumption control includes:

[0061] If the keyboard and mouse operation continues, maintain the highest scanning sampling frequency of the keyboard and mouse input unit and the operation of all hardware function modules;

[0062] If the idle time after the keyboard and mouse stop operating is within the personalized idle threshold range, reduce the scanning sampling frequency, retain only the keyboard and mouse operation detection, and turn off the rest of the hardware;

[0063] If the idle time after the keyboard and mouse stop operating reaches the upper limit of the personalized idle threshold range, the scanning sampling frequency will be reduced to the minimum working threshold, retaining only heartbeat detection and wake-up trigger detection, while the cached slave device system input interface protocol will be compressed and stored.

[0064] In this embodiment, this step is used to realize intelligent power consumption management of the keyboard and mouse input unit based on the user's actual usage habits. Without affecting the user's normal operation of the main control device, the power consumption of the device is reduced step by step according to the idle state of the keyboard and mouse, while optimizing the storage of cached data and improving overall energy efficiency.

[0065] Specifically, the pre-stored historical keyboard and mouse operation data is continuously collected by the keyboard and mouse input unit during daily use through the input acquisition circuit. This data includes usage characteristics such as continuous operation duration, operation interval, idle time distribution, and the time pattern of resuming operation after idleness. This data is periodically summarized and stored in the storage module to form the pre-stored historical keyboard and mouse operation data. When power consumption adjustment is required, the cross-device control module retrieves this historical behavior data and performs statistical analysis. It extracts the time nodes of high-frequency resumption of operation after idleness in daily use and determines these time nodes as the starting value of the personalized idle threshold range. At the same time, it extracts the time nodes when the user has not operated for a long time and is likely to leave the usage scenario, and determines these time nodes as the upper limit of the personalized idle threshold range. Based on this, a personalized idle threshold range adapted to the user's usage habits is calculated and generated. For example, based on the statistical analysis of the user's historical behavior data, it is highly likely that the user will resume keyboard and mouse operation after 3 minutes of idleness, and idleness exceeding 15 minutes is mostly due to leaving the usage scenario. Therefore, the generated personalized idle threshold range is 3 minutes to 15 minutes.

[0066] It should be noted that if the user has no historical keyboard and mouse operation data, the personalized idle threshold range is set according to the general standard preset by the device at the factory. That is, the factory default short idle time is used as the threshold starting value and the factory default long idle time is used as the threshold upper limit, which is suitable for the general usage scenarios of most users. For example, the factory default threshold starting value is 2 minutes and the threshold upper limit is 10 minutes, which is used as the initial general idle threshold range.

[0067] This step uses an input acquisition circuit to monitor the keyboard and mouse input status applied to the main control device in real time, determining whether the keyboard and mouse are in a continuous operation state or an idle state. After the keyboard and mouse enter the idle state, the real-time idle duration is timed and matched with a personalized idle threshold range. Based on the matching result, the corresponding graded power consumption control strategy is executed.

[0068] When the input acquisition circuit detects that the keyboard and mouse operation is continuous and idle without interruption, the cross-device control module controls the keyboard and mouse input unit to maintain the highest scanning sampling frequency, ensuring the normal operation of all hardware functional modules such as the communication module and input processing module, and ensuring the response speed and smoothness of the keyboard and mouse operation.

[0069] When the real-time idle time after the keyboard and mouse stop operating is within the range of the generated personalized idle threshold, the cross-device control module commands to reduce the scanning sampling frequency of the keyboard and mouse input unit, retain only the keyboard and mouse operation detection function of the input acquisition circuit, and turn off unnecessary hardware modules such as indicator lights and redundant verification circuits to reduce unnecessary power consumption.

[0070] When the real-time idle time after the keyboard and mouse stop operating reaches the upper limit of the personalized idle threshold range, the cross-device control module reduces the scanning sampling frequency of the keyboard and mouse input unit to the minimum working threshold, retaining only the heartbeat detection and wake-up trigger detection related functions. At the same time, the drive storage module compresses and stores the cached slave device system input interface protocol to further reduce the device's operating and storage power consumption.

[0071] The above-mentioned graded power consumption control strategy not only ensures a smooth user experience for keyboard and mouse operation on the main control device, but also achieves a gradual reduction in power consumption of the keyboard and mouse input units as needed. At the same time, it optimizes the storage efficiency of the slave device protocol and improves the overall energy efficiency and operational stability in multi-device collaborative scenarios.

[0072] S104. When a wake-up trigger action of the keyboard and mouse input unit is detected, a graded recovery is performed based on the amplitude characteristics of the wake-up trigger action; wherein, the amplitude characteristics of the wake-up trigger action include pointer displacement acceleration, key trigger force, and operation continuity; the graded recovery includes:

[0073] If the amplitude of the wake-up trigger action is less than a preset amplitude threshold, the recovery operation will not be performed to filter out accidental touch behavior;

[0074] When the amplitude of the wake-up trigger action is within the preset amplitude threshold range, the scanning sampling frequency is restored to the range corresponding to the idle time after the keyboard and mouse stop operation is within the personalized idle threshold range, and only the keyboard and mouse operation detection is retained;

[0075] When the amplitude of the wake-up trigger action exceeds the preset amplitude threshold range, the system restores to the highest scanning sampling frequency and all hardware function modules corresponding to the continuous keyboard and mouse operation, and activates the cached slave device system input interface protocol.

[0076] In this embodiment, this step is used to accurately identify and classify keyboard and mouse wake-up trigger actions. By distinguishing between valid operations and invalid accidental touches through the characteristics of the action amplitude, it avoids increased power consumption caused by accidental wake-ups. At the same time, it matches the corresponding working mode according to the user's actual operation intention, taking into account both low power consumption and operation response efficiency. It can also prepare the protocol in advance for subsequent cross-device control switching.

[0077] Specifically, the cross-device control module built into the keyboard and mouse input unit control chip works in conjunction with the input acquisition circuit to perform the operation: the input acquisition circuit monitors in real time whether there are wake-up trigger actions such as mouse movement, key press, scroll wheel scrolling, etc. If a wake-up trigger action is detected, the amplitude characteristic parameters of the action are further extracted, including pointer displacement acceleration, key trigger force and operation continuity.

[0078] The preset amplitude threshold mentioned in this step is a graded judgment standard that combines three features: pointer displacement acceleration, key trigger force, and operation continuity. The threshold definition methods for each feature are as follows:

[0079] Pointer displacement acceleration: The factory preset lower threshold is 0.1g (unit of gravitational acceleration) and the upper threshold is 0.5g. An acceleration below 0.1g indicates very slight displacement, 0.1g-0.5g indicates slow and small movement, and above 0.5g indicates rapid and large movement.

[0080] Button trigger force: The factory preset lower threshold is 10g trigger force and the upper threshold is 30g trigger force. A force below 10g is an invalid light touch, 10g-30g is an effective light press, and a force above 30g is a regular press.

[0081] Operational continuity: The factory preset lower threshold is 1 independent trigger and the upper threshold is 3 consecutive triggers. Less than 1 trigger is considered unintentional jitter, 1-3 triggers is considered a single light operation, and more than 3 triggers is considered a continuous high-frequency operation.

[0082] The above thresholds can be adaptively fine-tuned based on the user's historical operating habits. When there is no historical data, the above factory preset standard is directly adopted. The cross-device control module will synchronously compare the three extracted feature parameters with the corresponding thresholds and execute the corresponding graded recovery logic according to the comprehensive comparison result.

[0083] When the pointer displacement acceleration, key trigger force, and operation continuity corresponding to the wake-up trigger action are all lower than the lower limit of their respective preset threshold values, the corresponding manifestations are that the mouse undergoes a very slight displacement and the keyboard key is lightly touched but not effectively pressed. Such actions have no clear operation direction and are objectively judged as user accidental touch behavior. The cross-device control module does not perform any performance recovery operation and maintains the current low-power operation state.

[0084] When the pointer displacement acceleration, key trigger force, and operation continuity corresponding to the wake-up trigger action are within the value range of their respective preset thresholds, the corresponding behavior is slow and small mouse movement and single light key press on the keyboard. Such actions have basic operation intentions, and it is objectively determined that the user has a slight intention to use the device. The cross-device control module controls the keyboard and mouse input unit to restore the scanning sampling frequency corresponding to the personalized idle threshold range, and only enables the keyboard and mouse operation detection function to maintain basic operation response capabilities.

[0085] When the pointer displacement acceleration, key trigger force, and operation continuity corresponding to the wake-up trigger action are all higher than the upper limit of their respective preset thresholds, the corresponding manifestations are rapid and large mouse movements and multiple consecutive key presses on the keyboard. Such actions have clear continuous operation requirements, and it is objectively determined that the user has a continuous high-frequency formal operation requirement. The cross-device control module controls the keyboard and mouse input unit to immediately restore to the highest scanning sampling frequency, re-enables all hardware function modules, and decompresses and activates the slave device system input interface protocol compressed and cached in the storage module, so that it is in a state that can be quickly called.

[0086] This tiered recovery mechanism effectively filters out unnecessary power consumption caused by unintentional touches, quickly responds to real user operation needs, and reserves efficient protocol call conditions for subsequent cross-device control switching.

[0087] S105. Update the pre-stored user history keyboard and mouse operation behavior data according to the preset cycle, and recalibrate the personalized idle threshold range based on the updated user history keyboard and mouse operation behavior data.

[0088] In this embodiment, this step is used to achieve dynamic optimization and adaptation of the personalized idle threshold range, avoid threshold mismatch caused by changes in the user's keyboard and mouse operation habits, and ensure that the graded power consumption control of S103 always fits the user's current usage scenario, taking into account both low power consumption and the stability of the operation experience.

[0089] Specifically, the cross-device control module built into the keyboard and mouse input unit control chip performs the relevant operations, which are mainly divided into two steps: data update and threshold calibration.

[0090] Data Update: First, according to a preset cycle (the factory default cycle can be set to 7 days, and users can customize the cycle length through the accompanying configuration interface), the latest keyboard and mouse operation behavior data of the user on the keyboard and mouse input unit within that cycle is retrieved from the input acquisition circuit. This includes feature information such as newly added continuous operation duration, operation interval, idle time distribution, and time pattern of operation resumption after idleness. Then, the newly added data is merged and updated with the original historical data in the storage module, using an incremental supplementation + outdated data elimination mechanism. Valid operation data within the last 3 preset cycles is retained, and outdated data that exceeds the time range is deleted, ensuring that the pre-stored user historical keyboard and mouse operation behavior data always reflects the user's recent usage habits.

[0091] Threshold calibration: Based on the updated user history keyboard and mouse operation data, the threshold calculation logic consistent with S103 is used to re-analyze the time nodes of high-frequency recovery operations after recent inactivity (as the new threshold starting value), and the time nodes of recent long-term inactivity and high probability of being out of use (as the new threshold upper limit). Based on this, a new personalized idle threshold range is generated. After calibration, the new threshold range is used to overwrite the original threshold data in the storage module.

[0092] For example, if a user's initial usage habit is to frequently resume operation after 3 minutes of inactivity and leave the scene after 15 minutes of inactivity, the corresponding personalized idle threshold range is 3-15 minutes. After one preset cycle (7 days), the cross-device control module finds that the user has recently significantly increased the frequency of resuming operation after 5 minutes of inactivity and is more likely to leave the scene after 18 minutes of inactivity. Therefore, this step updates the historical data and recalibrates the personalized idle threshold range to 5-18 minutes, so that subsequent power consumption control is more in line with the user's current usage habits.

[0093] Through periodic data updates and threshold calibration in this step, "dynamic adaptation" of personalized idle thresholds is achieved, avoiding the problem of decreased power consumption control accuracy caused by long-term fixed thresholds, and further improving the energy efficiency optimization effect in multi-device collaborative scenarios.

[0094] In one embodiment, step S20 specifically includes the following steps:

[0095] S21. Taking the upper left corner of the display area of ​​one of the controlled devices that serves as the initial control object for the keyboard and mouse among all controlled devices as the origin of the overall continuous coordinate system, determine the coordinate interval of the corresponding keyboard and mouse movement range in the overall continuous coordinate system based on the display resolution and display boundary coordinates of the controlled device, and take this coordinate interval as the initial coordinate interval; the horizontal axis range and vertical axis range of the coordinate interval match the display resolution of the controlled device, and the keyboard and mouse input control right is associated with the coordinate interval.

[0096] In this embodiment, this step is used to build a continuous coordinate reference system for multi-device collaboration, select the coordinate rules of the initial controlled device and establish the binding relationship between keyboard and mouse input control and coordinate range, clarify the mapping logic between coordinates and device display area, and provide a unified and unique reference for the seamless splicing of coordinates of all subsequent devices, avoiding conflicts or gaps in the coordinate systems of multiple devices.

[0097] Specifically, the coordinate calculation module built into the keyboard and mouse input unit control chip performs the following operations: First, it identifies the initial controlled object, which is the default control device specified when the user first pairs the keyboard and mouse input unit (or the initial controlled device pre-set through the matching configuration interface), and sets it as the reference device of the coordinate system. Then, it defines the absolute origin (0,0) of the overall continuous coordinate system, using the upper left corner of the physical display area of ​​the reference device as the reference point. This origin is the only reference for all subsequent device coordinate calculations. Next, it reads two core parameters of the reference device: display resolution (e.g., 1920 pixels × 1080 pixels, i.e., 1920 pixels horizontally and 1080 pixels vertically) and display boundary coordinates (the physical coordinates of the upper right corner of the display area, whose values ​​correspond one-to-one with the display resolution). For example, the display boundary coordinates corresponding to a resolution of 1920×1080 are (1920, 1080). Based on the origin (0, 0) and the display boundary coordinates, the keyboard and mouse movement coordinate range corresponding to the reference device is directly determined to be 0~1920 on the horizontal axis and 0~1080 on the vertical axis. The horizontal range of this coordinate range is equal to the number of horizontal pixels of the display resolution, and the vertical range is equal to the number of vertical pixels of the display resolution, realizing a 1:1 match between the coordinate range and the device display area. Finally, a fixed association rule is established. The keyboard and mouse input unit detects the coordinate position of the mouse pointer in real time. When the pointer coordinates are within the above initial coordinate range, it is automatically determined that the current keyboard and mouse input control belongs to the reference device. All keyboard and mouse operation commands are only transmitted to the reference device, realizing a unique correspondence between coordinate range, device, and control.

[0098] S22. Sequentially acquire the display resolution and display boundary coordinates of each of the remaining controlled devices, determine the corresponding coordinate intervals, and seamlessly connect the coordinate intervals of each of the remaining controlled devices to the edge of the determined coordinate interval, based on the initial coordinate interval, according to the preset cross-device movement connection direction of the keyboard and mouse. All coordinate intervals are connected without overlap or gaps only along the preset cross-device movement connection direction, forming a continuous coordinate domain adapted to linear keyboard and mouse movement. The preset cross-device movement connection direction is either horizontal (left-right) or vertical (up-down). All coordinate intervals are arranged sequentially along a single preset direction, and the connection edge of adjacent coordinate intervals is a critical line along a single axis direction, to adapt to the switching of cross-device keyboard and mouse input control triggered by the mouse pointer moving along a straight line.

[0099] In this embodiment, this step is used to integrate the physical display areas of multiple independent controlled devices into a single-dimensional, non-overlapping, and uninterrupted linear continuous coordinate domain through standardized coordinate rules. This fundamentally solves the problem of spatial continuity of keyboard and mouse movement between multiple devices. By limiting a single connection direction and precise edge alignment rules, the mouse can naturally cross devices simply by moving along a horizontal or vertical straight line without additional operations (such as shortcut keys or clicking confirmation). At the same time, it avoids complex coordinate transformation algorithms, ensuring real-time and smooth switching between devices and improving the user experience.

[0100] Specifically, the coordinate calculation module built into the control chip of the keyboard and mouse input unit coordinates with the communication module to perform the operation, which is mainly divided into four steps: parameter acquisition, interval calculation, direction adaptation, and seamless stitching.

[0101] Parameter acquisition: The coordinate calculation module sends parameter request commands to each of the other controlled devices sequentially through the communication module (wireless / wired communication circuit) to obtain the display resolution of each device (e.g., 1920×1080 for the second device, 2560×1440 for the third device) and display boundary coordinates (the physical coordinates of the upper right corner of the display area, whose values ​​correspond one-to-one with its own display resolution; for example, the display boundary coordinates of a device with a resolution of 1920×1080 are (1920, 1080); and the display boundary coordinates of a device with a resolution of 2560×1440 are (2560, 1440)).

[0102] Independent coordinate interval calculation: For each device to be connected, the coordinate interval calculation logic of S21 is followed. The independent coordinate interval of each device is generated with "the number of horizontal pixels of its own display resolution as the horizontal axis range and the number of vertical pixels as the vertical axis range" (only the starting coordinate is not determined, the range is fixed). For example, the independent interval range of the second 1920×1080 device is "horizontal axis length 1920, vertical axis length 1080", and the independent interval range of the third 2560×1440 device is "horizontal axis length 2560, vertical axis length 1440".

[0103] Connection direction preset and adaptation: The preset keyboard and mouse cross-device movement connection direction is determined in two ways: one is that the user manually selects (horizontal / vertical) through the corresponding configuration interface, and the other is that the device defaults to horizontal connection by the factory; and the rule is clear: all devices are connected only in a single direction, and horizontal and vertical mixed arrangement is not allowed to ensure the linear characteristics of the coordinate domain;

[0104] Seamless stitching execution: Starting from the initial coordinate interval, the coordinate calculation module sequentially adjusts the starting coordinates of the independent coordinate intervals of each device according to a preset direction to achieve precise alignment with the edge of the stitched interval. The specific stitching logic is as follows:

[0105] If the default setting is horizontal left and right connection: the vertical axis coordinate range of all devices is forced to be consistent with the vertical axis range of the initial coordinate interval (ensuring that the vertical position remains unchanged when the mouse moves horizontally, without vertical offset), adjacent coordinate intervals are only connected in the horizontal axis direction, and the maximum value of the horizontal axis of the previous interval is equal to the minimum value of the horizontal axis of the next interval, with no overlap or gap; the connection edge is the vertical axis direction critical line (i.e., the horizontal axis fixed value), which serves as the judgment boundary for the mouse to cross devices.

[0106] For example: the initial coordinate range is (0,0)-(1920,1080) (vertical axis 0~1080). When connecting to the second 1920×1080 device, the starting horizontal axis of its coordinate range is set to 1920, and the vertical axis remains 0~1080, with the final range being (1920,0)-(3840,1080). When connecting to the third 2560×1440 device, its vertical axis range is forced to adapt to 0~1080 (only the corresponding vertical range of the device display area is enabled to ensure seamless keyboard and mouse movement), the starting value of the horizontal axis is set to 3840, and the final range is (3840,0)-(6400,1080). The three horizontal axis ranges are seamlessly connected (0~1920→1920~3840→3840~6400).

[0107] If the default setting is vertical vertical connection: the horizontal coordinate range of all devices is forced to be consistent with the horizontal coordinate range of the initial coordinate interval (ensuring that the horizontal position remains unchanged when the mouse moves vertically, without left or right offset), adjacent coordinate intervals are only connected in the vertical direction, and the maximum value of the vertical axis of the previous interval is equal to the minimum value of the vertical axis of the next interval, with no overlap or gap; the connection edge is the horizontal axis critical line (i.e., the vertical axis fixed value), which serves as the judgment boundary for the mouse to cross devices.

[0108] For example: the initial coordinate range is (0,0)-(1920,1080) (horizontal axis 0~1920). When connecting the second 2560×1440 device vertically, its horizontal axis range is forced to adapt to 0~1920, the initial value of the vertical axis is set to 1080, and the final range is (0,1080)-(1920,2520) (1080+1440=2520). The vertical axes of the two ranges are seamlessly connected (0~1080→1080~2520).

[0109] Through the above rules, the coordinate range of all controlled devices forms a linear continuous coordinate domain along a single direction. When the mouse pointer moves along this direction to the connecting edge (critical line), it can trigger the subsequent cross-device control switch, ensuring that the operation logic is consistent with the use of a single device.

[0110] S23. Obtain and integrate the device identifier, display resolution and corresponding coordinate interval parameters of each controlled device, and mark the connection coordinate threshold between adjacent coordinate intervals. The connection coordinate threshold is the critical coordinate value for switching keyboard and mouse input control across devices, and generate a continuous coordinate mapping table covering the display area of ​​all controlled devices.

[0111] In this embodiment, this step is used to standardize, integrate, and structure the multi-device core parameters (device identity, resolution, coordinate range) and key control thresholds (connection coordinate thresholds) that were calculated separately in S21 and S22, generating a unified and quickly searchable continuous coordinate mapping table. Its core purpose is to provide direct data query basis for subsequent "real-time mouse coordinate positioning - control ownership determination - cross-device switching triggering," avoiding repeated calculation of coordinate relationships for each mouse movement, thereby improving the response speed of cross-device switching while ensuring the accuracy and consistency of control ownership switching.

[0112] Specifically, the coordinate calculation module built into the keyboard and mouse input unit control chip, in conjunction with the storage module, performs operations to uniformly collect, organize, and structure the coordinate-related data from multiple devices:

[0113] The coordinate calculation module collects three types of core parameters for each controlled device and normalizes them according to a unified format to avoid format conflicts or parsing ambiguities. Among them, the device identifier uses unique identification information such as the device MAC address, factory serial number or user-defined device name, which serves as a unique index for binding the subsequent coordinate interval to the device to prevent confusion between multiple devices. The display resolution is recorded in the standard format of "horizontal pixels × vertical pixels", which directly relates it to the horizontal and vertical axis range of the coordinate interval, facilitating subsequent rapid verification of coordinate matching. The corresponding coordinate interval is recorded in the unified form of "lower left corner coordinate - (upper right corner coordinate)", clearly defining the specific position range of each device in the continuous coordinate domain. After integration, each device forms a set of associated data groups of "device identifier - display resolution - coordinate interval". All data groups are arranged in the order of "initial device → subsequent connected devices", which is consistent with the actual layout direction of the continuous coordinate domain.

[0114] The coordinate calculation module iterates through all integrated coordinate intervals, extracts the coordinate values ​​of the connection boundary for each pair of adjacent coordinate intervals as the connection coordinate threshold, and clarifies the trigger direction and target switching device corresponding to each threshold to avoid one-way switching or incorrect switching targets. In the horizontal left-right connection scenario, the adjacent intervals use the horizontal axis as the connection boundary, and this value is the connection coordinate threshold. At the same time, bidirectional trigger logic is marked, that is, when the mouse crosses the threshold from left to right, it switches to the corresponding device on the right, and when it crosses the threshold from right to left, it switches to the corresponding device on the left. In the vertical up-down connection scenario, the adjacent intervals use the vertical axis as the connection boundary, and this value is the connection coordinate threshold. Similarly, bidirectional trigger logic is marked, that is, when the mouse crosses the threshold from bottom to top, it switches to the corresponding device above, and when it crosses the threshold from top to bottom, it switches to the corresponding device below. Finally, each connection boundary corresponds to a bidirectional triggerable connection coordinate threshold. All thresholds are bound to the corresponding device identifier and switching logic to form a complete threshold association table.

[0115] The coordinate calculation module integrates the aforementioned device-related data group with the threshold-related table to generate a structured continuous coordinate mapping table. This mapping table is stored in a field-based format to enable subsequent fast retrieval. The core fields include: device identifier, display resolution, coordinate range (lower left corner X / Y, upper right corner X / Y), left-side connection threshold, right-side connection threshold (horizontal scene) / upper-side connection threshold, lower-side connection threshold (vertical scene), and corresponding switching device identifier. After generation, the coordinate calculation module stores the mapping table in the storage module and uses a high-speed cache mode (to ensure subsequent fast retrieval). At the same time, an update mechanism is established: if a controlled device is added, removed, or the connection direction is adjusted, steps S21-S23 will be re-executed to update the mapping table and overwrite the original data, ensuring that the mapping table is consistent with the actual device configuration.

[0116] During subsequent mouse movement, the cross-device control module only needs to retrieve the mapping table, quickly compare the real-time mouse coordinates with the coordinate range and connection threshold in the table, and immediately determine the ownership of control and trigger cross-device switching. There is no need to repeat coordinate calculations, ensuring low latency and high smoothness of cross-device control of keyboard and mouse.

[0117] It should be noted that the coordinate interval splicing, connection threshold calibration, and non-overlapping and gapless verification algorithms used by the above coordinate calculation module to generate the continuous coordinate mapping table are all conventional calculation methods for multi-screen display coordinate mapping that are well known to those skilled in the art. They belong to the conventional coordinate transformation logic in the field of multi-device input control, and their specific implementation methods are clear to those skilled in the art.

[0118] In one embodiment, step S40 specifically includes the following steps:

[0119] S41. Obtain the connection coordinate threshold between the real-time coordinate position and the marked adjacent coordinate interval, input the pre-trained coordinate switching judgment model, and output the judgment result of whether the keyboard and mouse input control switching is triggered based on the continuous coordinate mapping table and the device identifier of each controlled device.

[0120] In this embodiment, specifically, the intention to switch keyboard and mouse input control is determined in real time based on a pre-trained coordinate switching judgment model. The specific logic is as follows: the keyboard and mouse input unit first collects the real-time coordinate position of the mouse pointer in the overall continuous coordinate system, and obtains the connection coordinate threshold corresponding to the adjacent coordinate intervals of the pointer based on the pre-stored continuous coordinate mapping table. At the same time, the real-time inference features required by the model are extracted synchronously in the following ways: the distance between the real-time coordinates and the connection threshold is obtained by calculating the absolute value of the difference between the horizontal / vertical coordinates of the pointer's real-time coordinates and the connection coordinate threshold; the displacement rate of the pointer in the boundary region is calculated by the ratio of the displacement pixels of the pointer coordinates in multiple consecutive frames to the sampling time interval; the boundary dwell time is obtained by multiplying the number of sampling frames in which the pointer coordinates are continuously in the adjacent interval of the connection threshold by the single frame sampling period.

[0121] Then, the above real-time features are input into the pre-trained coordinate switching judgment model. During the inference process, the model combines the coordinate interval division relationship of the continuous coordinate mapping table and the unique device identifier corresponding to each controlled device to distinguish the device connection scenario and device affiliation relationship where the pointer is located. The model completes the calculation according to the rule that if the trigger switching probability is greater than 0.9, it is determined to be a trigger switching. Finally, the model outputs the judgment result of whether the keyboard and mouse input control switching is triggered.

[0122] For example, if the real-time coordinates of the mouse pointer are (1918, 520), the corresponding connection coordinate threshold is X=1920, and the extracted real-time features are [12 pixels / ms, 2 pixels, 90ms, 1]. After inputting this set of features into the coordinate switching judgment model, the output trigger switching probability is 0.95, which is greater than the preset judgment threshold of 0.9. The model finally outputs the judgment result of "triggering keyboard and mouse input control switching". If the real-time coordinates of the pointer are (1905, 510), and the real-time features are [3 pixels / ms, 15 pixels, 40ms, 1], the model calculates the trigger switching probability to be 0.23. Then, the final output is the judgment result of "not triggering keyboard and mouse input control switching".

[0123] S42. When the coordinate switching judgment model outputs a judgment result that triggers the switching of keyboard and mouse input control, the target controlled device to be switched and its corresponding device identifier are obtained according to the connection coordinate threshold, and a control switching instruction including an input data pause transmission instruction and an input data ready reception instruction is generated.

[0124] In this embodiment, specifically, this step is the target device location and switching instruction generation stage after triggering the switch. The entire process is based on pre-stored data and standardized rules, with no redundant calculations. The specific logic is as follows: First, the connection coordinate threshold obtained in S41 is used as the core matching basis. Combined with the pre-stored continuous coordinate mapping table, according to the coordinate interval division rules of each controlled device in the mapping table, the crossing direction corresponding to the connection coordinate threshold is determined (e.g., if the horizontal connection threshold X=1920, and the pointer crosses from X<1920 to X>1920, then the matching coordinate interval is (1920,0)-(3840,1080)). Then, the target controlled device to be switched corresponding to the coordinate interval is locked, and the target controlled device is extracted from the mapping table. The unique device identifier of the controlled device (such as MAC address AA:BB:CC:DD:EE:FF or factory serial number SN202405001) ensures accurate and unambiguous device identity. Then, based on the identity information of the original controlled device (the device currently holding keyboard and mouse control) and the target controlled device, a standardized control switching instruction set is generated. This instruction set contains only two types of core function instructions: ① Input data pause transmission instruction (carrying the original controlled device identifier, used to inform the original device to stop receiving keyboard and mouse data); ② Input data prepare to receive instruction (carrying the target controlled device identifier, used to notify the target device to start data reception preparation). Both types of instructions include timestamps and checksums to ensure that no instructions are lost or falsely triggered during transmission.

[0125] For example, in S41, the threshold for connecting coordinates is X=1920. In the continuous coordinate mapping table, the target controlled device corresponding to X>1920 is device B, whose device identifier is the MAC address BB:CC:DD:EE:FF:GG. Then, the target device B and its corresponding identifier are matched. Subsequently, a control switching instruction set is generated: input data pause transmission instruction (instruction content: "Device A (identifier AA:BB:CC:DD:EE:FF), pause receiving pointer displacement data and key trigger data") and input data prepare to receive instruction (instruction content: "Device B (identifier BB:CC:DD:EE:FF:GG), start input data receiving channel, prepare to receive keyboard and mouse data"). The two types of instructions are encapsulated into a unified format and await subsequent execution.

[0126] S43. Based on the control switching instruction, send an input data pause transmission instruction to the original controlled device to stop transmitting pointer displacement data and key trigger data to the original controlled device. At the same time, send an input data preparation reception instruction to the target controlled device to wake up the input data reception channel of the target controlled device.

[0127] In this embodiment, specifically, this step is the "instruction execution and state synchronization" stage of control switching. The core is to achieve coordination between the original device stopping transmission and the target device waking up through bidirectional instruction transmission, avoiding data loss or mistransmission of keyboard and mouse data. The specific logic is as follows: First, the keyboard and mouse input unit parses the control switching instruction set generated by S42, separating the "input data pause transmission instruction" carrying the identifier of the original controlled device and the "input data prepare to receive instruction" carrying the identifier of the target controlled device. Instruction transmission is then synchronously initiated through the communication interface built into the keyboard and mouse input unit (such as USB or Bluetooth) (instruction transmission time difference ≤ 1ms, ensuring coordinated actions). Secondly, after receiving the instruction, the original controlled device performs a legality check based on the checksum in the instruction. Once the check passes, it immediately executes a "data transmission pause" operation, stopping the reception and processing of pointer displacement data (such as coordinate changes) and key trigger data (such as left clicks and keyboard character input) from the keyboard and mouse input unit. At the same time, it returns a "pause confirmation response" (carrying the device identifier and pause completion timestamp) to the keyboard and mouse input unit. Meanwhile, after receiving the instruction, the target controlled device also verifies the validity of the instruction through the checksum, and then executes a "receive channel wake-up" operation. This activates its own input data receiving hardware interface (such as a USB HID interface), initializes the data receiving buffer, and resets the receiving status flag to ensure that it can receive subsequent keyboard and mouse data in real time. It then returns a "wake-up ready response" (carrying the device identifier and channel ready timestamp) to the keyboard and mouse input unit. Throughout the process, the keyboard and mouse input unit temporarily stores the instantaneous keyboard and mouse data after the instruction is sent (the buffer capacity is ≤10 frames to avoid occupying too much MCU storage resources). It then forwards the data after the target device confirms that it is ready, preventing data loss.

[0128] For example, the instruction generated in S42 corresponds to the original controlled device A (identifier AA:BB:CC:DD:EE:FF) and the target controlled device B (identifier BB:CC:DD:EE:FF:GG). The keyboard and mouse input unit sends an input data pause transmission instruction to device A via the USB interface. After device A verifies the data, it stops receiving pointer displacement data (such as coordinate changes such as (1925,521)) and key data (such as the left button trigger signal that has not been released), and returns "Device A has paused data reception, timestamp 202406011000001". At the same time, it sends an input data preparation reception instruction to device B via the Bluetooth interface. After device B verifies the data, it activates the USB HID receiving channel, initializes a 128-byte data buffer, and returns "Device B receiving channel has been woken up, timestamp 202406011000001". The keyboard and mouse input unit temporarily stores one frame of pointer coordinates (1930,522) generated during the pause, waiting for subsequent forwarding.

[0129] S44. When the original controlled device completes the data transmission pause and the target controlled device completes the input channel wake-up, the keyboard and mouse input control is switched from the original controlled device to the target controlled device.

[0130] In this embodiment, this step is specifically the final execution stage of the keyboard and mouse input control handover. Its core is a seamless handover based on a "double confirmation" mechanism, ensuring no data loss and no operational lag during the handover process. The specific logic is as follows: First, the keyboard and mouse input unit continuously monitors the "pause confirmation response" of the original controlled device and the "wake-up ready response" of the target controlled device. Only when both types of responses have been received (the response reception timeout threshold is set to 5ms; if it times out, the command is resent), and the status synchronization is verified through the device identifier and timestamp in the response, is the control handover process initiated. Second, the keyboard and mouse input unit internally updates the "control identifier registry"—removing the current control-holding device from the original controlled device identifier (e.g., MAC address AA:BB:C). The C:DD:EE:FF) identifier is updated to the target controlled device identifier (such as the MAC address BB:CC:DD:EE:FF:GG). At the same time, the data transmission routing table is switched to direct the transmission destination of the subsequently collected keyboard and mouse data (pointer displacement, key trigger) to the target controlled device. Subsequently, the momentary keyboard and mouse data temporarily stored in S43 (such as 1 frame pointer coordinates (1930,522)) is forwarded to the target controlled device first to ensure the continuity of operation before and after the switch. Finally, the keyboard and mouse input unit sends a "control release confirmation" instruction to the original controlled device to inform it that it can enter the low power state (optional), and sends a "control takeover successful" instruction to the target controlled device to trigger it to start processing keyboard and mouse data normally, completing the entire control transfer process.

[0131] For example, the keyboard and mouse input unit receives a "pause confirmation response" (timestamp 202406011000001) from device A and a "wake-up ready response" (timestamp 202406011000001) from device B. After verifying that the identifiers and timestamps of both devices are consistent, the control registration form is updated to "current controlling device: device B (BB:CC:DD:EE:FF:GG)", and the data transmission route is switched to device B. The temporarily stored pointer coordinates (1930, 522) are sent to device B. Subsequently, the newly acquired pointer coordinates (1935, 523), keyboard "Ctrl" key press data, etc., are all directly transmitted to device B. At the same time, a "control rights released" command is sent to device A, and device A stops listening to the keyboard and mouse data channel. The entire switching process takes ≤3ms, and the user does not experience any lag.

[0132] In one embodiment, the training of the coordinate switching judgment model includes the following steps:

[0133] S401. Collect multiple sets of historical keyboard and mouse control switching data. The historical keyboard and mouse control switching data includes continuous coordinate mapping table samples, pointer real-time coordinate position samples, connection coordinate threshold samples, controlled device device identifier samples, and corresponding tag samples indicating whether keyboard and mouse input control switching is triggered.

[0134] In this embodiment, specifically, this step performs the collection of multiple sets of historical keyboard and mouse control linkage data. The collected historical keyboard and mouse control linkage data specifically includes five types of samples, including:

[0135] The continuous coordinate mapping table sample contains data related to the continuous coordinate mapping table generated for different controlled device layouts. It is used to reflect the range of each controlled device's display area in the overall continuous coordinate system and the adjacent connection relationship (e.g., when two 1920×1080 devices are connected horizontally, the mapping table records the coordinate range of device A as (0,0)-(1920,1080), the coordinate range of device B as (1920,0)-(3840,1080), and the adjacent connection relationship between the two).

[0136] The pointer real-time coordinate position sample is the real-time coordinate point data recorded when the mouse pointer moves in the overall continuous coordinate system (such as the coordinate sequence [(1850,480),(1880,482),(1910,483),(1920,485)] recorded at a sampling frequency of 125Hz).

[0137] The connection coordinate threshold sample is the critical coordinate value data between the display areas of adjacent controlled devices marked in the continuous coordinate mapping table (such as the connection coordinate threshold of device A and device B in the above horizontal connection scenario, which is X=1920, and the connection coordinate threshold of device C and device D in the vertical connection scenario, which is Y=1080).

[0138] The controlled device identification sample is a unique identification data corresponding to each controlled device, used to distinguish different controlled device entities (such as device MAC address AA:BB:CC:DD:EE:FF, factory serial number SN202405001).

[0139] The corresponding label samples for whether or not the switch of keyboard and mouse input control is matched with the above types of samples and marked with the judgment result data of whether or not the switch of keyboard and mouse input control needs to be triggered (such as the pointer coordinate sequence [(1910,483),(1920,485),(1930,486)] is marked as “trigger switch of keyboard and mouse input control”, and the pointer coordinate only briefly touches the threshold and then returns, which is marked as “does not trigger switch of keyboard and mouse input control”).

[0140] S402. Extract features from the historical keyboard and mouse control linkage data, construct a model training dataset based on the extracted feature data, and divide it into a training subset and a validation subset according to a preset ratio.

[0141] In this embodiment, specifically, this step first performs standardized feature extraction on the multiple sets of historical keyboard and mouse switching linkage data collected in step S401, filters out effective features that have a key impact on the keyboard and mouse switching judgment from various original samples, and removes duplicate and invalid redundant data. Among them, the extracted features include the displacement rate of the pointer in continuous coordinates, the distance between the real-time coordinates of the pointer and the connection coordinate threshold, the dwell time of the pointer in the boundary area, and the device connection direction features, such as extracting the pointer movement rate of 10 pixels / frame, the minimum distance between the pointer and the connection threshold X=1920 of 0 pixels, and the boundary dwell time of 80ms from the pointer real-time coordinate sequence (1910,483), (1920,485), (1930,486).

[0142] After feature extraction, the feature data corresponding to each group of samples is bound and integrated with the label samples that trigger the switching of keyboard and mouse input control, forming a standardized model training dataset with a unified format that can be directly used for model training. Finally, the model training dataset is randomly divided according to a preset ratio (e.g., 8:2). 80% of the data is used as the training subset for subsequent iterative learning and parameter optimization of the neural network model, and the remaining 20% ​​of the data is used as the validation subset for subsequent verification of the generalization ability of the trained model.

[0143] S403. Use a training subset to iteratively train the preset neural network model, input the extracted feature data, and make the model output a prediction result of whether the switch of keyboard and mouse input control is triggered.

[0144] In this embodiment, specifically, the training subset obtained in step S402 is used to perform multiple rounds of iterative training on the preset neural network model in this embodiment. During the training process, various core feature data extracted and refined after feature extraction are directly input to drive the neural network model to complete forward propagation calculation, and finally output the prediction result of whether the keyboard and mouse input control switching is triggered for each set of feature data.

[0145] The preset neural network model is a lightweight INT8 quantized multilayer perceptron (MLP) adapted to keyboard and mouse MCUs with low computing power and small storage. The model structure is simplified to an input layer, two hidden layers, and an output layer. The specific configuration of each layer and the activation function used are as follows: the number of neurons in the input layer is consistent with the number of core features extracted (e.g., 4 neurons, corresponding to 4 types of features: pointer displacement rate, distance between coordinates and threshold, boundary dwell time, and connection direction). The number of neurons in each hidden layer is set to 16, and the ReLU activation function is used to complete nonlinear feature fitting. The output layer has 2 neurons, and the Softmax activation function is used to convert the calculation results into probability values ​​between 0 and 1, corresponding to the two types of results: "triggering keyboard and mouse input control switching" and "not triggering keyboard and mouse input control switching".

[0146] For example, if a set of feature data [10 pixels / ms, 0 pixels, 80ms, 1] is input (representing pointer movement speed of 10 pixels / ms, distance from the connection threshold of 0 pixels, dwell time in the threshold range of 80ms, and horizontal connection direction), after processing by the Softmax activation function, the model outputs a probability value [0.93, 0.07], which clearly indicates a 93% probability of triggering the switching of keyboard and mouse input control.

[0147] During iterative training, the feature data of the training subset is input into the model in batches of 32 groups / batch. Each batch of forward propagation inference is completed, which is the pre-calculation step of updating the model parameters. The process of batch input and forward propagation calculation is repeated until the preset number of iterations is reached, so that the model can gradually learn from the training data and establish a mapping relationship between the feature data and the keyboard and mouse switching judgment results.

[0148] S404. Calculate the loss value between the prediction result and the corresponding label sample indicating whether the keyboard and mouse input control switching was triggered. Adjust the model parameters of the neural network model based on the loss value until the loss value is lower than a preset threshold to complete model training. Specifically, this includes the following steps:

[0149] S4041. Input the prediction result output by the coordinate switching judgment model and the corresponding label sample indicating whether the keyboard and mouse input control switching is triggered into the preset loss function to calculate the loss value of the current iteration.

[0150] Specifically, the probability prediction result of whether the keyboard and mouse input control switching is triggered by the coordinate switching judgment model in the current iteration round is input together with the real label sample corresponding to the sample group into a pre-set loss function. The deviation between the model prediction value and the real label value is quantified by the operation of this function, and then the loss value of the current iteration round is calculated.

[0151] In this step, the cross-entropy loss function, suitable for binary classification scenarios, is used as the preset loss function. Before the calculation, the label samples are converted into one-hot encoding format. For example, the true label is [1,0] when the keyboard and mouse input control is triggered, and [0,1] when the switch is not triggered. The prediction result output by the model is the probability distribution after Softmax activation. For example, if the model outputs [0.93,0.07], it means that the probability of triggering the switch is 93% and the probability of not triggering it is 7%. After substituting the prediction result and the corresponding label [1,0] into the loss function, the loss value for this round can be calculated. If the model prediction deviation is large, such as the output [0.51,0.49] but the corresponding label [1,0], the calculated loss value will also be larger.

[0152] S4042. The obtained current loss value is backpropagated to the parameters of each layer of the neural network model, and the weights and biases of each layer parameter are updated according to the gradient descent algorithm to reduce the deviation between the model output and the labeled samples. After each parameter update, the feature data of the training subset is re-inputted, the new loss value of the updated model output is calculated, and it is determined whether the new loss value is lower than the preset threshold.

[0153] Specifically, the current loss value calculated by S4041 is propagated backward along the hierarchical structure of the neural network to the parameters of each neuron. The parameter distribution that causes the prediction bias is located by the backward propagation method. Then, the Adam gradient descent optimization algorithm is used to update the weights and biases of each layer of the neural network. In this way, the deviation between the model output and the real label sample is continuously reduced, and the accuracy of the model judgment is improved.

[0154] During parameter updates, the gradient descent algorithm adjusts parameter values ​​based on the gradient direction of the loss value. A preset learning rate of 0.005 is used. For example, if the original weight of a hidden layer neuron is 0.45 and the calculated gradient is 0.03, the weight is adjusted downwards according to the preset learning rate, iteratively optimizing the parameters in the direction of reducing the loss value. After each round of updating all neuron parameters, the feature data of the training subset is input back into the adjusted model. A new loss value is recalculated through forward propagation, and this new loss value is compared with a preset loss threshold (e.g., 0.03) to determine whether the model accuracy has reached the expected standard.

[0155] S4043. If the new loss value is not lower than the preset threshold, repeat the steps of loss value calculation, backpropagation and parameter update; if the new loss value is lower than the preset threshold, stop iterative training and lock the parameter configuration of the current neural network model.

[0156] Specifically, the corresponding training control logic is executed based on the comparison result between the new loss value and the preset threshold: if the new loss value calculated after parameter update is still not lower than the preset threshold, such as the preset threshold being 0.03 and the new loss value being 0.05, it indicates that the model's prediction bias is still large and the judgment accuracy does not meet the requirements. At this time, the loss value calculation in S4041, the backpropagation in S4042, and the parameter update steps are repeated to continuously optimize the model parameter configuration through multiple iterations; if the new loss value is lower than the preset threshold, such as the preset threshold being 0.03 and the new loss value being 0.02, it indicates that the deviation between the model output result and the label sample is small enough and the judgment accuracy meets the usage requirements. At this time, the iterative training process of the neural network model is immediately stopped, and all parameter configurations such as weights and biases of each layer of the current model are fixed and locked to avoid parameter changes and ensure that the judgment performance of the model remains stable when deployed and used in the future.

[0157] S405. The trained model is validated using a validation subset. When the validation accuracy meets the preset requirements, the coordinate switching judgment model is obtained.

[0158] In this embodiment, specifically, the generalization ability of the neural network model that has completed iterative training is verified using the validation subset obtained in step S402. The feature data in the validation subset is input into the model to obtain the probability prediction result of whether the keyboard and mouse input control switching is triggered. Then, the prediction result is compared with the real label samples provided by the validation subset one by one, and the proportion of the number of correctly predicted samples to the total number of samples in the validation subset is counted to obtain the model's validation accuracy. The final judgment rule of the model is: if the probability of triggering switching is >0.9, it is determined that switching is triggered; otherwise, it is determined that switching is not triggered.

[0159] For example, if the validation subset has a total of 1000 samples and the model correctly predicts 960 samples, then the accuracy rate of this validation is 96%. If the preset validation accuracy rate requirement is 95% or higher, and the validation result of the model meets the preset requirement, then the trained and validated model can be determined as the final coordinate switching judgment model used for keyboard and mouse control switching.

[0160] Subsequently, the coordinate switching judgment model is solidified in INT8 quantization format to the storage area of ​​the microcontroller chip (MCU) of the keyboard and mouse input unit. The real-time inference process is as follows: MCU extracts real-time pointer features → inputs quantization model → forward propagation calculates probability → outputs final judgment result according to judgment rules, realizing low latency and high real-time intelligent judgment of keyboard and mouse switching, which can be directly called in step S41.

[0161] In one embodiment, step S50 specifically includes the following steps:

[0162] S51. A wireless USB transceiver unit is connected to the universal serial bus interface of each controlled device. All wireless USB transceiver units establish point-to-point wireless communication connections with the keyboard and mouse input unit, thus building a dedicated data transmission link for each controlled device corresponding to the keyboard and mouse input unit.

[0163] In this embodiment, specifically, this step is the "core step of physical link establishment" for cross-device keyboard and mouse data transmission. The core purpose is to avoid data confusion between multiple devices and reduce transmission latency through an independent wireless link, ensuring the exclusivity and stability of data transmission when control is switched. The specific logic is as follows:

[0164] Hardware access specifications: Configure each controlled device to be connected (such as device A, device B, device C) with an independent wireless USB transceiver unit (compatible with USB 2.0 and above interfaces, supports USB HID protocol, and has a built-in 2.4G wireless communication module). Insert each transceiver unit into the universal serial bus (USB) interface of the corresponding controlled device (including common interfaces such as USB-A and USB-C, with compatibility ensured by an interface adapter chip). After connection, the controlled device automatically recognizes the transceiver unit as a "standard input device expansion module", without the need for additional installation of dedicated drivers, thus reducing deployment costs.

[0165] Point-to-point communication establishment: All wireless USB transceivers connected to the controlled device establish a one-to-one point-to-point wireless communication connection with the keyboard and mouse input unit through a pre-configured pairing method (such as manually entering the device identifier of the keyboard and mouse input unit for the first pairing, and automatically connecting thereafter). That is, the keyboard and mouse input unit assigns an independent communication channel and communication address (such as 2.4G channel 11, device address 0x001~0x00N) to each wireless USB transceiver unit, and the communication process uses frequency hopping technology and data encryption (such as AES-128 encryption) to avoid signal interference and data leakage between multiple links.

[0166] Dedicated link binding logic: After the link is established, the keyboard and mouse input unit binds the "unique device identifier of the wireless USB transceiver unit (such as MAC address, factory serial number)" with the "identity identifier of the corresponding controlled device (such as the MAC address in the previous mapping table)" one by one, and stores them in the built-in "link-device mapping table"; each bound link is only used to transmit the data stream between the "keyboard and mouse input unit and the corresponding controlled device", forming a dedicated transmission channel to ensure directional data transmission and prevent multi-device data cross-streaming or misreception problems.

[0167] For example, there are three controlled devices: Device A (identified by AA:BB:CC:DD:EE:FF), Device B (identified by BB:CC:DD:EE:FF:GG), and Device C (identified by CC:DD:EE:FF:GG:HH), which are connected to wireless USB transceiver units U1 (identified by U-001), U2 (identified by U-002), and U3 (identified by U-003), respectively; all three transceiver units are paired with a keyboard and mouse input unit via the 2.4G protocol. U1 is assigned channel 11 and address 0x001, U2 is assigned channel 12 and address 0x002, and U3 is assigned channel 13 and address 0x003. At the same time, the binding relationship of "U1→Device A, U2→Device B, U3→Device C" is recorded in the link-device mapping table, and finally three dedicated data transmission links are constructed: keyboard and mouse input unit ↔ U1 (Device A), keyboard and mouse input unit ↔ U2 (Device B), and keyboard and mouse input unit ↔ U3 (Device C). Each link transmits data independently without interference.

[0168] S52. Retrieve the unique device identifier of the wireless USB transceiver unit connected to the target controlled device, as well as its system input interface protocol.

[0169] In this embodiment, specifically, this step is the identity locking and protocol adaptation preparation stage before cross-device data transmission. By retrieving two types of key information, it provides a basis for subsequent data format conversion and targeted transmission, avoiding data transmission misalignment and protocol incompatibility issues. The specific logic is as follows:

[0170] Based on the target controlled device identity information determined by S42, the keyboard and mouse input unit directly matches and retrieves the unique identifier (such as module MAC address, hardware serial number, communication address, etc.) of the wireless USB transceiver unit corresponding to the target controlled device from the pre-stored link-device mapping table. This identifier is used as the addressing basis for subsequent data frame headers to ensure that the input data is only recognized and received by the target transceiver unit.

[0171] When each wireless USB transceiver unit is first connected to a controlled device and completes pairing, it automatically reads the corresponding device's operating system input interface protocol type and synchronously uploads it to the keyboard and mouse input unit, storing it in the protocol adaptation information table. This step, based on the target controlled device identifier, retrieves its corresponding system input interface protocol from the table, including but not limited to the general USB HID protocol, Windows system extended HID protocol, macOS touch and pointer input protocol, Linux input subsystem transmission protocol, etc., to clarify the input data encapsulation format that the target device can recognize.

[0172] For example, the target controlled device is device B, and its corresponding connected wireless USB transceiver unit is U2, with a unique device identifier of U-002. Device B runs on a Windows operating system, and the corresponding system input interface protocol is USB HID (Boot Protocol). The keyboard and mouse input unit retrieves U-002 from the link-device mapping table and retrieves the USB HID protocol from the protocol adaptation information table. Both types of information are prepared synchronously for subsequent data processing and transmission.

[0173] S53. According to the system input interface protocol, perform protocol format conversion on the pointer displacement data and key trigger data output in real time by the keyboard and mouse input unit to generate input execution data compatible with the target controlled device, and write the unique device identifier of the corresponding wireless USB transceiver unit into the input execution data frame header field.

[0174] In this embodiment, specifically, this step is the core of cross-device keyboard and mouse data adaptation and targeted transmission encapsulation. It solves the compatibility problem of different controlled device systems through protocol standardization conversion, and achieves accurate data addressing by writing device identifier frame headers, thereby avoiding data parsing anomalies and multi-device crosstalk from the root. The specific logic is as follows:

[0175] The raw pointer displacement data (absolute coordinates, coordinate increments) and key trigger data (key value code, key state) collected in real time by the keyboard and mouse input unit are general raw data, which cannot be directly adapted to the input interface parsing rules of different operating systems. This step is based on the input interface protocol of the target controlled device system called by S52. It strictly follows the frame structure, byte bit definition, data bit width and verification rules specified in the protocol to encode, convert, fill and encapsulate the raw keyboard and mouse data, remove invalid and redundant data, and generate input execution data that fully conforms to the recognition standard of the target device input processing module. This ensures that the data can trigger corresponding operations such as pointer movement and key clicks without distortion after being transmitted to the controlled device.

[0176] After completing the protocol format conversion, the unique device identifier of the wireless USB transceiver unit corresponding to the target controlled device, retrieved by S52, is accurately written into the addressing field of the frame header of the input execution data. This identifier serves as a dedicated addressing credential for data transmission. Each wireless USB transceiver unit only receives and parses data frames that carry its own unique identifier in the frame header, automatically filtering out non-target data from other devices, ensuring the independence of the dedicated data transmission link, and preventing data misreception and crosstalk interference between multiple devices.

[0177] For example, the target controlled device is device B, and the unique identifier of the corresponding wireless USB transceiver unit is U-002. The adapted system input interface protocol is the USB HID boot protocol. The raw data collected in real time by the keyboard and mouse input unit is the pointer displacement coordinate (1930, 522) and the left mouse button trigger signal. The raw data is converted into input execution data in the standard HID report format according to the USB HID protocol specification. Then, the unique device identifier U-002 is written into the frame header addressing field of the data to complete the final data encapsulation and generate directional input execution data that can only be recognized and received by the transceiver unit U2.

[0178] S54. Through the dedicated data transmission link, the input execution data with a unique device identifier is sent to the wireless USB transceiver unit of the target controlled device. After data frame verification, it is transmitted to the input processing module of the target controlled device, and the position continuity of the mouse pointer at the cross-device connection is maintained simultaneously.

[0179] In this embodiment, specifically, this step achieves seamless integration of directional data transmission, validity verification, and pointer cross-screen operation, ensuring accurate and reliable data transmission while maintaining the smoothness and seamlessness of user operation. The specific logic is as follows:

[0180] The keyboard and mouse input unit sends out the encapsulated input execution data with a unique device identifier through a point-to-point dedicated data transmission link established by S51 and corresponding to the target wireless USB transceiver unit. This transmission process uses only a preset independent communication channel and address and does not cause signal interference with the transmission links of other controlled devices, thus ensuring the stability and low latency of data transmission.

[0181] After receiving the data frame, the wireless USB transceiver unit corresponding to the target controlled device first performs a matching verification on the unique device identifier in the frame header, and at the same time performs a CRC check or checksum check on the data frame payload to determine whether the device identifier is consistent and whether there is packet loss, packet error or tampering during the data transmission process. Only after all the verifications pass will subsequent data processing continue. If the verification fails, the frame will be discarded directly and a retransmission will be requested from the keyboard and mouse input unit.

[0182] After successful verification, the wireless USB transceiver unit will send the input execution data directly to the system input processing module of the target controlled device in transparent transmission mode. The data content will not be modified or any extra fields will be inserted throughout the process, ensuring that the data format is completely consistent with the protocol format converted by S53. This allows the target device to directly recognize and execute operations such as pointer movement and button triggering.

[0183] Seamless coordinate mapping is performed based on the connection coordinate threshold (e.g., X=1920). The real-time coordinates of the mouse pointer at the boundary of the original controlled device are smoothly converted into the starting coordinates within the target controlled device according to the interval division rules of the continuous coordinate mapping table. This avoids pointer position jumps, stuttering, or disappearance, and achieves visual and operational continuity of pointer movement at cross-device connection points.

[0184] For example, the target controlled device is device B, and the corresponding wireless USB transceiver unit is U2. The keyboard and mouse input unit transmits input execution data in USB HID format with the U-002 identifier in the frame header through the dedicated 2.4G link between the two. After receiving the data, U2 verifies that the device identifier matches and the data frame is error-free, and then transmits it to the mouse input processing module of device B. At the same time, based on the connection threshold X=1920, the original boundary coordinates (1920, 522) of device A are seamlessly mapped to the starting coordinates (0, 522) of device B, and the mouse pointer can smoothly enter the display area of ​​device B without any positional gaps.

[0185] S55. Upon receiving the input execution data reception confirmation frame from the target controlled device, immediately terminate the transmission of input execution data from the keyboard and mouse input unit to the wireless USB transceiver unit corresponding to the original controlled device, and trigger the cross-device switching of keyboard and mouse input control based on the connection coordinate threshold.

[0186] In this embodiment, specifically, this step is the final confirmation and link closure link of the entire cross-device control handover. The accurate timing of the handover is ensured by the responsive reliable transmission mechanism, avoiding operation conflicts caused by the original device and the target device receiving keyboard and mouse data at the same time. Finally, it achieves a smooth and error-free transfer of control. The specific logic is as follows:

[0187] The keyboard and mouse input unit monitors the input execution data reception confirmation frames returned by the wireless USB transceiver unit on the target controlled device side in real time. It performs legality verification on fields such as the device unique identifier, data frame verification result, and timestamp carried in the confirmation frame. Only when all verifications pass can it be confirmed that the target device has completely received the data and has normal input processing capabilities. This serves as the sole trigger condition for switching execution control, preventing abnormal switching due to the target device not being ready.

[0188] After confirming that the frame verification is successful, the keyboard and mouse input unit immediately cuts off the dedicated data transmission path between itself and the original controlled device's corresponding wireless USB transceiver unit, and stops sending any pointer displacement data and key trigger data to the original device. This prevents the two devices from receiving keyboard and mouse data at the same time from the link level, thus avoiding conflict issues such as pointer movement at both ends and repeated key triggers.

[0189] Using the connection coordinate threshold determined in S41 as the coordinate anchor point, the control binding relationship and data routing rules inside the keyboard and mouse input unit are officially updated, and the keyboard and mouse input control is completely switched from the original controlled device to the target controlled device. All subsequent real-time collected keyboard and mouse input data are transmitted only through the dedicated data transmission link corresponding to the target device, thus completing the seamless cross-device switching of the entire set of keyboard and mouse input control.

[0190] For example, after the keyboard and mouse input unit receives a reception confirmation frame from the wireless USB transceiver unit U2 corresponding to device B, and verifies that the verification identifier U-002 and the timestamp 202406011000001 are correct, it immediately stops sending input execution data to the transceiver unit U1 corresponding to the original device A; and uses the connection coordinate threshold X=1920 as the anchor point to switch the keyboard and mouse input control from device A to device B. Subsequently, all input data such as mouse movement and keyboard key presses are transmitted to device B only through the dedicated link of U2, completing the entire cross-device control switching process.

[0191] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A method for keyboard and mouse control linkage across multiple devices, characterized in that, Includes the following steps: S10. Obtain device parameters of at least two controlled devices that have established wired or wireless connections with the keyboard and mouse input unit. The device parameters include the display resolution, display boundary coordinates, and system input interface protocol of each controlled device. S20. Based on the display resolution and display boundary coordinates of all controlled devices, generate a continuous coordinate mapping table covering the display areas of all controlled devices. The continuous coordinate mapping table contains the corresponding interval of the display area of ​​each controlled device in the overall continuous coordinates, and the connection coordinate threshold of the display areas of adjacent controlled devices. S30. Receive pointer displacement data and key trigger data output by the keyboard and mouse input unit in real time, map the pointer displacement data to the continuous coordinate mapping table, match the corresponding interval where the pointer is located, and obtain the real-time coordinate position of the pointer in the overall continuous coordinate. S40. When the real-time coordinate position reaches the connection coordinate threshold of the display area of ​​the adjacent controlled device, the current keyboard and mouse input control is switched from the original controlled device to the target controlled device. The target controlled device is the controlled device corresponding to the display area that the real-time coordinate position is about to enter. S50. Based on the system input interface protocol in the device parameters of the target controlled device, perform protocol conversion on the pointer displacement data and key trigger data output by the keyboard and mouse input unit, and synchronously transmit the converted pointer displacement data and key trigger data to the target controlled device to complete the switching of keyboard and mouse input control.

2. The method for keyboard and mouse control linkage for multiple devices as described in claim 1, characterized in that, After step S10, the method further includes: S101. Identify the master device that currently holds the control of keyboard and mouse input and the slave devices that do not hold the control of keyboard and mouse input based on the device parameters of each controlled device; S102. Close the data transmission channel of the wired or wireless connection between the slave device that does not have control over the keyboard and mouse input and the keyboard and mouse input unit, retain the low-power heartbeat link to maintain the connection state, extract the system input interface protocol of each slave device and cache it in the keyboard and mouse input unit, and stop the protocol parsing operation on the slave device side. S103. Monitor the keyboard and mouse input status of the main control device in real time, and dynamically generate a personalized idle threshold range by combining the pre-stored user historical keyboard and mouse operation data; perform hierarchical power consumption control according to the matching relationship between the keyboard and mouse input status and the personalized idle threshold range. S104. When a wake-up trigger action of the keyboard and mouse input unit is detected, perform graded recovery according to the amplitude characteristics of the wake-up trigger action; S105. Update the pre-stored user history keyboard and mouse operation behavior data according to the preset cycle, and recalibrate the personalized idle threshold range based on the updated user history keyboard and mouse operation behavior data.

3. The keyboard and mouse switching linkage method for multiple devices as described in claim 2, characterized in that, The graded power consumption control includes: If the keyboard and mouse operation continues, maintain the highest scanning sampling frequency of the keyboard and mouse input unit and the operation of all hardware function modules; If the idle time after the keyboard and mouse stop operating is within the personalized idle threshold range, reduce the scanning sampling frequency, retain only the keyboard and mouse operation detection, and turn off the rest of the hardware; If the idle time after the keyboard and mouse stop operating reaches the upper limit of the personalized idle threshold range, the scanning sampling frequency will be reduced to the minimum working threshold, retaining only heartbeat detection and wake-up trigger detection, while the cached slave device system input interface protocol will be compressed and stored.

4. The keyboard and mouse switching linkage method for multiple devices as described in claim 2, characterized in that, The amplitude characteristics of the wake-up trigger action include pointer displacement acceleration, key trigger force, and operation continuity; the graded recovery includes: If the amplitude of the wake-up trigger action is less than a preset amplitude threshold, the recovery operation will not be performed to filter out accidental touch behavior; When the amplitude of the wake-up trigger action is within the preset amplitude threshold range, the scanning sampling frequency is restored to the range corresponding to the idle time after the keyboard and mouse stop operation is within the personalized idle threshold range, and only the keyboard and mouse operation detection is retained; When the amplitude of the wake-up trigger action exceeds the preset amplitude threshold range, the system restores to the highest scanning sampling frequency and all hardware function modules corresponding to the continuous keyboard and mouse operation, and activates the cached slave device system input interface protocol.

5. The method for keyboard and mouse control linkage across multiple devices as described in claim 1, characterized in that, Step S20 specifically includes the following steps: S21. Taking the upper left corner of the display area of ​​one of the controlled devices that serves as the initial control object for the keyboard and mouse among all controlled devices as the origin of the overall continuous coordinate system, determine the coordinate interval of the corresponding keyboard and mouse movement range in the overall continuous coordinate system based on the display resolution and display boundary coordinates of the controlled device, and use this coordinate interval as the initial coordinate interval; the horizontal and vertical axis ranges of the coordinate interval match the display resolution of the controlled device, and the keyboard and mouse input control rights are associated with the coordinate interval; S22. Sequentially obtain the display resolution and display boundary coordinates of each of the remaining controlled devices, determine the corresponding coordinate interval, and seamlessly connect the coordinate intervals of each of the remaining controlled devices with the edge of the determined coordinate interval, based on the preset cross-device movement connection direction of the keyboard and mouse and the initial coordinate interval; wherein, all coordinate intervals are connected without overlap and gap only along the preset cross-device movement connection direction of the keyboard and mouse, forming a continuous coordinate domain adapted to the linear movement of the keyboard and mouse. S23. Obtain and integrate the device identifier, display resolution and corresponding coordinate interval parameters of each controlled device, and mark the connection coordinate threshold between adjacent coordinate intervals. The connection coordinate threshold is the critical coordinate value for switching keyboard and mouse input control across devices, and generate a continuous coordinate mapping table covering the display area of ​​all controlled devices.

6. The keyboard and mouse control linkage method for multiple devices as described in claim 5, characterized in that: The preset cross-device movement connection direction of the keyboard and mouse is either horizontal left-right connection or vertical up-down connection. All coordinate intervals are arranged sequentially along a single preset direction, and the connecting edge of adjacent coordinate intervals is the critical line of a single axis direction, so as to adapt to the switching of cross-device keyboard and mouse input control triggered by the movement of the mouse pointer along a straight line.

7. The keyboard and mouse switching linkage method for multiple devices as described in claim 5, characterized in that, Step S40 specifically includes the following steps: S41. Obtain the connection coordinate threshold between the real-time coordinate position and the marked adjacent coordinate interval, input the pre-trained coordinate switching judgment model, and output the judgment result of whether the keyboard and mouse input control switching is triggered based on the continuous coordinate mapping table and the device identifier of each controlled device. S42. When the coordinate switching judgment model outputs the judgment result that triggers the switching of keyboard and mouse input control, the target controlled device to be switched and its corresponding device identifier are obtained according to the connection coordinate threshold, and a control switching instruction including an input data pause transmission instruction and an input data ready reception instruction is generated. S43. Based on the control switching instruction, send an input data pause transmission instruction to the original controlled device to stop transmitting pointer displacement data and key trigger data to the original controlled device, and at the same time send an input data preparation reception instruction to the target controlled device to wake up the input data reception channel of the target controlled device. S44. When the original controlled device completes the data transmission pause and the target controlled device completes the input channel wake-up, the keyboard and mouse input control is switched from the original controlled device to the target controlled device.

8. The keyboard and mouse switching linkage method for multiple devices as described in claim 7, characterized in that, The training of the coordinate switching judgment model includes the following steps: S401. Collect multiple sets of historical keyboard and mouse control switching data. The historical keyboard and mouse control switching data includes continuous coordinate mapping table samples, pointer real-time coordinate position samples, connection coordinate threshold samples, controlled device device identifier samples, and corresponding tag samples indicating whether keyboard and mouse input control switching is triggered. S402. Extract features from the historical keyboard and mouse control linkage data, construct a model training dataset based on the extracted feature data, and divide it into a training subset and a validation subset according to a preset ratio. S403. Iteratively train the preset neural network model using a training subset, input the extracted feature data, and make the model output a prediction result of whether the switch of keyboard and mouse input control is triggered. S404. Calculate the loss value between the prediction result and the corresponding label sample that triggers the switching of keyboard and mouse input control. Adjust the model parameters of the neural network model according to the loss value until the loss value is lower than the preset threshold to complete the model training. S405. The trained model is validated using a validation subset. When the validation accuracy meets the preset requirements, the coordinate switching judgment model is obtained.

9. The keyboard and mouse switching linkage method for multiple devices as described in claim 8, characterized in that, Step S404 specifically includes the following steps: S4041. Input the prediction result output by the coordinate switching judgment model and the corresponding label sample indicating whether the keyboard and mouse input control switching is triggered into the preset loss function to calculate the loss value of the current iteration. S4042. The obtained current loss value is backpropagated to the parameters of each layer of the neural network model, and the weights and biases of each layer parameter are updated according to the gradient descent algorithm to reduce the deviation between the model output and the label sample. After each parameter update, the feature data of the training subset is re-inputted, the new loss value of the updated model output is calculated, and it is determined whether the new loss value is lower than the preset threshold. S4043. If the new loss value is not lower than the preset threshold, repeat the steps of loss value calculation, backpropagation and parameter update; if the new loss value is lower than the preset threshold, stop iterative training and lock the parameter configuration of the current neural network model.

10. The keyboard and mouse switching linkage method for multiple devices as described in claim 7, characterized in that, Step S50 specifically includes the following steps: S51. A wireless USB transceiver unit is connected to the universal serial bus interface of each controlled device. All wireless USB transceiver units establish point-to-point wireless communication connections with the keyboard and mouse input unit, thus building a dedicated data transmission link for each controlled device corresponding to the keyboard and mouse input unit. S52. Retrieve the unique device identifier of the wireless USB transceiver unit connected to the target controlled device, as well as its system input interface protocol; S53. According to the system input interface protocol, perform protocol format conversion on the pointer displacement data and key trigger data output in real time by the keyboard and mouse input unit, generate input execution data compatible with the target controlled device, and write the unique device identifier of the corresponding wireless USB transceiver unit into the input execution data frame header field; S54. Through the dedicated data transmission link, the input execution data with a unique device identifier is sent to the wireless USB transceiver unit of the target controlled device. After data frame verification, it is transmitted to the input processing module of the target controlled device, and the position continuity of the mouse pointer at the cross-device connection is maintained simultaneously. S55. Upon receiving the input execution data reception confirmation frame from the target controlled device, immediately terminate the transmission of input execution data from the keyboard and mouse input unit to the wireless USB transceiver unit corresponding to the original controlled device, and trigger the cross-device switching of keyboard and mouse input control based on the connection coordinate threshold.