如何找到可用于通过USB与qcom调制解调器通话的正确端口?

问题描述

我有一个植根设备连接到我的Ubuntu 16计算机。我已使用密码#0808#

从设备启用了其DM端口

在Windows上,我可以在设备管理器中看到一个COM端口,但是在Linux上,我找不到正确的端口。

我尝试检查启用DM端口时出现的新/ dev / android4,但尝试打开它时似乎不是正确的端口。我收到以下错误消息:

tcgetattr出现错误:设备的ioctl不适当

这是我打开此端口的代码:

int set_interface_attribs(int fd,int speed)
{
    struct termios tty;
//    memset(&tty,sizeof(tty));

    if (tcgetattr(fd,&tty) < 0)
    {
        printf("Error from tcgetattr: %s\n",strerror(errno));
        return FAILURE;
    }

    cfsetospeed(&tty,(speed_t)speed);
    cfsetispeed(&tty,(speed_t)speed);

    tty.c_cflag |= (CLOCAL | CREAD); /* ignore modem controls */
    tty.c_cflag &= ~CSIZE;
    tty.c_cflag |= CS8;      /* 8-bit characters */
    tty.c_cflag &= ~PARENB;  /* no parity bit */
    tty.c_cflag &= ~CSTOPB;  /* only need 1 stop bit */
    tty.c_cflag &= ~CRTSCTS; /* no hardware flowcontrol */

    /* setup for non-canonical mode */
    tty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON);
    tty.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
    tty.c_oflag &= ~OPOST;

    /* fetch bytes as they become available */
    tty.c_cc[VMIN] = 1;
    tty.c_cc[VTIME] = 1;

    if (tcsetattr(fd,TCSANOW,&tty) != 0)
    {
        printf("Error from tcsetattr: %s\n",strerror(errno));
        return FAILURE;
    }
    return SUCCESS;
}

jint initDiag(char* comPort)
{
    int ret;
        
    debug("initDiag %s \n",comPort);

    if (signal(SIGPIPE,sigpipeHandler) == SIG_ERR)
    {
        debugWarning(" cannot capture SIGPIPE\n");
    }
         
    // open /dev/android4
    hSerial = open(comPort,O_RDWR | O_NONBLOCK);
    if (hSerial < 0)
    {
        debugError("open %s \n",comPort);
        return FAILURE;
    }
     
    /*baudrate 115200,8 bits,no parity,1 stop bit */
    if(set_interface_attribs(hSerial,B115200) == FAILURE) {
        debugError("Failed to set attributes.\n");
        return FAILURE;
    }
    
    return hSerial;
}

任何帮助,我该怎么办?

更新 ls / dev /

$ ls /dev/
acpi_thermal_rel  fb0        i2c-16    loop13  loop-control        ppp       stdin   tty21  tty39  tty56      ttyS14  ttyS31   vcsa
android4          fd         i2c-2     loop14  mapper              psaux     stdout  tty22  tty4   tty57      ttyS15  ttyS4    vcsa1
autofs            freefall   i2c-3     loop15  mcelog              ptmx      tpm0    tty23  tty40  tty58      ttyS16  ttyS5    vcsa2
block             full       i2c-4     loop16  media0              pts       tpmrm0  tty24  tty41  tty59      ttyS17  ttyS6    vcsa3
bsg               fuse       i2c-5     loop17  mei0                random    tty     tty25  tty42  tty6       ttyS18  ttyS7    vcsa4
btrfs-control     hidraw0    i2c-6     loop18  mem                 rfkill    tty0    tty26  tty43  tty60      ttyS19  ttyS8    vcsa5
bus               hidraw1    i2c-7     loop19  memory_bandwidth    rtc       tty1    tty27  tty44  tty61      ttyS2   ttyS9    vcsa6
char              hidraw2    i2c-8     loop2   mqueue              rtc0      tty10   tty28  tty45  tty62      ttyS20  uhid     vfio
console           hpet       i2c-9     loop20  net                 sda       tty11   tty29  tty46  tty63      ttyS21  uinput   vga_arbiter
core              hugepages  initctl   loop21  network_latency     sda1      tty12   tty3   tty47  tty7       ttyS22  urandom  vhci
cpu               hwrng      input     loop22  network_throughput  sda2      tty13   tty30  tty48  tty8       ttyS23  userio   vhost-net
cpu_dma_latency   i2c-0      kmsg      loop23  null                sda3      tty14   tty31  tty49  tty9       ttyS24  v4l      vhost-vsock
cuse              i2c-1      lightnvm  loop3   nvme0               sda4      tty15   tty32  tty5   ttyprintk  ttyS25  vcs      video0
disk              i2c-10     log       loop4   nvme0n1             sda5      tty16   tty33  tty50  ttyS0      ttyS26  vcs1     zero
dri               i2c-11     loop0     loop5   nvme0n1p1           sg0       tty17   tty34  tty51  ttyS1      ttyS27  vcs2
drm_dp_aux0       i2c-12     loop1     loop6   nvme0n1p2           shm       tty18   tty35  tty52  ttyS10     ttyS28  vcs3
drm_dp_aux1       i2c-13     loop10    loop7   nvme0n1p3           snapshot  tty19   tty36  tty53  ttyS11     ttyS29  vcs4
drm_dp_aux2       i2c-14     loop11    loop8   nvme0n1p4           snd       tty2    tty37  tty54  ttyS12     ttyS3   vcs5
ecryptfs          i2c-15     loop12    loop9   port                stderr    tty20   tty38  tty55  ttyS13     ttyS30  vcs6

解决方法

一般而言;

Bus 001 Device 013: ID 05c6:676c Qualcomm,Inc.

“总线”编号表示计算机内部的硬件I / O集线器。

“设备”编号引用连接到该内部I / O集线器的多个外部I / O设备

简单起见:

sudo apt install hardinfo

然后阅读how to identify a device

然后设置{@ 3}}来设置用于I / O访问的外部设备,它正在讨论外部硬盘驱动器,但是基本步骤是相同的​​。

然后阅读:how to mount an external device

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...