主权项 |
1. A method for identifying device ports of a data card in a Linux system, comprising:
acquiring information of a universal serial bus (USB) device, recording device information of the USB device to be identified in the acquired information; acquiring port information of ports of the USB device to be identified according to the device information of the USB device to be identified; and searching out two ports that respond to an attention (AT) command from all the ports according to the port information; after device ports identification is successful, searching for a product identity, PID, of the USB device in a Pid_Positive array, if the Pid_Positive array has the PID of the USB device, indicating that the device ports are positively ordered, therefore an AT port and a Modem port being accurately identified; if the Pid_Positive array does not have the PID of the USB device, searching for the PID of the USB device in a Pid_NePositive array, if the PID is found, indicating that the device ports are reversely ordered, therefore the AT port and the Modem port being accurately identified; if the PID of the USB device is found neither in the Pid_Positive array nor in the Pid_NePositive array, considering the USB device as a positively ordered device by default, therefore the AT port and the Modem port being accurately identified. |