<i id='Bx8IH'><tr id='Bx8IH'><dt id='Bx8IH'><q id='Bx8IH'><span id='Bx8IH'><b id='Bx8IH'><form id='Bx8IH'><ins id='Bx8IH'></ins><ul id='Bx8IH'></ul><sub id='Bx8IH'></sub></form><legend id='Bx8IH'></legend><bdo id='Bx8IH'><pre id='Bx8IH'><center id='Bx8IH'></center></pre></bdo></b><th id='Bx8IH'></th></span></q></dt></tr></i><div id='Bx8IH'><tfoot id='Bx8IH'></tfoot><dl id='Bx8IH'><fieldset id='Bx8IH'></fieldset></dl></div>

          <bdo id='Bx8IH'></bdo><ul id='Bx8IH'></ul>
        <legend id='Bx8IH'><style id='Bx8IH'><dir id='Bx8IH'><q id='Bx8IH'></q></dir></style></legend>
      1. <tfoot id='Bx8IH'></tfoot>

        <small id='Bx8IH'></small><noframes id='Bx8IH'>

      2. 如何处理android手机中的串口?

        how to deal with the serial port in android mobile?(如何处理android手机中的串口?)

        <small id='X4ga3'></small><noframes id='X4ga3'>

        <legend id='X4ga3'><style id='X4ga3'><dir id='X4ga3'><q id='X4ga3'></q></dir></style></legend>
          <tbody id='X4ga3'></tbody>

          1. <i id='X4ga3'><tr id='X4ga3'><dt id='X4ga3'><q id='X4ga3'><span id='X4ga3'><b id='X4ga3'><form id='X4ga3'><ins id='X4ga3'></ins><ul id='X4ga3'></ul><sub id='X4ga3'></sub></form><legend id='X4ga3'></legend><bdo id='X4ga3'><pre id='X4ga3'><center id='X4ga3'></center></pre></bdo></b><th id='X4ga3'></th></span></q></dt></tr></i><div id='X4ga3'><tfoot id='X4ga3'></tfoot><dl id='X4ga3'><fieldset id='X4ga3'></fieldset></dl></div>
            <tfoot id='X4ga3'></tfoot>
              • <bdo id='X4ga3'></bdo><ul id='X4ga3'></ul>
                  本文介绍了如何处理android手机中的串口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  其实我对串口一无所知.但我看到了一个发送命令的例子:

                  actually I know no thing about serial port. but I see an example of sending it an at-command:

                  echo -e "AT" > /dev/smd0
                  

                  什么是/dev/smd0 以及为什么有时将其替换为/dev/ttyS0.

                  What is /dev/smd0 and why they sometimes replace it with /dev/ttyS0.

                  推荐答案

                  /dev/smd0/dev/ttyS0 是 设备文件.此类文件是 虚拟文件,它们提供文件 I/O 操作接口,用于处理一些底层事物,例如例如串口、硬盘和内存等硬件资源,或者进程信息、随机数输入、终端屏幕输出等非硬件资源.

                  /dev/smd0 and /dev/ttyS0 are device files. Such files are virtual files that provide a file I/O operation interface for working with some underlying thing like for instance hardware resources like serial ports, hard disks and memory, or with non-hardware resources like process information, random number input, terminal screen output, etc.

                  设备文件有两种风格,字符和块.串口是字符设备,你可以验证 cls -l 输出的第一个字符:

                  Device files comes in two flavours, character and block. Serial ports are character devices, you can verify with c being the first character in output from ls -l:

                  $ ls -l /dev/ttyS0
                  crw-rw----. 1 root dialout 4, 64 Apr  7 00:25 /dev/ttyS0
                  $
                  

                  <小时>

                  /dev/ttyS0 是 linux 桌面计算机上用于串口的设备名称,对应于 DOS/Windows 中的 COM1(在非常非常早期使用了 linux /dev/cua,你可能偶尔会遇到对它的引用).对于到手机的虚拟 USB 串行接口,使用 /dev/ttyACM0/dev/ttyACM1.其他一些设备使用/dev/ttyUSB0.对于 Android,使用了几个不同的设备文件名,其中 /dev/smd0 是其中之一.您的手机可能会使用另一部手机,因此您必须检查您应该专门为您的手机使用的手机.


                  /dev/ttyS0 is the device name used for serial ports on on linux desktop computers, corresponding to COM1 in DOS/Windows (in the very, very early days of linux /dev/cua was used, you might occasionally encounter references to that). For virtual USB serial interfaces to mobile phones /dev/ttyACM0 and /dev/ttyACM1 are used. Some other devices use /dev/ttyUSB0. For Android there are a few different device file names in use where /dev/smd0 is one of them. Your phone might use another one, so you have to check what you should use specifically for your phone.

                  命令echo -e "AT" >/dev/smd0 没有意义.-e 选项可以解释反斜杠转义字符,但由于以下字符串不包含此类字符,因此它仅等效于 echo "AT" >/dev/smd0.

                  The command echo -e "AT" > /dev/smd0 does not make sense. The -e option enables interpretation of backslash-escaped characters, but since the following string contains no such characters it is equivalent to just echo "AT" > /dev/smd0.

                  但是,当向调制解调器发送 AT 命令时,命令行应该仅以 结束,没有其他内容.这是由 V.250 规定的.

                  However, when sending AT commands to a modem, the command line should be terminated with only and nothing else. This is mandated by V.250.

                  因此向调制解调器发送命令AT"的正确命令应该是

                  So the proper command to send the command "AT" to the modem should be

                  echo -n -e "AT
                  " > /dev/smd0
                  

                  <小时>

                  但即使将 AT 命令正确发送到调制解调器,您也必须读回调制解调器的响应.在执行此操作时多次关闭和(重新)打开设备文件(您将通过运行一系列 shell 命令来完成)不是一个好方法,所以我建议您使用我的程序 atinout 专门写用于命令行 AT 命令通信:


                  But even when getting as far as sending the AT command correctly to the modem, you must read back the responses from the modem. Closing and (re-)opening the device file several times while doing this (which you will do by running a sequence of shell commands) is not a good way to go about, so I would recommend that you use my program atinout which is specifically written to be used for command line AT command communication:

                  $ echo AT | atinout - /dev/smd0 -
                  AT
                  OK
                  $
                  

                  $ echo AT > input.txt
                  $ atinout input.txt /dev/smd0 output.txt
                  $ cat output.txt
                  AT
                  OK
                  $
                  

                  这样您将正确执行所有调制解调器通信.

                  This way you will get all modem communication performed correctly.

                  这篇关于如何处理android手机中的串口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  script.sh: line 1: ./gradlew: No such file or directory on Jenkins(script.sh:第 1 行:./gradlew:Jenkins 上没有这样的文件或目录)
                  Arduino: using Serial and Software Serial with bluetooth module(Arduino:使用带有蓝牙模块的串口和软件串口)
                  Access native serial port on Android(在Android上访问本机串口)
                  Android: USB Communication Android lt;-gt; External Device(Android:USB通信Androidlt;-gt;外接设备)
                  Sending commands from a PC to an Android phone - via physical connection (USB, Serial, etc)(从 PC 向 Android 手机发送命令 - 通过物理连接(USB、串行等))
                  Android: RS232 Serial Communication with android device(Android:与安卓设备的RS232串行通信)
                      <legend id='b2RBN'><style id='b2RBN'><dir id='b2RBN'><q id='b2RBN'></q></dir></style></legend>

                      <small id='b2RBN'></small><noframes id='b2RBN'>

                    • <i id='b2RBN'><tr id='b2RBN'><dt id='b2RBN'><q id='b2RBN'><span id='b2RBN'><b id='b2RBN'><form id='b2RBN'><ins id='b2RBN'></ins><ul id='b2RBN'></ul><sub id='b2RBN'></sub></form><legend id='b2RBN'></legend><bdo id='b2RBN'><pre id='b2RBN'><center id='b2RBN'></center></pre></bdo></b><th id='b2RBN'></th></span></q></dt></tr></i><div id='b2RBN'><tfoot id='b2RBN'></tfoot><dl id='b2RBN'><fieldset id='b2RBN'></fieldset></dl></div>
                        <bdo id='b2RBN'></bdo><ul id='b2RBN'></ul>

                            <tbody id='b2RBN'></tbody>
                          1. <tfoot id='b2RBN'></tfoot>