上传到开发板:
adb push "\\Oct1158-ubuntu\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\output\GobiNet.ko" /root
adb push "\\Oct1158-ubuntu\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\output\option.ko" /root
adb push "\\Oct1158-ubuntu\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\output\qcserial.ko" /root
adb push "\\Oct1158-ubuntu\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\output\usb_wwan.ko" /root
adb push "\\Oct1158-ubuntu\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\output\qmi_wwan_q.ko" /root
adb push "\\Oct1158-ubuntu\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\output\quectel-CM" /root
adb push "\\Oct1158-ubuntu\oct1158\Documents\Code\C\Quectel_LTE5G_Linux_USB_Driver_V1.0-5\output\quectel-qmi-proxy" /root
adb shell chmod +x /root/quectel-CM
adb shell chmod +x /root/quectel-qmi-proxy
在开发板上插入:
insmod GobiNet.ko
insmod usb_wwan.ko
insmod option.ko
insmod qcserial.ko
insmod qmi_wwan_q.ko
root@rk3308b-buildroot:/root# insmod usb_wwan.ko
root@rk3308b-buildroot:/root# insmod option.ko
[ 24.218428] usbcore: registered new interface driver option
[ 24.218719] usbserial: USB Serial support registered for GSM modem (1-port)
[ 24.219303] option 2-1:1.2: GSM modem (1-port) converter detected
[ 24.220742] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB0
[ 24.221346] option 2-1:1.3: GSM modem (1-port) converter detected
[ 24.223177] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB1
root@rk3308b-buildroot:/root# ls -l /dev/ttyUSB*
crw-rw---- 1 root dialout 188, 0 Jan 1 00:00 /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 1 Jan 1 00:00 /dev/ttyUSB1
root@rk3308b-buildroot:/root#
【串口AT指令测试程序】
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
void send_atcmd(int fd, const char *cmd)
{
char resp[100];
int ret;
printf("Command: %s\n", cmd);
write(fd, cmd, strlen(cmd));
write(fd, "\r\n", 2);
ret = read(fd, resp, sizeof(resp) - 1);
resp[ret] = '\0';
if (ret >= 1 && resp[ret - 1] == '\n')
resp[ret - 1] = '\0';
printf("Response: %s (size=%d)\n", resp, ret);
}
int main()
{
int fd;
fd = open("/dev/ttyUSB1", O_RDWR);
if (fd == -1)
{
perror("open() failed");
return -1;
}
send_atcmd(fd, "AT");
close(fd);
return 0;
}
【程序运行结果】
root@rk3308b-buildroot:/root# ./atcmd_test
Command: AT
Response: AT (size=3)
root@rk3308b-buildroot:/root#