Method for determining device brand information, router and readable storage medium

By listening to MDNS, TLS and DTLS messages, obtaining the brand information of electronic devices, and establishing a mapping relationship between the device brand and the MAC address, it solves the problem that the router cannot recognize the brand information of the device, improves the recognition accuracy and efficiency, and reduces the computing volume and development costs.

CN117714413BActive Publication Date: 2025-01-03HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310944332.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-28
Publication Date
2025-01-03
Estimated Expiration
2043-07-28

AI Technical Summary

Technical Problem

In the prior art, when electronic devices are connected to the router, due to interweaving factors such as manufacturers, devices, and versions, some devices do not carry device brand information. The router cannot identify device brand information through DHCP messages, causing users to be unable to query device brand information. .

Method used

By monitoring multicast domain name system (MDNS), transport layer security (TLS) and datagram transmission layer security (DTLS) messages sent by electronic devices, obtain device brand information and establish device brand information and media access control (MAC) ) The mapping relationship between addresses ensures that after the device is connected to the router, the device brand information can be obtained no matter which type of message is sent.

Benefits of technology

It effectively solves the problem of not being able to identify the device brand information, improves the accuracy and efficiency of device brand identification, reduces the computing volume of routers, and avoids repeated recognition when the device brand information has been identified, reducing development costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117714413B_ABST
    Figure CN117714413B_ABST
Patent Text Reader

Abstract

The present application discloses a method for determining device brand information, a router, and a readable storage medium, and belongs to the field of terminal technology. The method includes: monitoring messages of a target type, wherein the messages of the target type include MDNS messages, TLS messages, and DTLS messages. In the case of monitoring a message of the target type sent by a first electronic device, the device brand information of the first electronic device is obtained from the monitored message, and the first electronic device is any electronic device connected to the router. A first mapping relationship between the device brand information and the first media access control MAC address information of the first electronic device is established. The present application monitors multiple types of messages at the same time, so that the first electronic device can obtain the device brand information of the first electronic device when sending any type of message, thereby solving the problem of being unable to identify the device brand information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal technology, and in particular to a method for determining device brand information, a router, and a readable storage medium. Background Art

[0002] With the rapid development of terminal technology, electronic devices are coming in various forms and versions. In order to strengthen device management, routers are usually required to provide device brand information recognition functions so that users can query the device brand information of connected electronic devices through routers.

[0003] In the related art, when an electronic device is connected to a router, during the interaction of Dynamic Host Configuration Protocol (DHCP) messages, the router parses the DHCP message to obtain device brand information of the connected electronic device from the DHCP message.

[0004] However, due to the interweaving of various factors such as manufacturers, devices, and versions, some electronic devices do not carry device brand information in DHCP messages, resulting in the router being unable to determine the device brand information of the electronic device. Summary of the invention

[0005] The present application provides a method for determining device brand information, a router, and a readable storage medium, which can solve the problem that the device brand information cannot be determined in the related art. The technical solution is as follows:

[0006] In a first aspect, a method for determining device brand information is provided, which is applied to a router, wherein a first electronic device is connected to the router, and the method includes:

[0007] Monitoring messages of a target type, wherein the target type of messages includes multicast domain name system MDNS messages, transport layer security TLS messages, and datagram transport layer security DTLS messages;

[0008] When monitoring a message of the target type sent by the first electronic device, acquiring device brand information of the first electronic device from the monitored message;

[0009] A first mapping relationship between the device brand information and first media access control MAC address information of the first electronic device is established.

[0010] In this way, after the first electronic device is connected to the router, by simultaneously monitoring multiple types of messages, the first electronic device can obtain the device brand information of the first electronic device when sending any type of message, thereby solving the problem of being unable to identify the device brand information.

[0011] As an example of the present application, in the case where a message belonging to the target type sent by the first electronic device is monitored, before acquiring the device brand information of the first electronic device from the monitored message, the method further includes:

[0012] When the first electronic device is connected to the router, obtaining the first MAC address information;

[0013] The acquiring the device brand information of the first electronic device from the monitored message when a message belonging to the target type sent by the first electronic device is monitored includes:

[0014] In a case where it is determined that the device brand information of the first electronic device is not identified according to the first MAC address information, when a message belonging to the target type sent by the first electronic device is monitored, the device brand information of the first electronic device is acquired from the monitored message.

[0015] In this way, after the first electronic device is connected to the router, it is first determined whether the device brand information of the first electronic device has been identified, and only when it is determined that the device brand information of the first electronic device has not been identified, the first module is triggered to perform message parsing. Otherwise, when the device brand information of the first electronic device has been identified, the first module is not triggered to perform message parsing. In this way, repeated identification is avoided when the device brand information of the first electronic device has been known, and the amount of calculation of the router can be reduced.

[0016] As an example of the present application, the monitoring target type of message includes:

[0017] The target type of message is monitored through the first hook, the second hook and the third hook respectively, the first hook is used to monitor the MDNS message, the second hook is used to monitor the DTLS message, and the third hook is used to monitor the TLS message.

[0018] In this way, different types of messages are monitored simultaneously through multiple hooks, so that when the first electronic device reports any type of message, the message can be monitored, thereby ensuring that the device brand information of the first electronic device can be effectively obtained.

[0019] As an example of the present application, the first hook is NF_BR_LOCAL_IN HOOK, the second hook is NF_INET_LOCAL_IN HOOK, and the third hook is NF_INET_PRE_FORWARD HOOK.

[0020] In this way, adding monitoring and parsing functions to the existing hooks of the router can achieve the purpose of monitoring the target type of messages while reducing development costs.

[0021] As an example of the present application, when a message belonging to the target type sent by the first electronic device is monitored, acquiring device brand information of the first electronic device from the monitored message includes:

[0022] When a message of the target type sent by the first electronic device is monitored, the message is parsed according to the type of the monitored message to obtain the device brand information of the first electronic device.

[0023] In this way, the message is parsed according to the type of the monitored message, and different messages are parsed according to different rules, so that the device brand information of the first electronic device can be effectively obtained.

[0024] As an example of the present application, parsing the message according to the type of the monitored message to obtain the device brand information of the first electronic device includes:

[0025] In the case where the message is the MDNS message, parsing a target keyword in a Queries area in the MDNS message to obtain device brand information of the first electronic device, the target keyword including a keyword related to the device brand information;

[0026] In the case where the message is the DTLS message, parsing a first key field in the DTLS message, and determining device brand information of the first electronic device according to the first key field;

[0027] In the case where the message is the TLS message, the second key field of the target message in the TLS message is parsed, and the device brand information of the first electronic device is determined according to the second key field, wherein the target message is a handshark type message of the client hello type.

[0028] In this way, different messages are parsed according to the characteristics of each message, so that the device brand information of the first electronic device can be successfully acquired.

[0029] As an example of the present application, the first key field is the devicename field, and the second key field is the server name field in the extended message.

[0030] As an example of the present application, after establishing the first mapping relationship between the device brand information and the first media access control MAC address information of the first electronic device, the method further includes:

[0031] receiving an information query request sent by a second electronic device, wherein the information query request is used to request to query device brand information of the first electronic device;

[0032] In response to the information query request, generating an information query response based on the first mapping relationship, wherein the information query response carries the first mapping relationship;

[0033] The information query response is fed back to the second electronic device, so that the second electronic device displays the device brand information of the first electronic device based on the first mapping relationship.

[0034] Thus, when the second electronic device requests to query the device brand information of the first electronic device, the pre-established first mapping relationship is sent to the second electronic device, so that the second electronic device can display the device brand information of the first electronic device to the user based on the first mapping relationship.

[0035] As an example of the present application, when a message belonging to the target type sent by the first electronic device is monitored, acquiring device brand information of the first electronic device from the monitored message includes:

[0036] In the case of monitoring a message belonging to the target type sent by the first electronic device, if multiple messages belonging to the target type and of different types are monitored, acquiring device brand information of the first electronic device from each of the multiple messages to obtain multiple device brand information of the first electronic device;

[0037] The establishing of a first mapping relationship between the device brand information and the first media access control MAC address information of the first electronic device includes:

[0038] Performing fault tolerance processing on multiple pieces of device brand information of the first electronic device;

[0039] Deduplication processing is performed on at least one device brand information of the first electronic device after the fault tolerance processing;

[0040] The first mapping relationship is established based on the device brand information of the first electronic device and the first MAC address information after deduplication processing.

[0041] In this way, when multiple messages are monitored, accurate device brand information can be obtained through deduplication and fault tolerance processing, thereby improving the accuracy of recognition.

[0042] In a second aspect, a router is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method for determining device brand information as described in the first aspect when executing the computer program.

[0043] In a third aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is executed on a computer, the computer executes the method for determining device brand information described in the first aspect.

[0044] In a fourth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the method for determining device brand information as described in the first aspect.

[0045] The technical effects obtained by the above-mentioned second aspect, third aspect and fourth aspect are similar to the technical effects obtained by the corresponding technical means in the above-mentioned first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 is a schematic diagram showing an application scenario according to an exemplary embodiment;

[0047] Figure 2 is a schematic structural diagram of a router according to an exemplary embodiment;

[0048] Figure 3 is a schematic diagram of a module of a router according to an exemplary embodiment;

[0049] Figure 4 is a flow chart of a method for determining device brand information according to an exemplary embodiment;

[0050] Figure 5 is a schematic diagram of a module of a router according to another exemplary embodiment;

[0051] Figure 6 is a flowchart of a method for determining device brand information according to another exemplary embodiment;

[0052] Figure 7 is a schematic structural diagram of an electronic device according to an exemplary embodiment;

[0053] Figure 8 The invention is a schematic diagram showing a software system of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0054] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.

[0055] It should be understood that the "multiple" mentioned in this application refers to two or more. In the description of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in order to facilitate the clear description of the technical solution of this application, the words "first" and "second" are used to distinguish between the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not limit them to be different.

[0056] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0057] One or more electronic devices can usually be connected to a router. In some scenarios, users usually have the need to view the device brand information of the connected electronic device, such as the device brand information including the manufacturer and model. In some embodiments, the electronic device usually interacts with the router through DHCP messages during the process of accessing the router. Some electronic devices may carry their own device brand information in the DHCP message. Accordingly, the router obtains the device brand information of the electronic device by parsing the DHCP message, such as obtaining the device brand information of the electronic device by parsing the option field in the DHCP message. In this way, the user can view the device brand information of the connected electronic device from the router. However, with the update of the device form and version of the electronic device, due to the interweaving of various factors such as manufacturers, devices, and versions, some electronic devices do not carry device brand information in the DHCP message, so that the router cannot obtain the device brand information from the DHCP message, resulting in the inability to identify the device brand information of the electronic device. When the user queries, the brand will be displayed as unknown, which brings trouble to the user. To this end, the embodiment of the present application provides a method for determining the device brand information, which simultaneously monitors multiple messages related to the device brand information sent by the electronic device during the service process, and parses the monitored messages to obtain the device brand information of the electronic device, thereby solving the problem of being unable to determine the device brand information.

[0058] For ease of understanding, before introducing in detail the method for determining device brand information provided in an embodiment of the present application, the application scenarios involved in the embodiment of the present application are first introduced.

[0059] In one example, when a user wants to view the device brand information of an electronic device connected to a router, he can view it through an APP (application) 1 in a mobile phone for managing the router. For example, when a user wants to view the device brand information of an electronic device connected to a router, he can open APP1 (such as Smart Space) in a mobile phone and log in to the account bound to the router in APP1. Figure 1 As shown in Figure (a), in response to the user opening APP1 and logging into the router, the mobile phone displays the application homepage S1, which includes the router information 00 that can be managed through APP1. The user can click on the router information 00, and in response to the user's triggering operation on the router information 00, the mobile phone displays the router management interface, such as the router management interface as shown in FIG. Figure 1 The router management interface S2 includes an "access device" item 01. The user can click on the "access device" item 01 to request to view the details of the accessed electronic device. Figure 1As shown in FIG. 5(c), in response to the user's triggering operation on the "connected device" item 01, the mobile phone displays a device details interface S3, which includes detailed information of the connected electronic device, and the detailed information of the electronic device includes the device brand information of the electronic device, such as Figure 1 As shown in Figure (c) in FIG. 1 , the device brand information of the tablet computer connected to the router is "Honor", and the device brand information of the mobile phone is "Apple". That is, the mobile phone displays the device brand information of the currently connected electronic device in the device details interface S3, so that the user can view the device brand information of the electronic device connected to the router.

[0060] Of course, the above is explained by using the example of querying the device brand information of the electronic device connected to the router through APP1 in the mobile phone. In another example, you can also log in to the router through a browser to view it. For example, when a user wants to view the device brand information of the electronic device connected to the router, you can enter the management address of the router in the address input bar of the browser, such as the management address is "192.168.1.1", and accordingly, the mobile phone displays the router login interface. In this way, the user can enter the router username and password in the router login interface and log in to the router, so that the device brand information of the electronic device connected to the router can be viewed.

[0061] It should be noted that the above two methods of viewing the device brand information of the electronic device connected to the router are only exemplary. In another example, the user may also view it in other ways. For example, if the router itself is equipped with a display screen, the user can view it directly from the display screen of the router. For another example, the user can also view it through the router guard, etc., which is not limited in the embodiments of the present application.

[0062] It should also be noted that the above description is based on the example that the electronic devices connected to the router are mobile phones and tablet computers. In some embodiments, the electronic devices connected to the router may also include digital cameras, desktops, laptops, handheld computers, notebook computers, ultra-mobile personal computers (ultra-mobile personal computers, UMPCs), netbooks, personal digital assistants (personal digital assistants, PDAs), augmented reality (augmented reality, AR) and virtual reality (virtual reality, VR) devices, etc., which are not limited in the embodiments of the present application.

[0063] After introducing the application scenarios involved in the embodiments of the present application, the structure of the router involved in the embodiments of the present application is introduced next. Figure 2 , Figure 22 is a schematic diagram of the structure of a router provided in an embodiment of the present application. The router includes at least one processor 201, a communication bus 202, a memory 203 and at least one communication interface 204.

[0064] Processor 201 may be a microprocessor (including a central processing unit (CPU) etc.), an application-specific integrated circuit (ASIC), or may be one or more integrated circuits for controlling the execution of the program of the present application.

[0065] The communication bus 202 may include a pathway for transmitting information between the above-mentioned components.

[0066] The memory 203 may be a read-only memory (ROM), a random access memory (RAM), an electrically erasable programmable read-only memory (EEPROM) or other magnetic storage device, or any other medium capable of carrying or storing a desired program code in the form of an instruction or data structure and accessible by a router, but is not limited thereto. The memory 203 may exist independently and be connected to the processor 201 via the communication bus 202. The memory 203 may also be integrated with the processor 201.

[0067] The communication interface 204 uses any device such as a transceiver for communicating with other devices or communication networks.

[0068] In a specific implementation, as an embodiment, the processor 201 may include one or more CPUs, such as Figure 2 CPU0 and CPU1 are shown in the figure.

[0069] In a specific implementation, as an embodiment, the router may include multiple processors, such as Figure 2 201 and processor 205 shown in FIG. Each of these processors may be a single-core processor or a multi-core processor. A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).

[0070] As an embodiment, the router may further include an output device 206 and an input device 207. The output device 206 communicates with the processor 201 and may display information in a variety of ways. For example, the output device 206 may be a liquid crystal display (LCD), a light emitting diode (LED) display device, etc. The input device 207 communicates with the processor 201 and may receive user input in a variety of ways. For example, the input device 207 may be a mouse, a keyboard, a touch screen device, or a sensor device, etc.

[0071] The memory 203 is used to store the program code 210 for executing the solution of the present application, and the processor 201 is used to execute the program code 210 stored in the memory 203. The router can implement the following by using the processor 201 and the program code 210 in the memory 203: Figure 3 An embodiment provides a method for determining device brand information.

[0072] Please refer to Figure 3 , Figure 3 It is a framework diagram of a router shown according to an exemplary embodiment. The router includes a first module and a second module. The first module is used to monitor messages carrying device brand information, and parse out the device brand information and the media access control (MAC) address information of the electronic device, and then report it to the second module. Exemplarily, the monitored messages include multicast domain name system (MDNS) messages, transport layer security (TLS) messages, and datagram transport layer security (DTLS) messages; the second module is used to establish a first mapping relationship between the device brand information parsed by the first module and the MAC address information, and manage the first mapping relationship. In an example, the second module includes a device brand information collection module, and the second module collects device brand information through the device brand information collection module.

[0073] Among them, the first module runs in the kernel space, and the second module runs in the user space. The kernel space is the operating space of the kernel, which can execute any command and call all the resources of the system; the user space is the operating space of some conventional processes (such as the second module), which can only perform simple operations, cannot directly call system resources, and needs to issue instructions to the kernel through the system interface. Since the kernel space and the user space are independent of each other, even if the conventional process crashes, the kernel will not be affected, that is, the parsing of the device brand information and the MAC address information of the electronic device in the embodiment of the present application does not affect each other from establishing the first mapping relationship and managing the first mapping relationship.

[0074] Based on the above embodiment, the method for determining device brand information provided by the embodiment of the present application is described in detail below. Figure 4 , Figure 4 The present invention is a flowchart of a method for determining device brand information according to an exemplary embodiment. The present invention takes the method implemented by the interaction between a router and an electronic device as an example. Further, the router interacts with the electronic device through the above-mentioned first module and second module. The method may include some or all of the following contents:

[0075] Step 401: a first electronic device sends an access request to a first module, where the access request is used to request access to a router.

[0076] In one possible case, when the user needs to use the first electronic device to access the Internet, the first electronic device can be triggered to access the router. In another possible case, when the first electronic device enters the local area network covered by the router, it automatically requests to access the router. In implementation, the first electronic device uses its own MAC address information (hereinafter referred to as the first MAC address information) to request access to the router. For example, the first electronic device can send an access request to the router, and the access request carries the first MAC address information of the first electronic device.

[0077] Step 402: The first module controls the first electronic device to access the router.

[0078] After the first electronic device requests access, the router establishes a link with the first electronic device through the first module, allocates IP address information to the first electronic device, establishes a second mapping relationship between the IP address information and the first MAC address information, and controls the access of the first electronic device, so that the first electronic device is connected to the wireless fidelity (WiFi) network. In this way, the first electronic device can access the Internet through the router, and the router uses the second mapping relationship to forward the data packets of the first electronic device during the subsequent data transmission process.

[0079] That is, the first electronic device accessing the router described in the embodiment of the present application means that the first electronic device has been connected to the WiFi network of the router, or in other words, the router has allocated Internet Protocol (IP) address information to the first electronic device, and the first electronic device can access the Internet through the router.

[0080] According to the above description, the first electronic device can be any electronic device connected to a router, such as a mobile phone, a tablet computer, a laptop computer, etc.

[0081] It should be noted that the embodiment of the present application is described by taking the example of a router controlling the access of the first electronic device through the first module. In another example, the router may also control the access of the first electronic device through the first module in combination with other modules (such as the second module), and the embodiment of the present application is not limited to this.

[0082] Step 403: The first module monitors messages of the target type.

[0083] As an example of the present application, target type messages include MDNS messages, TLS messages, and DTLS messages.

[0084] Normally, after the first electronic device is connected to the router, it will interact with the router for some messages according to business needs, and the messages sent are different when the types and brands of the first electronic device are different. In one example, when the first electronic device is a computer (window) or mobile phone type electronic device, after the first electronic device is connected to the router, it will usually send an MDNS message to the router to notify the communication information of the first electronic device itself to other electronic devices connected to the same local area network through the MDNS message, such as the communication information includes the IP address information and device name of the first electronic device, so that other electronic devices can find the first electronic device based on the communication information, and then communicate with the first electronic device when necessary. In addition, when the first electronic device is a mobile phone type device, after accessing the router, it may also send a TLS message to the router to connect with the server of the manufacturer to which the first electronic device belongs through the TLS message, so as to perform official website authentication, so that the first electronic device can log in to its own official website. In another example, when the first electronic device is a mobile phone or computer type electronic device, after the first electronic device is connected to the router, it may also send a DTLS message to the router to realize device discovery with other electronic devices through the DTLS message, so that the first electronic device can establish communication with other electronic devices in the local area network.

[0085] It can be seen that when the first electronic device is an electronic device of a different type, the messages sent by the first electronic device after accessing the router are different. Based on this, since it is uncertain what type of message the first electronic device sends after accessing the router, that is, the router cannot determine which type of message of the target type the first electronic device will send after accessing, after the first electronic device accesses the router, the router simultaneously monitors all types of messages of the target type through the first module, that is, it simultaneously monitors MDNS messages, TLS messages, and DTLS messages, so that no matter which type of message of the three types is sent by the first electronic device, the first module can monitor it.

[0086] As an example of the present application, the specific implementation of the first module monitoring the target type of messages may include: monitoring the target type of messages through the first hook, the second hook and the third hook respectively, the first hook is used to monitor the MDNS message, the second hook is used to monitor the DTLS message, and the third hook is used to monitor the TLS message.

[0087] The first hook, the second hook and the third hook are three hooks in the bridge of the router. In an example, the first hook is NF_BR_LOCAL_IN HOOK, the second hook is NF_INET_LOCAL_IN HOOK, and the third hook is NF_INET_PRE_FORWARD HOOK. That is, the monitoring function of the target type of message can be added to NF_BR_LOCAL_IN HOOK, NF_INET_LOCAL_IN HOOK and NF_INET_PRE_FORWARD HOOK respectively.

[0088] Please refer to Figure 5 , NF_BR_LOCAL_IN HOOK is in the link layer of the kernel, NF_INET_LOCAL_IN HOOK is in the network layer of the kernel, and NF_INET_PRE_FORWARD HOOK is in the network layer of the kernel.

[0089] As an example but not limitation, a device manufacturer data collection module runs in the first module, and the first module monitors messages of the target type through the device manufacturer data collection module.

[0090] It should be noted that the embodiment of the present application is described by taking the case where only the first electronic device is connected to the router as an example. In another example, the router may have been connected to other electronic devices before the first electronic device is connected. For the router, as long as an electronic device is connected, it can start to monitor the target type of messages passing through the kernel space.

[0091] Step 404: The first module obtains first MAC address information of the first electronic device.

[0092] As mentioned above, when the first electronic device accesses the router, it provides the first MAC address information to the router, for example, by carrying the first MAC address information in the access request. Therefore, the first module can obtain the first MAC address information of the first electronic device.

[0093] Step 405: The first module sends the first MAC address information to the second module.

[0094] As an example of the present application, the first module may report the first MAC address information to the second module through a netlink mechanism, wherein netlink is an inter-process communication (IPC) mechanism, which is a mechanism for communication between kernel space and user space.

[0095] Step 406: The second module determines whether the device brand information of the first electronic device has been recognized based on the first MAC address information.

[0096] As an example of the present application, the second module can manage the device brand information and MAC address information of each electronic device. For example, after obtaining the device brand information and MAC address information of a certain electronic device, a mapping relationship between the device brand information and the MAC address information of the electronic device can be established, and then the mapping relationship can be stored in a database, for example, in the form of a table. Based on this, when it is necessary to determine whether the device brand information of the first electronic device has been identified, the second module can query from the database whether there is device brand information corresponding to the MAC address information of the first electronic device, for example, it can query whether the device brand information corresponding to the first MAC address information is stored in the table. If the device brand information corresponding to the first MAC address information exists in the database, it is determined that the device brand information of the first electronic device has been identified. Otherwise, if the device brand information corresponding to the first MAC address information does not exist in the database, or if the first MAC address information does not exist in the database, it is determined that the device brand information of the first electronic device has not been identified.

[0097] If the device brand information of the first electronic device is determined to have been identified based on the first MAC address information, the subsequent operation may be terminated, that is, the subsequent operation may not be performed. Otherwise, if the device brand information of the first electronic device is determined not to have been identified based on the first MAC address information, the operation proceeds to step 406.

[0098] Step 407: when it is determined based on the first MAC address information that the device brand information of the first electronic device has not been identified, the second module sends a parsing instruction to the first module, where the parsing instruction is used to instruct the first module to perform message parsing.

[0099] In the case where it is determined based on the MAC address information of the first electronic device that the device brand information of the first electronic device has not been identified, it is usually necessary to identify the device brand information of the first electronic device. To this end, the second module sends a parsing instruction to the first module to instruct the first module to parse the monitored message belonging to the target type, thereby determining the device brand information of the first electronic device based on the monitored message.

[0100] It is worth mentioning that after the first electronic device is connected to the router, it is first determined whether the device brand information of the first electronic device has been identified. The first module is triggered to perform message parsing only when it is determined that the device brand information of the first electronic device has not been identified. Otherwise, the first module is not triggered to perform message parsing when the device brand information of the first electronic device has been identified. In this way, repeated identification is avoided when the device brand information of the first electronic device has been known, thereby reducing the operation of the router.

[0101] In one example, multiple electronic devices may be connected to the router, so in order to facilitate the first module to know which electronic device or electronic devices send messages of the target type that need to be parsed, the second module can carry the first MAC address information in the parsing instruction, so that the first module performs the message parsing operation based on the first MAC address information when it determines that a message of the target type is monitored from the first electronic device.

[0102] It should be noted that steps 404 to 407 are optional operations. In another example, it is also possible not to determine whether the device brand information of the first electronic device has been identified, but to directly perform the following step 408 after the first electronic device is connected to the router. This embodiment of the present application is not limited to this.

[0103] Step 408: When monitoring a message of a target type sent by the first electronic device, the first module acquires device brand information of the first electronic device from the monitored message.

[0104] In implementation, before the first electronic device sends a message to the router, it packages the message into a data frame, carries the first MAC address information, port number, protocol type and other information in the data frame, and then sends the data frame to the router. Accordingly, after the router receives the data frame through the first module, it parses the first MAC address information from the data frame, so that it can be determined that the data frame is from the first electronic device. In addition, the first module can parse the port number and protocol type from the data frame, so that the type of the message can be determined according to the port number and protocol type.

[0105] As an example of the present application, when the first module monitors a message from the first electronic device and determines that the type of the message belongs to the target type based on the port number and protocol information, the first module parses the message according to the parsing rules corresponding to the type of the currently received message to obtain the device brand information of the first electronic device.

[0106] Among them, the parsing rules corresponding to different types of messages are generally different. The parsing rules corresponding to various types of messages in the target type can be set according to needs. Specifically, the following possible situations can be included:

[0107] In one possible case, the first electronic device sends an MDNS message to the router after accessing the router. In this case, the first module monitors the MDNS message through NF_BR_LOCAL_IN HOOK, and then parses the target keywords in the Queries area of ​​the MDNS message to determine the device brand information of the first electronic device.

[0108] The target keywords include keywords related to device brand information, which can be set according to needs. In one example, the target keywords include keywords of some known brands, such as but not limited to Honor, HW, Mi, Apple, Lenovo, etc.

[0109] Exemplarily, part of the monitored MDNS message from the first electronic device is as follows:

[0110] ∨Multicast Domain Name System(query)

[0111] ∨Queries

[0112] >_apple-mobdev._tcp.local:type PTR,class IN,"QM" question

[0113] >90ea07ef._sub._apple-mobdev2._tcp.local:type PTR,class IN,"QM" question

[0114] >_apple-pairable._tcp.local:type PTR,class IN,"QM" question

[0115] >_uscan._tcp.local:type PTR,class IN,"QM" question

[0116] In this case, the first module can traverse the Queries area in the MDNS message through NF_BR_LOCAL_IN HOOK to search for the target keyword in the Queries area. For example, if the target keyword is _apple-mobdev._tcp.local or _apple-pairable._tcp.local, the device brand information of the first electronic device can be determined to be "Apple".

[0117] For another example, part of the content of the MDNS message intercepted from the first electronic device is as follows:

[0118] ∨Multicast Domain Name System(query)

[0119] ∨Queries

[0120] ∨{"nm":"Mi 11Pro","as":"

[8194] ","ip":"5"}._mi-connect._udp.local:type ANY,class IN,

[0121] The “QU” question

[0122] Name:{"nm":"Mi 11Pro","as":"

[8194] ","ip":"5"}._mi-connect._udp.local

[0123] [Name Length:64]

[0124] In this case, the first module traverses the Queries area in the MDNS message through NF_BR_LOCAL_IN HOOK to search for the target keyword in the Queries area. For example, if the target keyword found is Mi 11Pro, it can be determined that the device brand information of the first electronic device is "Mi".

[0125] It can be seen that, when the NF_BR_LOCAL_IN HOOK intercepts the MDNS message, the device brand information of the first electronic device can be obtained by parsing the target keyword in the Queries area.

[0126] In another possible case, after the first electronic device accesses the router, it sends a DTLS message to the router. In this case, the first module will monitor the DTLS message through NF_INET_LOCAL_IN HOOK. After that, the first module parses the first key field in the DTLS message and determines the device brand information of the first electronic device based on the first key field. The first key field is a field associated with the device brand information. In one example, the first key field is the devicename field.

[0127] Exemplarily, part of the monitored DTLS message from the first electronic device is as follows:

[0128] P...=.192.168.6.255..device_discover.{"deviceID":"{\"UDID\":\"F02C4E4236FA24888\"}","devicename":"HONOR 50Pro","type":14,"hicomversion":"3.2.0.0","mode":1,"deviceHash":"0","serviceData":"EID:0,gId:B7,...}"

[0129] In this case, the first module parses the string corresponding to the devicename field in the DTLS message through NF_INET_LOCAL_IN HOOK, that is, parses the "HONOR 50Pro" string corresponding to the "devicename" field, which includes keywords related to the device brand information, namely "HONOR", so that it can be determined that the device brand information of the first electronic device is "HONOR".

[0130] In another possible case, the first electronic device sends a TLS message to the router after accessing the router. In this case, the first module will monitor the TLS message through NF_INET_PRE_FORWARD HOOK. After that, the first module parses the string corresponding to the second key field of the target message in the TLS message, and determines the device brand information of the first electronic device based on the second key field. The target message is a handshark type of client hello type message, and the second key field is a field associated with the device brand information. In one example, the second key field is the server name field in the extended message.

[0131] Exemplarily, part of the monitored TLS message from the first electronic device is as follows:

[0132] ∨Transport Layer Security

[0133] ∨TLSv1.3 Record Layer:Handshake Protocol:Client Hello

[0134] Content Type:Handshake(22)

[0135] Version:TLS1.0(0x0301)

[0136] Length:638

[0137] ∨Handshake Protocol:Client Hello ...

[0139] ∨Extension:server_name(len=48)

[0140] Type: server_name(0)

[0141] Length:48

[0142] ∨Server Name Indication extension

[0143] Server Name list length:46

[0144] Server Name Type: host_name(0)

[0145] Server Name length:43

[0146] Server Name:connectivitycheck.platform.hihonorcloud.com

[0147] In this case, the message with Handshake Type of Client Hello type (i.e., the target message) is parsed. Specifically, the server name field of the message with option of extension type 0x00 (i.e., server_name) in the target message is parsed, and the parsed string is "connectivitycheck.platform.hihonorcloud.com". The parsed string includes content "hihonor" related to the device brand information, thereby determining that the device brand information of the first electronic device is "hihonor".

[0148] For another example, part of the content of the monitored TLS message from the first electronic device is as follows:

[0149] ∨Transport Layer Security

[0150] ∨TLSv1.2 Record Layer:Handshake Protocol:Client Hello

[0151] Content Type:Handshake(22)

[0152] Version:TLS1.0(0x0301)

[0153] Length:512

[0154] ∨Handshake Protocol:Client Hello ...

[0156] ∨Extension:server_name(len=28)

[0157] Type: server_name(0)

[0158] Length:28

[0159] ∨Server Name Indication extension

[0160] Server Name list length:26

[0161] Server Name Type: host_name(0)

[0162] Server Name length:23

[0163] Server Name:configuration.apple.com

[0164] In this case, the message with Handshake Type of Client Hello type (i.e., the target message) is parsed. Specifically, the server name field of the message with option of extension type 0x00 (i.e., server_name) in the target message is parsed, and the parsed string is "configuration.apple.com". The parsed string includes content "apple" related to the device brand information, thereby determining that the device brand information of the first electronic device is "apple".

[0165] For another example, part of the content of the monitored TLS message from the first electronic device is as follows:

[0166] ∨Transport Layer Security

[0167] ∨TLSv1.2 Record Layer:Handshake Protocol:Client Hello

[0168] Content Type:Handshake(22)

[0169] Version:TLS1.0(0x0301)

[0170] Length:512

[0171] ∨Handshake Protocol:Client Hello ...

[0173] ∨Extension:server_name(len=22)

[0174] Type: server_name(0)

[0175] Length:22

[0176] ∨Server Name Indication extension

[0177] Server Name list length:20

[0178] Server Name Type: host_name(0)

[0179] Server Name length:17

[0180] Server Name:dta.lenovo.com.cn

[0181] In this case, the message with Handshake Type of Client Hello type (i.e., the target message) is parsed. Specifically, the server name field of the message with option of extension type 0x00 (i.e., server_name) in the target message is parsed, and the parsed string is "dta.lenovo.com.cn". The parsed string includes content "lenovo" related to the device brand information, thereby determining that the device brand information of the first electronic device is "lenovo".

[0182] In another possible case, the first module may also monitor two or more types of messages. In this case, the first module may parse each of the two or more types of messages monitored according to the above-mentioned possible implementation methods to obtain the device brand information carried in each message. For example, the first module may monitor MDNS messages and TLS messages. In this case, the first module parses the device brand information in the MDNS message through NF_BR_LOCAL_IN HOOK according to the above-mentioned first possible implementation method, and the first module parses the device brand information in the DTLS message through NF_INET_PRE_FORWARD HOOK according to the above-mentioned third possible implementation method.

[0183] It should be noted that the above is explained by using NF_INET_LOCAL_IN HOOK to monitor DTLS messages and NF_INET_PRE_FORWARD HOOK to monitor TLS messages. In another example, DTLS messages and TLS messages can also be monitored through other hooks in linklayer, which is not limited in the embodiments of the present application.

[0184] In addition, if the device brand information of the first electronic device is not parsed out during the parsing of any message, the subsequent operations are terminated, and the messages belonging to the target type are continuously monitored.

[0185] Step 409: The first module reports the device brand information and the first MAC address information of the first electronic device to the second module.

[0186] After the first module determines the device brand information of the first electronic device, the determined device brand information and the first MAC address information are reported to the second module for management, wherein the first MAC address information can be parsed from the data frame received from the first electronic device. Figure 5 As shown, the first module can report the determined device brand information to the second module through the netlink mechanism.

[0187] Step 410: The second module establishes a first mapping relationship between the device brand information and the first MAC address information.

[0188] As an example of the present application, the second module establishes the first mapping relationship, and then the first mapping relationship can be stored in the database. That is, the second module uniformly manages the mapping relationship between the device brand information and the MAC address information of each electronic device.

[0189] As another example of the present application, when multiple messages belonging to the target type and different types are monitored, the device brand information of the first electronic device is obtained from each of the multiple messages to obtain multiple device brand information of the first electronic device. At this time, the specific implementation of establishing a first mapping relationship between the device brand information and the MAC address information of the first electronic device may include: performing fault-tolerant processing on the multiple device brand information of the first electronic device, and performing deduplication processing on at least one device brand information of the first electronic device after the fault-tolerant processing. Based on the device brand information of the first electronic device after the deduplication processing and the first MAC address information, a first mapping relationship is established.

[0190] According to the previous records, the first module may monitor different types of messages, such as MDNS messages and TLS messages. After parsing, the first module will obtain multiple device brand information of the first electronic device, and the first module reports multiple device brand information of the first electronic device to the second module. In this case, the second module can perform deduplication processing on multiple device brand information, that is, delete the same device brand information from multiple device brand information to obtain deduplicated device brand information. Afterwards, the deduplicated device brand information can be fault-tolerant, such as removing abnormal information. Among them, the abnormal information is neither a character nor a number, and / or the abnormal information is information that is not displayed, and / or the abnormal information is a character whose length does not match the length indicated in the message. After fault-tolerant processing, the second module establishes a first mapping relationship between the final device brand information and the first MAC address information, and stores the first mapping relationship in the database.

[0191] As an example but not limitation, a device brand information collection module runs in the second module, and the second module collects the device brand information and the first MAC address information of the first electronic device through the device brand information collection module, and manages the collected data.

[0192] At this point, the determination and management operations of the device brand information of the first electronic device are completed. By adding multiple sampling mechanisms and taking advantage of the opportunity of the first electronic device reporting messages related to the device brand information, the kernel monitors the messages and parses the device brand information, thereby associating the mapping relationship between the device brand information and the first MAC address information, thereby improving the accuracy of brand recognition.

[0193] Furthermore, after the second module stores the first mapping relationship in the database, when the user queries the device brand information through the second electronic device, the second module can provide the second electronic device with the device brand information of the first electronic device based on the established first mapping relationship.

[0194] Step 411: the second electronic device sends an information query request to the second module in response to the query operation, where the information query request is used to request to query the device brand information of the electronic device connected to the router.

[0195] In an example, see Figure 1 In (b), when the user wants to query the device brand information of the electronic device connected to the router, the "Access Device" item 01 in the routing management interface S2 displayed by the second electronic device can be triggered, and accordingly, the second electronic device receives the query operation. In response to the query operation, the second electronic device sends an information query request to the router, and the router receives the information query request through the second module.

[0196] In one example, the information query request may carry the first MAC address information and / or IP address information of the first electronic device to request to query the device brand information of the first electronic device. The first MAC address information and / or IP address information of the first electronic device may be input by the user in the second electronic device, or the second electronic device may obtain it through other means, which is not limited in the embodiments of the present application.

[0197] In an example, the second electronic device is an electronic device connected to a router. The second electronic device may be the same electronic device as the first electronic device, or may not be the same electronic device as the first electronic device, which is not limited in the embodiments of the present application.

[0198] Step 412: In response to the information query request, the second module queries the database for a first mapping relationship of the currently connected first electronic device.

[0199] In one example, the second module obtains mapping relationships of all electronic devices currently connected to the router from a database, including the first mapping relationship.

[0200] In another example, when the information query request carries the first MAC address information and / or IP address information of the first electronic device, the second module can obtain the first mapping relationship from the database based on the first MAC address information and / or the IP address information of the first electronic device. For example, when the information query request carries the IP address information of the first electronic device, the corresponding MAC address information can be queried from the second mapping relationship based on the IP address information of the first electronic device to obtain the first MAC address information, and then the first mapping relationship can be obtained from the database based on the first MAC address information.

[0201] Step 413: The second module sends the first mapping relationship to the second electronic device.

[0202] In one example, the second module may feed back the first mapping relationship to the second electronic device in the form of an information query response, that is, carry the first mapping relationship in the information query response, so that the second electronic device displays the device brand information of the first electronic device based on the first mapping relationship.

[0203] Step 414: The second electronic device displays the device brand information of the first electronic device based on the first mapping relationship.

[0204] For example, Figure 1 As shown in Figure (c), the second electronic device displays the device brand information of the first electronic device in the device details interface based on the first mapping relationship. For example, if the first electronic device is a tablet computer, the displayed device brand information is Honor, or Honor MagicPad 13.

[0205] Of course, when the second module also sends the mapping relationship corresponding to other electronic devices to the second electronic device, the second electronic device also displays the device brand information of other electronic devices in the device details interface. For example, if the other electronic device is a mobile phone, the displayed device brand information is Apple.

[0206] In an embodiment of the present application, messages of a target type are monitored, wherein the messages of the target type include MDNS messages, TLS messages, and DTLS messages. When any type of message of the target type sent by the first electronic device is monitored, the device brand information of the first electronic device is obtained from the monitored message, and a first mapping relationship between the device brand information and the first MAC address information of the first electronic device is established, and the device brand information of the first electronic device can be subsequently queried based on the first mapping relationship. In this way, after the first electronic device is connected to the router, by monitoring multiple types of messages at the same time, the first electronic device can obtain the device brand information of the first electronic device when sending any type of message, thereby solving the problem of being unable to identify the device brand information.

[0207] For ease of understanding, let's combine Figure 6 The general process of the method provided in the embodiment of the present application is introduced through the following embodiment, which may specifically include the following steps:

[0208] 1. The router controls access of the first electronic device through the first module.

[0209] 2. The router monitors the target type of messages through the first module.

[0210] 3. The router determines, through the second module, based on the first MAC address information, whether the device brand information of the first electronic device has been recognized.

[0211] When the second module determines that the device brand information of the first electronic device has not been identified based on the first MAC address information, proceed to the following step 4; otherwise, when the second module determines that the device brand information of the first electronic device has been identified based on the first MAC address information, the process ends.

[0212] 4. When monitoring a message of a target type sent by the first electronic device, the first module parses the message based on the type of the monitored message.

[0213] By way of example, the following possible situations may be included:

[0214] 41. When the monitored message is a TLS message, the first module parses the string corresponding to the second key field of the target message in the LTS message. 42. When the monitored message is an MDNS message, the first module parses the target keyword in the Queries area of ​​the MDNS message. 43. When the monitored message is a DTLS message, the first module parses the first key field in the DTLS message.

[0215] 5. The first module reports the first MAC address information and device brand information to the second module.

[0216] 6. The second module establishes a first mapping relationship between the first MAC address information and the device brand information.

[0217] 7. The second module saves the first mapping relationship to the database.

[0218] It should be noted that Figure 6 The specific implementation of each step shown can be found in the above Figure 4 The embodiment shown.

[0219] Next, the electronic device involved in the embodiment of the present application is briefly introduced. Figure 7 , Figure 7 1 is a schematic diagram of the structure of an electronic device according to an exemplary embodiment. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0220] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0221] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0222] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0223] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0224] In some embodiments, the processor 110 may include one or more interfaces, such as an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0225] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0226] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device 100 through the power management module 141.

[0227] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193 and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0228] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0229] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0230] The wireless communication module 160 can provide wireless communication solutions for application in the electronic device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.

[0231] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0232] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is an integer greater than 1.

[0233] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0234] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0235] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created by the electronic device 100 during use (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0236] The electronic device 100 can implement audio functions, such as music playback, recording, etc., through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D and the application processor.

[0237] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.

[0238] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. Indicator 192 can be an indicator light, which can be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0239] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software system of the electronic device 100.

[0240] Figure 8 1 is a block diagram of a software system of an electronic device 100 provided in an embodiment of the present application. Figure 8 The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, namely, the application layer, the application framework layer, the Android runtime (Android runtime) and the system layer, and the kernel layer.

[0241] The application layer can include a series of application packages. Figure 8 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.

[0242] The application framework layer provides application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions. Figure 8 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, etc. The window manager is used to manage window programs. The window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, capture the screen, etc. The content provider is used to store and obtain data and make these data accessible to applications. These data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc. The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build the display interface of the application, and the display interface can be composed of one or more views, for example, including a view for displaying a text message notification icon, including a view for displaying text, and including a view for displaying pictures. The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.). The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, etc. The notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of an icon or scroll bar text, such as a notification of an application running in the background. The notification manager can also be a notification that appears on the screen in the form of a dialog window, such as a text message in the status bar, a reminder sound, an electronic device vibrating, an indicator light flashing, etc.

[0243] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system. The core library consists of two parts: one is the function that the Java language needs to call, and the other is the Android core library. The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0244] The system library can include multiple functional modules, such as: surface manager, media library, 3D graphics processing library (such as: OpenGL ES), 2D graphics engine (such as: SGL), etc. The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications. The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc. The 2D graphics engine is a drawing engine for 2D drawing.

[0245] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.

[0246] The following is an illustrative description of the workflow of the software and hardware of the electronic device 100 in conjunction with capturing a photo scene.

[0247] When the touch sensor 180K receives a touch operation, the corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into a raw input event (including touch coordinates, timestamp of the touch operation, and other information). The raw input event is stored in the kernel layer. The application framework layer obtains the raw input event from the kernel layer and identifies the control corresponding to the raw input event. For example, if the touch operation is a single-click operation and the control corresponding to the single-click operation is the control of the camera application icon, the camera application calls the interface of the application framework layer, starts the camera application, and then calls the kernel layer to start the camera driver to capture static images or videos through the camera 193.

[0248] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on the router, the process or function described in the embodiment of the present application is generated in whole or in part. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, router, server or data center by wired (such as: coaxial cable, optical fiber, data subscriber line (Digital Subscriber Line, DSL)) or wireless (such as: infrared, wireless, microwave, etc.) mode to another website site, router, server or data center. The computer-readable storage medium can be any available medium that the router can access, or a data storage device such as a server, data center, etc. that includes one or more available media integration. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a digital versatile disc (DVD)), or a semiconductor medium (such as a solid state drive (SSD)).

[0249] The above are optional embodiments provided for the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the technical scope disclosed in the present application shall be included in the protection scope of the present application.

Claims

1. A method for determining device brand information, characterized in that: Applied in a router, the router is connected to a first electronic device, and the method includes: Monitoring messages of a target type, wherein the messages of the target type include multicast domain name system MDNS messages, transport layer security TLS messages, and datagram transport layer security DTLS messages, and the router starts to perform the operation of monitoring messages of the target type when an electronic device is connected; When monitoring a message of the target type sent by the first electronic device, acquiring device brand information of the first electronic device from the monitored message; Establishing a first mapping relationship between the device brand information and the first media access control MAC address information of the first electronic device; Wherein, when a message belonging to the target type sent by the first electronic device is monitored, acquiring the device brand information of the first electronic device from the monitored message includes: In the case of monitoring a message belonging to the target type sent by the first electronic device, if the message is the DTLS message, parsing a first key field in the DTLS message, and determining device brand information of the first electronic device according to the first key field, the first key field being a devicename field; If the message is the TLS message, parse the second key field of the target message in the TLS message, and determine the device brand information of the first electronic device based on the second key field, wherein the target message is a message of handshake type client hello type, and the second key field is the severname field in the extended message.

2. The method according to claim 1, characterized in that Before acquiring the device brand information of the first electronic device from the monitored message when the message belonging to the target type sent by the first electronic device is monitored, the method further includes: When the first electronic device is connected to the router, obtaining the first MAC address information; The acquiring the device brand information of the first electronic device from the monitored message when a message belonging to the target type sent by the first electronic device is monitored includes: In a case where it is determined that the device brand information of the first electronic device is not identified according to the first MAC address information, when a message belonging to the target type sent by the first electronic device is monitored, the device brand information of the first electronic device is acquired from the monitored message.

3. The method according to claim 1 or 2, characterized in that The monitoring target type of the message includes: The target type of message is monitored through the first hook, the second hook and the third hook respectively, the first hook is used to monitor the MDNS message, the second hook is used to monitor the DTLS message, and the third hook is used to monitor the TLS message.

4. The method according to claim 3, characterized in that The first hook is NF_BR_LOCAL_IN HOOK, the second hook is NF_INET_LOCAL_IN HOOK, and the third hook is NF_INET_PRE_FORWARD HOOK.

5. The method according to claim 1, characterized in that The acquiring the device brand information of the first electronic device from the monitored message includes: In the case that the message is the MDNS message, the target keywords in the Queries area of ​​the MDNS message are parsed to obtain the device brand information of the first electronic device, where the target keywords include keywords related to the device brand information.

6. The method according to claim 1, characterized in that After establishing the first mapping relationship between the device brand information and the first media access control MAC address information of the first electronic device, the method further includes: receiving an information query request sent by a second electronic device, wherein the information query request is used to request to query device brand information of the first electronic device; In response to the information query request, generating an information query response based on the first mapping relationship, wherein the information query response carries the first mapping relationship; The information query response is fed back to the second electronic device, so that the second electronic device displays the device brand information of the first electronic device based on the first mapping relationship.

7. The method according to any one of claims 1, 2, 5 or 6, characterized in that The acquiring the device brand information of the first electronic device from the monitored message when a message belonging to the target type sent by the first electronic device is monitored includes: In the case of monitoring a message belonging to the target type sent by the first electronic device, if multiple messages belonging to the target type are monitored, acquiring device brand information of the first electronic device from each of the multiple messages to obtain multiple device brand information of the first electronic device; The establishing of a first mapping relationship between the device brand information and the first media access control MAC address information of the first electronic device includes: Performing fault tolerance processing on multiple pieces of device brand information of the first electronic device; Deduplication processing is performed on at least one device brand information of the first electronic device after the fault tolerance processing; The first mapping relationship is established based on the device brand information of the first electronic device and the first MAC address information after deduplication processing.

8. A router, characterized in that: The router comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 7 when executing the computer program.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the method according to any one of claims 1 to 7.