Ethernet multi-mode switching method, device and electronic equipment

By monitoring the USB Ethernet device ID and power status, and combining this with an Ethernet state machine to automatically switch power supply modes, the problem of inconsistent mode switching in existing technologies is solved, enabling automatic switching and power supply optimization for devices in mixed usage scenarios.

CN123145083APending Publication Date: 2026-11-20GUANGDONG TELEPOWER TELECOM TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610647288.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-12
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

In existing technologies, the Ethernet power supply and USB to Ethernet adapter power supply modes cannot be switched automatically, which requires manual plugging and unplugging or restarting of the device in mixed usage scenarios. Furthermore, the lack of unified management of Ethernet connection status and USB device status leads to mode misjudgment or repeated switching.

Method used

By monitoring the USB Ethernet device ID, combined with power level and charging status, the system automatically switches between Ethernet power supply and USB to Ethernet adapter power supply modes. It uses an Ethernet state machine to uniformly manage each state, integrates Ethernet services and utility classes, and provides a status query interface.

Benefits of technology

It enables automatic mode switching without manual intervention, improving the ease of use and power supply consistency of the device in mixed usage scenarios, reducing repeated switching and power consumption conflicts, and extending battery life.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123145083A_ABST
    Figure CN123145083A_ABST
Patent Text Reader

Abstract

The application discloses an Ethernet multi-mode switching method and device and electronic equipment, and relates to the technical field of Ethernet multi-mode switching, and specifically discloses the following technical scheme: in an Ethernet detection state, whether a USB Ethernet device exists is judged by monitoring the USB Ethernet device ID; if the USB Ethernet device exists, an Ethernet power supply state is entered; if the USB Ethernet device does not exist, but a low power and charging condition is met, the Ethernet power supply state is entered; and if the USB Ethernet device does not exist, and the low power and charging condition is not met, a USB-to-Ethernet adapter power supply state is entered. The application can accurately determine the connection state of the USB Ethernet device by judging whether the USB Ethernet device exists, and can automatically match the corresponding working mode according to the actual connection state of the device, without manually configuring parameters, plugging in a line or restarting the device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of network communication technology, and in particular to an Ethernet multi-mode switching method, apparatus, and electronic device. Background Technology

[0002] In Android devices such as industrial tablets, handheld terminals, and self-service terminals, Ethernet is typically accessed in two ways: one is Power over Ethernet, which transmits data and power simultaneously via a network cable, allowing the device to operate without an external power source; the other is via a USB to Ethernet adapter, where the device is powered by its built-in battery or an external power source, and connects to the Ethernet chip via USB to achieve network connectivity.

[0003] The existing technology has the following shortcomings: Fixed mode and inability to switch automatically: Most solutions are fixed to either Power over Ethernet (PoE) or USB to Ethernet adapter power supply at the hardware or driver level. They cannot automatically select the appropriate mode based on whether a Power over Ethernet device is connected or whether the device is charging. This results in a poor user experience when PoE and USB to Ethernet adapter power supplies are used in combination.

[0004] The system suffers from fragmented states and a lack of unified management: Ethernet connection status, USB device mounting status, battery and charging status, screen on / off status, etc., are maintained separately by different modules of the system. The lack of a unified state machine model makes it difficult to ensure consistency and predictability throughout the entire process of "detection-decision-switching", which can easily lead to mode misjudgment or repeated switching. Summary of the Invention

[0005] In order to solve the problems existing in the prior art, the present invention aims to provide an Ethernet multi-mode switching method, device and electronic device that can realize the switching between Ethernet power supply mode and USB to Ethernet adapter power supply mode.

[0006] To achieve the above objectives, the present invention adopts the following technical solution: An Ethernet multi-mode switching method includes: In Ethernet detection mode, the presence of a USB Ethernet device is determined by monitoring the USB Ethernet device ID. If a USB Ethernet device is present, it enters Ethernet power supply mode; If the USB Ethernet device is not present, but meets the conditions of low power and charging, it will enter Ethernet power supply mode. If the USB Ethernet device is not present and the conditions of low battery and charging are not met, the device will enter the USB to Ethernet adapter power supply state.

[0007] As a further improvement of the present invention, a controlled thread is started after entering the Ethernet power supply state; If the current state is USB to Ethernet adapter powered, the Ethernet power supply device does not exist and the screen is lit, or the current state is USB to Ethernet adapter powered but the Ethernet power supply device no longer exists, then return to the Ethernet detection state and re-determine whether to enter the Ethernet power supply state or the USB to Ethernet adapter powered state.

[0008] As a further improvement of the present invention, after entering the USB to Ethernet adapter power supply state, the battery detection thread is started; If the device is detected to have started charging, the Ethernet detection status is returned. If the device is in Ethernet detection mode and is low in power and charging mode, it will switch to USB to Ethernet adapter power supply mode.

[0009] As a further improvement of the present invention, the present invention also includes: When entering development / debugging mode, power to Ethernet is turned off and the detection thread is stopped; Upon receiving a broadcast such as OTG mode or wake-up, it re-enters Ethernet detection state.

[0010] As a further improvement of the present invention, in the Ethernet detection state, Ethernet power supply is turned off or set to no power supply.

[0011] The present invention also provides an Ethernet multi-mode switching device, integrated into the Android system framework layer, for implementing the above-mentioned Ethernet multi-mode switching method, including: an Ethernet state machine and an Ethernet service; The Ethernet service creates the Ethernet state machine during construction; The Ethernet state machine is used to maintain the Ethernet detection state, Ethernet power supply state, USB to Ethernet adapter power supply state, and development / debugging state.

[0012] As a further improvement of the present invention, the present invention also includes: an Ethernet status monitor for querying whether a verified Ethernet network currently exists.

[0013] As a further improvement of the present invention, the present invention also includes: an Ethernet utility class for querying whether a USB Ethernet device exists.

[0014] As a further improvement of the present invention, the present invention also includes: an Ethernet service management class, used to provide an interface to the application layer to query the current status.

[0015] The present invention also provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor is used to implement the above-mentioned Ethernet multi-mode switching method when executing the program stored in the memory.

[0016] Compared with the prior art, the present invention has the following beneficial effects: The present invention accurately determines the connection status of the USB Ethernet device by judging whether the USB Ethernet device exists, and uses this as the basis for mode switching. Without the need for manual configuration of parameters, plugging and unplugging of cables or restarting the device, the corresponding working mode can be automatically matched according to the actual connection status of the device. Attached Figure Description

[0017] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments.

[0018] Figure 1 This is a flowchart of the Ethernet multi-mode switching method described in this invention. Detailed Implementation

[0019] To make the technical problems solved by the present invention, the technical solutions adopted, and the technical effects achieved clearer, the technical solutions of the embodiments of the present invention will be further described in detail below. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] This invention provides an Ethernet multi-mode switching method, such as... Figure 1 As shown, it includes: S1. In Ethernet detection mode, first, turn off Ethernet power or set it to no power; then, determine whether the USB Ethernet device exists by monitoring the USB Ethernet device ID.

[0021] As one implementation method, a specified USB Ethernet device ID can be polled and detected within a preset time period (e.g., multiple times at intervals of about 1.2 seconds), such as by executing the system lsusb or reading the device node to determine whether the target VID:PID exists.

[0022] S2. If a USB Ethernet device exists, the scenario is determined, and a command to enter the PoE state is sent to the device, and the device enters the Ethernet power supply state.

[0023] S3. If the USB Ethernet device does not exist, but meets the conditions of low power and charging, such as a power threshold less than or equal to a certain percentage and the battery status is charging / fully charged, send a command to the device to enter the PoE state, and the device enters the Ethernet power supply state to utilize external power.

[0024] After entering Ethernet power supply mode, a controlled thread is started and executed at fixed intervals (e.g., 3 seconds): the USB Ethernet device is checked again.

[0025] If the current state is USB to Ethernet adapter powered, the Ethernet power supply device is not present, and the screen is lit, or if the current state is USB to Ethernet adapter powered but the Ethernet power supply device is no longer present, the system returns to Ethernet detection state and re-determines whether to enter Ethernet power supply state or USB to Ethernet adapter powered state. This allows the system to automatically switch back to detection and potentially enter USB to Ethernet adapter powered state when the user unplugs the PoE cable or switches to USB to Ethernet.

[0026] S4. If the USB Ethernet device does not exist and the conditions of low power and charging are not met, first register the Ethernet status monitor, wait for a certain period of time, and then send a command to the device to enter the USB to Ethernet adapter power supply state. The device then enters the USB to Ethernet adapter power supply state.

[0027] After entering USB to Ethernet adapter powered state, start the battery detection thread; query the device system battery / charging status periodically (e.g., every 1 second).

[0028] If the device is detected to have started charging, a re-detection command is sent to the device, and the device returns to the Ethernet detection status.

[0029] In Ethernet detection mode, if the battery is low and the device is charging, it switches to USB to Ethernet adapter powered mode. This enables a smooth transition from USB to Ethernet adapter powered mode to Ethernet powered mode, for example, prioritizing PoE or a unified power supply strategy when PoE or a charger is plugged in.

[0030] Existing technologies do not fully integrate system broadcasts such as power-on completion, screen off / on, ADB debugging mode, OTG mode, and wake-up for mode re-checking or switching. This results in a failure to respond promptly when users plug or unplug network cables or switch usage scenarios, affecting network availability and power consumption.

[0031] To address the aforementioned technical problems, the present invention further includes: S5. When a broadcast indicating that ADB mode or similar debugging has been enabled is received, enter the development / debug state. At this time, power supply to Ethernet is turned off and the detection thread is stopped to avoid power supply conflicts or unnecessary power consumption during debugging.

[0032] S6. When receiving broadcasts such as OTG mode or wake-up, a re-detection command is sent to the device, and the device re-enters the Ethernet detection state, so that the Ethernet power supply state / USB to Ethernet adapter power supply state can be reselected after the user changes the connection method.

[0033] Based on the same inventive concept, the present invention also provides an Ethernet multi-mode switching device, integrated into the Android system framework layer, for implementing the above-mentioned Ethernet multi-mode switching method, including: an Ethernet state machine and an Ethernet service.

[0034] The Ethernet service implements the Ethernet service interface; during construction, an Ethernet state machine is created and passed to the processor; after starting the Ethernet state machine, a check command is sent; the Ethernet state processor updates the current Ethernet state when the state changes and can send broadcasts to the system or application as needed.

[0035] The Ethernet state machine is used to maintain the Ethernet detection state, Ethernet power supply state, USB to Ethernet adapter power supply state, and development / debugging state. Specifically, the Ethernet state machine inherits from the system state machine, maintaining sub-states such as idle state, Ethernet detection state, Ethernet power supply state, USB to Ethernet adapter power supply state, development / debugging state, and screen-off state; it receives messages such as initialization commands, check commands, USB to Ethernet adapter commands, and development mode commands and performs state transitions; internally, it creates and manages controlled threads / POE cycle detection threads and battery detection threads.

[0036] As one implementation, the present invention further includes: an Ethernet status monitor, holding a context and connection manager, requesting Ethernet transport types via network, registering network callbacks, and calling back Ethernet connected / Ethernet disconnected in network available / network lost states; providing a static method for Ethernet connected detection to query whether a verified Ethernet network currently exists.

[0037] As one implementation, the present invention also includes: an Ethernet utility class that provides a static method to check USB Ethernet devices, by executing the system to list USB Ethernet devices or equivalent interfaces and parsing the output to see if it contains a target device ID (such as "0b95:772b"), and returning whether the USB Ethernet device exists.

[0038] As one implementation, the present invention also includes: an Ethernet service management class, which provides the application layer with Ethernet service interfaces and context for querying status or issuing policies (if the interface is extended).

[0039] This invention also includes: Ethernet device type / state constants, defining externally used state constants (such as idle state, connected state, normal state, etc.), which can be mapped to the internal state of the state machine.

[0040] At the hardware level, the device needs to support: an Ethernet power control interface (such as an Ethernet test power control switch via USB session or hardware abstraction layer), a USB host port that can mount USB Ethernet devices with a specified VID:PID (manufacturer ID: product ID), and a system that provides a connection manager and battery / charging status query interface.

[0041] Preferably, the screen on / off broadcast is listened to within the Ethernet state machine or Ethernet service, and the screen off condition is combined in the periodic detection logic to avoid unnecessary switching when the screen is off, such as switching back to detection from Ethernet only when the screen is on and there are no Ethernet devices.

[0042] Network requests based on the system connection manager or broadcasts of older versions of CONNECTIVITY_ACTION request a network with Ethernet transmission type, and callbacks for Ethernet connected and Ethernet disconnected respectively in the cases of network availability and network loss.

[0043] Register the monitor in the Ethernet detection state, and in the callback, decide whether to trigger re-detection or only report the connection mode (such as connection mode 1 / disconnect mode 2) for use by the upper layer or state machine based on whether the current power supply status is USB to Ethernet adapter.

[0044] Provides a static method: Based on NetworkCapabilities, determines whether there is a network with Ethernet transmission type and verified networking capability, used to determine whether the network is actually connected via Ethernet under Ethernet power supply status.

[0045] The Ethernet multi-mode switching system of the present invention will be explained in detail below with reference to the specific implementation process: Step 1: System Startup and State Machine Initialization An Ethernet state machine is created during the construction of the Ethernet service, and the startup state machine is invoked.

[0046] Send a check command to the state machine to transition the initial state from idle to Ethernet detection state.

[0047] Step 2: Mode Decision under Ethernet Detection Status The `enter()` function enters the Ethernet detection state: if a USB session has not yet been created, it will be created; existing controlled threads and battery detection threads will be stopped; an Ethernet status monitor will be created and Ethernet connected / disconnected callbacks will be implemented (a check command can be sent when the USB to Ethernet adapter is powered, otherwise the connection mode will be recorded).

[0048] Call the Ethernet power test to disable Ethernet power supply.

[0049] The loop iterates up to 5 times, with each iteration approximately 1200ms apart: it checks for USB devices (e.g., deviceId="0b95:772b"). If it returns true on any iteration, it sets isPowerPoe=true (the PoE power supply flag is true) and exits the loop.

[0050] If the Power over Ethernet (PoE) flag is true: send an initialization command, and the state machine transitions to the PoE state.

[0051] Otherwise, if the low battery detection is true and the device charging detection is true: send an initialization command, and the state machine transitions to the Ethernet power supply state.

[0052] Otherwise: Invoke Ethernet power supply test to enable power supply for the USB to Ethernet adapter; register the Ethernet status monitor; the thread sleeps for 10 seconds; send the USB to Ethernet adapter command, and the Ethernet state machine transitions to the USB to Ethernet adapter state.

[0053] Step 3: Periodic detection under Power over Ethernet (PoE) status The enter() function, which enters the Ethernet power supply state, creates and starts a controlled thread.

[0054] Every 3 seconds or so in run(), the controlled thread performs the following: checks the USB Ethernet device and updates the Ethernet power flag; optionally, it performs an Ethernet connection detection; if the current state is USB to Ethernet adapter powered and not powered by Ethernet and not screen off, or if the current state is not powered by Ethernet, it sends a check command to the Ethernet state machine and terminates the thread.

[0055] Upon receiving a development mode command, the system switches to development mode; upon receiving a USB to Ethernet adapter command, it switches to USB to Ethernet adapter mode; upon receiving a check command, it switches to Ethernet detection mode.

[0056] Step 4: Charging detection in USB to Ethernet adapter mode Enter() in USB to Ethernet adapter state: creates and starts the battery detection thread; sets the Ethernet adapter flag to true.

[0057] The battery detection thread checks for device charging status approximately every 1 second in run() by checking the battery manager or broadcasting battery level changes. If the current state is a USB to Ethernet adapter and the charging status flag is true, it sends a check command to the state machine and terminates the thread.

[0058] Upon receiving an initialization command, it switches to Ethernet power supply mode; upon receiving a development mode command, it switches to development mode; upon receiving a check command, it switches to Ethernet detection mode.

[0059] Step 5: Development Status and Broadcast Processing When constructing the Ethernet state machine, a broadcast receiver is registered to listen for broadcasts such as ADB mode broadcasts, OTG mode broadcasts, sleep end broadcasts, screen on broadcasts, and screen off broadcasts.

[0060] Upon receiving an ADB mode broadcast: a development mode command is sent, and the state machine transitions from the current state to the development state.

[0061] Upon receiving an OTG mode broadcast or sleep end broadcast: a check command is sent, and the state machine transitions to Ethernet detection state.

[0062] Receive screen-on / screen-off broadcast: Update the screen-off flag for use by the controlled thread.

[0063] The `enter()` method, which enters the development state, stops the controlled thread and the battery detection thread; it also calls the Ethernet Power Supply test to disable Power over Ethernet. It then transitions to either Power over Ethernet or Ethernet detection state upon receiving an initialization or check command.

[0064] Step 6: Status Inquiry and Reporting When an external call retrieves the Ethernet status, it returns one of the following based on the current status: idle status, Ethernet power supply status, Ethernet detection status, USB to Ethernet adapter status, or development status.

[0065] When the Ethernet state handler of the Ethernet service receives a state change message, it updates the current Ethernet state to "Get Ethernet State" and can send a broadcast or notification to other modules.

[0066] The above steps fully describe the closed-loop process from power-on detection to automatic switching between Ethernet power supply status / Ethernet adapter power supply status, development status switching, and re-detection.

[0067] Preferably, the target USB Ethernet device VID:PID (vendor ID: product ID), such as "0b95:772b", can be overridden by product configuration or system attributes.

[0068] The number of polling cycles (e.g., 5 times), intervals (e.g., 1200ms), PoE thread cycles (e.g., 3000ms), and battery detection cycles (e.g., 1000ms) during the detection process can all be adjusted according to hardware and user experience requirements.

[0069] In the low battery detection, a threshold of 2 means that a battery level of ≤2% is considered low. This threshold can be combined with the charging process as a condition for entering Ethernet power supply. The specific threshold can be configured.

[0070] When the USB to Ethernet adapter is powered on during the detection state, the sleep time is 10 seconds (10000), which can be adjusted according to device enumeration and network readiness time.

[0071] If the system does not have a USB session or Ethernet test power interface, a hardware abstraction layer or Java native interface call can be used instead to achieve the semantics of "off / on" Ethernet power supply.

[0072] The Ethernet multi-mode switching device of this invention introduces an Ethernet state machine into the Android system framework layer, abstracting the device's working mode into a finite number of states (such as idle, detection, Ethernet power supply, USB to Ethernet adapter, development / debugging, etc.), and driving state transitions through command messages. In the Ethernet detection state, it determines whether to enter the Ethernet power supply state or the USB to Ethernet adapter power supply state based on conditions such as the presence of the USB Ethernet device, battery level, and charging status. In the Ethernet power supply state and the USB to Ethernet adapter power supply state, the periodic detection thread and the battery detection thread continuously determine whether the switching conditions are met, and listen for system broadcasts (such as ADB mode, OTG mode, screen on / off, wake-up, etc.) to trigger re-detection or directly enter the development state. At the same time, the Ethernet connection status monitor listens for changes in the system's network capabilities, and notifies the state machine or the upper layer when the Ethernet connection / disconnection occurs, thereby achieving a smooth switching between the Ethernet power supply state and the USB to Ethernet adapter power supply state while ensuring power supply safety and functional correctness.

[0073] This invention automatically switches between Ethernet power supply and USB-to-Ethernet adapter power supply modes by detecting the USB Ethernet device's status and power / charging status, eliminating the need for manual user selection and improving usability in industrial and commercial scenarios. A single state machine manages idle, detection, Ethernet power supply, USB-to-Ethernet adapter, and development states and migration conditions, avoiding redundant switching or inconsistent states caused by multiple modules making their own judgments, thus facilitating testing and maintenance. Combined with broadcast triggers such as power-on completion, ADB / OTG, screen on / off, and wake-up to re-detect or enter development mode, mode switching is consistent with user operations and system policies, reducing unnecessary power supply and conflicts. Power supply and power consumption are more rational: in development / debugging mode, Ethernet power supply is actively turned off and the detection thread is stopped; in USB-to-Ethernet adapter power supply mode, re-detection is triggered based on charging status to switch back to Ethernet power supply mode in a timely manner, which helps extend battery life and avoids functional conflicts with USB devices. The modular design of the state machine and monitor facilitates the addition of new states (such as monitoring only, energy-saving mode) or new switching conditions (such as temperature, policy configuration) to meet the needs of different product forms.

[0074] Based on the same inventive concept, the present invention also provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor is used to implement the above-mentioned Ethernet multi-mode switching method when executing the program stored in the memory.

[0075] The communication bus mentioned in the aforementioned electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0076] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0077] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0078] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style of the specification is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.

[0079] The technical principles of the present invention have been described above with reference to specific embodiments. These descriptions are merely for explaining the principles of the invention and should not be construed as limiting the scope of protection of the invention in any way. Based on this explanation, those skilled in the art can readily conceive of other specific embodiments of the invention without inventive effort, and these embodiments will all fall within the scope of protection of the present invention.

Claims

1. A method for Ethernet multi-mode switching, characterized in that, include: In Ethernet detection mode, the presence of a USB Ethernet device is determined by monitoring the USB Ethernet device ID. If a USB Ethernet device is present, it enters Ethernet power supply mode; If the USB Ethernet device is not present, but meets the conditions of low power and charging, it will enter Ethernet power supply mode. If the USB Ethernet device is not present and the conditions of low battery and charging are not met, the device will enter the USB to Ethernet adapter power supply state.

2. The Ethernet multi-mode switching method according to claim 1, characterized in that, After entering Power over Ethernet (PoE) mode, the controlled thread is started; If the current state is USB to Ethernet adapter powered, the Ethernet power supply device does not exist and the screen is lit, or the current state is USB to Ethernet adapter powered but the Ethernet power supply device no longer exists, then return to the Ethernet detection state and re-determine whether to enter the Ethernet power supply state or the USB to Ethernet adapter powered state.

3. The Ethernet multi-mode switching method according to claim 1, characterized in that, After entering USB to Ethernet adapter powered state, the battery detection thread is started; If the device is detected to have started charging, the Ethernet detection status is returned. If the device is in Ethernet detection mode and is low in power and charging mode, it will switch to USB to Ethernet adapter power supply mode.

4. The Ethernet multi-mode switching method according to claim 1, characterized in that, Also includes: When entering development / debugging mode, power to Ethernet is turned off and the detection thread is stopped; Upon receiving a broadcast such as OTG mode or wake-up, it re-enters Ethernet detection state.

5. The Ethernet multi-mode switching method according to claim 1, characterized in that, In Ethernet detection mode, disable Ethernet power supply or set it to no power supply.

6. An Ethernet multi-mode switching device, characterized in that, Integrated into the Android system framework layer, it is used to implement the Ethernet multi-mode switching method as described in any one of claims 1 to 5, including: an Ethernet state machine and an Ethernet service; The Ethernet service creates the Ethernet state machine during construction; The Ethernet state machine is used to maintain the Ethernet detection state, Ethernet power supply state, USB to Ethernet adapter power supply state, and development / debugging state.

7. The Ethernet multi-mode switching device according to claim 6, characterized in that, Also includes: Ethernet Status Monitor is used to query whether a verified Ethernet network currently exists.

8. The Ethernet multi-mode switching device according to claim 6, characterized in that, Also includes: Ethernet utility class, used to query whether a USB Ethernet device exists.

9. The Ethernet multi-mode switching device according to claim 6, characterized in that, Also includes: The Ethernet service management class provides an interface to the application layer to query the current status.

10. An electronic device, characterized in that, The system includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus; the memory is used to store computer programs; and the processor, when executing the program stored in the memory, implements the Ethernet multi-mode switching method as described in any one of claims 1 to 5.