Quectel_LTE&5G_USB_Driver_V2.1.zip
char syspath[255]; char sysport[64]; int count; char *pchar = NULL; int fd = 0; memset(idVendor, 0x00, 5); memset(idProduct, 0x00, 5); memset(bNumInterfaces, 0x00, 5); snprintf(sysport, sizeof(sysport), "/sys/class/tty/%s", &ttyport[strlen("/dev/")]); count = readlink(sysport, syspath, sizeof(syspath) - 1); if (count < strlen(":1.0/tty")) return; //ttyUSB0 -> ../../devices/soc0/soc/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb1/1-1/1-1:1.0/ttyUSB0/tty/ttyUSB0 pchar = strstr(syspath, ":1.0/tty"); //MDM if (pchar == NULL) { pchar = strstr(syspath, ":1.2/tty"); //ASR g_is_asr_chip = (pchar != NULL); } if (pchar == NULL) { qlog_dbg("%s is not a usb-to-serial device?\n", ttyport); return; } *pchar = '\0'; while (*pchar != '/') pchar--; strcpy(sysport, pchar + 1); snprintf(syspath, sizeof(syspath), "/sys/bus/usb/devices/%s/idVendor", sysport); fd = open(syspath, O_RDONLY); if (fd <= 0) { qlog_dbg("Fail to open %s, errno: %d (%s)\n", syspath, errno, strerror(errno)); return; } read(fd, idVendor, 4); close(fd);
- 1
- 粉丝: 26
- 资源: 33
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助