Linux kernel privacy switch control method based on Loongson platform

By modifying the bit value of the GPIO register and using the rfkill module, the problem that the hardware privacy switch based on the Loongson platform cannot respond correctly to the shutdown signal is solved, and the method of effectively turning off the wireless device function is realized, with good compatibility and security.

CN119862613AInactive Publication Date: 2025-04-22KYLIN CORP
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202510345521.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-24
Publication Date
2025-04-22
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The hardware privacy switch based on the Loongson platform cannot correctly respond to hardware-level shutdown signals on some wifi and Bluetooth devices, resulting in the inability to effectively turn off the wireless device function, which has compatibility problems.

Method used

By modifying the bit value of the GPIO input and output registers, the hardware privacy switch and the GPIO registers are linked. The wireless device driver module obtains the bit value of the GPIO register to determine the device status, and uses the rfkill module to initialize it in the startup stage of the Linux kernel system, and regularly polls the status identification bit to control the on or off of the wireless device.

Benefits of technology

The Linux kernel privacy switch control method based on the Loongson platform is realized, with good compatibility, easy adaptability and low cost, and can effectively turn off wifi and Bluetooth functions, improving security and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119862613A_ABST
    Figure CN119862613A_ABST
Patent Text Reader

Abstract

The invention relates to a Linux kernel privacy switch control method based on a Loongson platform, which comprises the following steps of: modifying a bit value of a corresponding bit of a GPIO (General Purpose Input / Output) register, and realizing linkage between a hardware privacy switch and the GPIO register; the wireless equipment driving module obtains the bit value of a corresponding GPIO (General Purpose Input / Output) register and judges the on or off state of the wireless equipment at the moment according to the corresponding bit value; after initialization of an rfkill module is completed in the starting stage of a Linux kernel system, a wireless equipment driving module registers to an rfkill subsystem during loading, sets an initial state and stores the initial state, meanwhile, periodically polls a state identification bit of the rfkill subsystem, and judges whether the wireless equipment needs to be turned off or turned on according to the change of the state identification bit of the rfkill subsystem and a corresponding bit value. The invention mainly aims at providing a Linux kernel privacy switch control method based on a Loongson platform. Compared with an original scheme, the Linux kernel privacy switch control method based on the Loongson platform has the advantages of being good in compatibility, easy to adapt, low in cost and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a Linux kernel privacy switch, and in particular to a control method for a Linux kernel privacy switch based on a Loongson platform. Background Art

[0002] In today's digital age, laptops are an indispensable part of daily work. While greatly improving work efficiency and quality of life, they also bring new security risks - especially when processing sensitive information, personal privacy will be seriously threatened once the device is hacked or improperly used. Therefore, how to effectively protect user privacy has become an urgent problem to be solved.

[0003] Currently, many Loongson-based notebooks have physical privacy switches that output control signals through privacy circuit design to turn off functions involving sensitive information with one click. This type of design provides users with a simple and direct way to manage their own privacy settings, ensuring that a certain level of security is maintained even when the device is infected by malware.

[0004] However, although the hardware privacy switch mechanism directly controls the power state of certain sensitive devices through physical buttons or shortcut keys, this type of design provides users with an intuitive and effective way to manage privacy, but in practice it has been found that some components provided by Wi-Fi and Bluetooth manufacturers cannot correctly respond to these hardware-level shutdown signals. This is mainly because products from different manufacturers may have inconsistent interface standards, or because the compatibility with new architectures was not fully considered in early designs. This compatibility issue will cause the physical switch to be unable to turn off the corresponding function, and it is necessary to modify the hardware design or customize the system for specific devices to customize the privacy switch function.

[0005] For example, the Chinese patent "Privacy protection circuit for laptop computer" (patent number CN220983884U) proposes a privacy protection circuit for laptop computers. The toggle switch outputs a control signal (SW_DET) to the microcontroller unit. The microcontroller unit controls the output pin (GPIO1-4) to output a corresponding control signal according to the SW_DET signal, thereby turning off wifi, Bluetooth, camera and microphone with one click.

[0006] The publication number is CN114779655A, which discloses a wifi smart switch and its control method. It mainly determines the working status of the wifi module periodically, calculates the operation probability according to each time interval, and finally obtains the highest time interval. After exceeding the time interval, the wifi module is turned off and the crystal oscillator unit is controlled to enter the timing state, and the wifi module is reactivated after a certain period of time.

[0007] The publication number is CN105468131A, which discloses a wireless device control method based on the Loongson platform. It mainly controls the operating status of the wireless device wifi and 3G modules through the RFKILL interface in the user space. However, if it is used as a privacy switch software solution, it has a logical conflict with the user-level visualized wifi switch, resulting in the problem that the privacy switch is turned off but the wifi function can still be turned on. At the same time, the solution cannot prevent tampering with malicious software.

[0008] Therefore, based on the above problems, a new privacy switch solution with wide compatibility is urgently needed to specifically solve the problem of privacy switch failure based on the Loongson platform. Summary of the invention

[0009] The main purpose of the present invention is to provide a control method for the Linux kernel privacy switch based on the Loongson platform, which has the advantages of good compatibility, easy adaptation, low cost, etc. compared with the original solution.

[0010] In order to achieve the above object, the present invention provides a control method for a Linux kernel privacy switch based on a Loongson platform. Modify the bit value of the corresponding position of the GPIO input and output register, and make the hardware privacy switch linked with the GPIO input and output register; The wireless device driver module obtains the bit value of the corresponding GPIO input and output register, and determines the on or off state of the wireless device at this time according to the corresponding bit value; After the initialization of the rfkill module is completed during the Linux kernel system startup phase, the wireless device driver module will register with the rfkill subsystem when loaded, set the initial state and save it, and start periodic polling of its status flag at regular intervals. According to the changes in its status flag and the corresponding bit value, it is determined whether the wireless device needs to be turned off or on.

[0011] Preferably, the wireless device driver module is a wifi driver module or a bluetooth driver module.

[0012] Further preferably, the bit value of the modified GPIO input / output register is: When the wireless device driver module obtains the value of bit8 or bit9 of the corresponding GPIO input / output register and finds that it is 1, it determines that the wireless device is in the on state; When the wireless device driver module obtains the value of bit8 or bit9 of the corresponding GPIO input / output register and finds that the value is 0, it determines that the wireless device is in the off state; The wifi driver module determines whether it is on or off by obtaining the value of bit8, and the bluetooth driver module determines whether it is on or off by obtaining the value of bit9.

[0013] More preferably, the rfkill module includes two status flags, hardware_unblock and hardware_block, wherein the flag in the initial state of the rfkill module is hardware_unblock, which starts polling with a period of 5 seconds.

[0014] More preferably, the control method comprises the following steps: S1: When the wireless device driver is loaded, the Linux kernel system sets the state of the rfkill module to the hardware_unblock state flag and saves it as the initial state bit; S2: Start polling with a period of 5 seconds; S3: Query the bit value of the GPIO input and output register after 5 seconds; S4: Obtain the value of bit8 / bit9 through bit AND operation. If bit8 / bit9 is 1, execute step S8; if bit8 / bit9 is 0, execute step S5. S5: Determine whether the previous status flag is hardware_block, if not, execute step S3, if yes, execute step S6; S6: Set the status flag of the rfkill module to hardware_unblock; S7: Turn on the Wi-Fi and / or Bluetooth function and execute step S3; S8: Determine whether the previous status flag is hardware_unblock, if not, execute step S3, if yes, execute step S9; S9: Set the status flag of the rfkill module to hardware_block; S10: Turn off the Wi-Fi and / or Bluetooth functions and execute step S3.

[0015] The beneficial effects of the present invention are: The present invention uses the GPIO input and output registers of the Loongson platform and implements the opening and closing of the hardware privacy switch based on the rfkill module, thereby achieving the effect of turning off the WiFi and Bluetooth functions. The present invention does not require application layer code modification and has the advantages of being simple, fast, easy to migrate, and having wide compatibility. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0017] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION

[0018] The technical scheme in the embodiment of the present invention is described clearly and completely below in conjunction with the accompanying drawings in the embodiment of the present invention. In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention can also be implemented in other ways different from those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present invention, so the present invention is not limited by the specific embodiments disclosed below.

[0019] Definitions of Abbreviations and Key Terms: Privacy switch: The privacy switch is an important security feature in modern laptops, designed to provide users with a convenient and direct means to protect personal privacy and data security. With a simple physical switch, users can turn off functional modules such as Wi-Fi and Bluetooth that may involve information leakage. This design not only simplifies the operation process, eliminating the need to set up each one through the software interface, but also completely disconnects these functions at the hardware level, providing more reliable security protection.

[0020] rfkill: The rfkill (Radio Frequency KILL) module is an important subsystem in the Linux kernel. It provides a mechanism to control the on / off state of wireless devices such as Wi-Fi, Bluetooth, UWB (Ultra-Wideband), WWAN (Wide Area Network), GPS, FM radio, and NFC. With the rfkill module, users can turn off these wireless devices when they are not needed to save power, or quickly disable all RF transmitters in specific situations such as airplane mode. The rfkill module is not limited to software-level operations, but can also respond to physical switches on hardware. In addition, the rfkill module can also work independently of any physical switch, allowing the state of wireless devices to be managed in pure software. The rfkill module provides two shutdown states for wifi and Bluetooth devices, one is software_block and the other is hardware_block. The former can be turned on or off through the user space command line interface, but it will conflict with the privacy switch logic. The latter has a higher priority, is not open to user space, and is more secure.

[0021] In this embodiment, first, let the Linux kernel system perceive the state of the hardware privacy switch. This embodiment selects the GPIO input and output register of the Loongson platform (the base address on the Loongson 3A6000 is 0x1fe00000, and the offset address is 0x0508). The wifi module selects the 8th bit of the GPIO input and output register as the status signal (ie, bit8), and the Bluetooth module selects the 9th bit of the GPIO input and output register as the status signal (ie, bit9). When the hardware privacy switch is turned on, the value of the corresponding GPIO input and output register bit is set to 1 (ie, bit8 / bit9 is set to 1), and when the hardware privacy switch is turned off, the value of the corresponding GPIO input and output register bit is set to 0 (ie, bit8 / bit9 is set to 0).

[0022] Secondly, the wifi module and the bluetooth module need to obtain the corresponding bit by obtaining the value of the GPIO input and output register. The rfkill module in the Linux kernel system provides a corresponding polling interface for the bluetooth driver and the wifi driver, and executes the polling interface function regularly every 5 seconds. Therefore, by implementing the register reading at the driver layer and providing the function to the rfkill subsystem, the value of the register can be obtained regularly every 5 seconds. Then, according to the signal of the corresponding status bit, hardware_block (wifi off) and hardware_unblock (wifi on) are set, so that the application layer updates the icon changes through the rfkill status bit.

[0023] Specifically, Figure 1 As shown, the control method of the Linux kernel privacy switch based on the Loongson platform of this embodiment includes the following steps: S1: When the wireless device driver is loaded, the Linux kernel system sets the state of the rfkill module to the hardware_unblock state flag through the set_hw_state interface and saves it as the initial state bit; Figure 1 The "status" in stands for "status flag"; S2: Start polling with a period of 5 seconds; S3: Query the bit value of the GPIO input and output register after 5 seconds; S4: Obtain the value of bit8 / bit9 through bit AND operation. If bit8 / bit9 is 1, execute step S8; if bit8 / bit9 is 0, execute step S5. S5: Determine whether the previous status flag is hardware_block, if not, execute step S3, if yes, execute step S6; S6: Set the status flag of the rfkill module to hardware_unblock (corresponding to Figure 1 "Set hardware_unblock and save as status"); S7: Turn on the Wi-Fi and / or Bluetooth function and execute step S3; S8: Determine whether the previous status flag is hardware_unblock, if not, execute step S3, if yes, execute step S9; S9: Set the status flag of the rfkill module to hardware_block (corresponding to Figure 1 "Set hardware_block and save as status"); S10: Turn off the Wi-Fi and / or Bluetooth functions and execute step S3.

[0024] Therefore, the present invention combines the rfkill technology with the higher-level hardware block hard shielding technology to strictly limit the modification permission to the driver layer. Compared with the existing application of the rfkill technology in soft shielding, which has multiple modification paths and leads to the problem of malicious program modification causing security risks, the present invention improves the security and stability of the overall solution.

[0025] In addition, in order to solve the problem that the existing general hardware privacy switch solution cannot be applied under certain specific CPU architectures, the present invention integrates the processing capabilities of the hardware privacy switch for radio frequency modules such as Bluetooth and WiFi under different CPU architectures based on the rfkill technology, and proposes a software solution with a wider range of applications.

[0026] Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

Claims

1. A control method for a Linux kernel privacy switch based on a Loongson platform, characterized in that: Modify the bit value of the corresponding position of the GPIO input and output register, and make the hardware privacy switch linked with the GPIO input and output register; The wireless device driver module obtains the bit value of the corresponding GPIO input and output register, and determines the on or off state of the wireless device at this time according to the corresponding bit value; After the initialization of the rfkill module is completed during the Linux kernel system startup phase, the wireless device driver module will register with the rfkill subsystem when loaded, set the initial state and save it, and start periodic polling of its status flag at regular intervals. According to the changes in its status flag and the corresponding bit value, it is determined whether the wireless device needs to be turned off or on.

2. The control method of a Linux kernel privacy switch based on a Loongson platform according to claim 1, characterized in that: The wireless device driver module is a wifi driver module or a bluetooth driver module.

3. The control method of a Linux kernel privacy switch based on a Loongson platform according to claim 2, characterized in that: The bit value of the modified GPIO input and output register is: When the wireless device driver module obtains the value of bit8 or bit9 of the corresponding GPIO input / output register and finds that it is 1, it determines that the wireless device is in the on state; When the wireless device driver module obtains the value of bit8 or bit9 of the corresponding GPIO input / output register and finds that the value is 0, it determines that the wireless device is in the off state; The wifi driver module determines whether it is on or off by obtaining the value of bit8, and the bluetooth driver module determines whether it is on or off by obtaining the value of bit9.

4. The control method of a Linux kernel privacy switch based on a Loongson platform according to claim 3, characterized in that: The rfkill module includes two status flags: hardware_unblock and hardware_block. The flag of the rfkill module in the initial state is hardware_unblock, which starts polling with a period of 5 seconds.

5. The control method of the Linux kernel privacy switch based on the Loongson platform according to claim 4 is characterized in that: The control method comprises the following steps: S1: When the wireless device driver is loaded, the Linux kernel system sets the state of the rfkill module to the hardware_unblock state flag and saves it as the initial state bit; S2: Start polling with a period of 5 seconds; S3: Query the bit value of the GPIO input and output register after 5 seconds; S4: Obtain the value of bit8 / bit9 through bit AND operation. If bit8 / bit9 is 1, execute step S8; if bit8 / bit9 is 0, execute step S5. S5: Determine whether the previous status flag is hardware_block, if not, execute step S3, if yes, execute step S6; S6: Set the status flag of the rfkill module to hardware_unblock; S7: Turn on the Wi-Fi and / or Bluetooth function and execute step S3; S8: Determine whether the previous status flag is hardware_unblock, if not, execute step S3, if yes, execute step S9; S9: Set the status flag of the rfkill module to hardware_block; S10: Turn off the Wi-Fi and / or Bluetooth functions and execute step S3.

Citation Information

Patent Citations

  • Wifi intelligent switch and control method thereof

    CN114779655A

  • Privacy protection circuit for laptop computers

    CN220983884U

  • Communication method for server management module and timing control module

    CN102402492A

  • Loongson platform based wireless device control method

    CN105468131A

  • USBKey security protection system and method

    CN108388787A