USB 端口是什么样的端口?

发布于 2024-12-15 08:13:56 字数 239 浏览 6 评论 0原文

我正在开发一个串口通信java-J2ME-J2SE应用程序。有一部手机和一台电脑(运行Windows XP)。这两台机器通过手机的电缆进行通信。手机的数据线是USB数据线。那么端口的类型是什么:是 COM1 还是其他端口? 我查看设备管理器,发现手机(阿尔卡特 OT-806D)位于 COM4 端口。这是设备管理器捕获的图像:

在此处输入图像描述

I am developing a serial port communication java-J2ME-J2SE application. There is a mobile phone and a computer ( running Windows XP ). These two machines are communicating through the phone mobile's cable. And the phone mobile's cable is a USB cable. So what is the type of the port : is it COM1 or something else ?
I looked the device manager and I found that the mobile phone ( Alcatel OT-806D ) is in port COM4. Here is a captured image of the device manager:

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

晚雾 2024-12-22 08:13:56

USB 端口是一种串行端口,计算机和设备可以使用它进行通信。它定义了连接器和电缆,以及设备必须用来通过 USB 进行通信的物理层和链路层协议。从这个意义上说,它类似于以太网、火线或其他通信协议。

在物理层面上,USB 是一种串行协议,这意味着位以串行方式发送。旧的串行 RS-232 端口(在 Windows 下传统上称为 COMx)与现代 USB 架构无关。旧的串行端口使用更简单且速度较慢的通信协议 (RS-232),通常由名为 UART,而 USB 通信需要更复杂的硬件。

因此,这两种协议的物理和链路层特性非常不同。虽然两者都是串行协议,但 USB 允许多个设备共享同一总线(传统串行端口不允许),并且 USB 的通信速度要高得多。 USB 可以更好地处理错误检测和纠正、流量控制和其他数据传输问题。

COM 端口是 Windows 抽象,代表任何通信端口。在其他操作系统中使用其他名称。在 Linux 中,COM1 端口由设备 /dev/ttyS0 表示。

请注意,这只是一个抽象。可以(并且经常这样做)使用不使用传统物理串行端口的串行端口。事实上,您可以创建提供串行端口的操作系统驱动程序,这些端口实际上通过以太网、USB、IP 或任何其他通信层进行通信。操作系统级别的 COM 端口只不过是表示通信端口的抽象。

移动电话通过 USB 端口提供多种服务。这通常包括原始串行通信(您可以在应用程序中使用),但在许多其他情况下,USB 端口提供其他“配置文件”(USB 海量存储、耳机或其他)。所有这些配置文件都是标准化的,因此您可以将手机插入计算机并建立“串行通信”通道等,而无需为计算机或手机编写通信驱动程序。

所以,回答你的问题,不,USB 端口不是 COM 端口。它是一个 USB 端口。您可以将其用于串行通信,但也可以将其用于其他用途。

An USB port is a kind of serial port that computers and devices can use to communicate. It defines the connectors and cables, as well as the physical and link layer protocols that devices must use to communicate over USB. In this sense, it's similar to Ethernet, Firewire or other communication protocols.

At a physical level, USB is a serial protocol, meaning that bits are sent in a serial fashion. Old serial RS-232 ports (traditionally named COMx under Windows) are not related to modern USB architecture. Old serial ports used a simpler and slower communication protocol (RS-232) that was usually handled by a family of chips called UARTs, whereas USB communication requires more complex hardware.

So, the physical and link-layer characteristics of these two protocols are very different. While both are serial protocols, USB allows for several devices to share the same bus (traditional serial ports don't) and communication speed is much higher in USB. Error detection and correction, flow control and other data transfer concerns are better handled in USB.

COM ports are a Windows abstraction to represent any communication port. In other operating systems other names are used. In Linux, the COM1 port is represented by the device /dev/ttyS0.

Note that this is no more than an abstraction. It is possible (and often done) to use serial ports that are not using the traditional, physical, serial port. In fact, you can create operating system drivers that provide serial ports that are in fact communicating over Ethernet, USB, IP or any other communication layer. The COM port at operating system level is no more than an abstraction to represent a communications port.

Mobile phones offer a variety of services through their USB port. This often includes raw serial communication (which you can use in your application), but in many other cases the USB port provides other "profiles" (usb mass storage, headphones, or whatever). All those profiles are standarized so you can plug your phone to a computer and establish a "serial communication" channel, among other things, without having to code communication drivers for the computer or the phone.

So, to answer your question, no, an USB port is not a COM port. It is an USB port. You can use it for serial communications, but you can also use it for other things.

阳光下的泡沫是彩色的 2024-12-22 08:13:56

USB 表示通用串行总线。一般来说,PC 上的所有操作系统 USB 连接都将链接在同一总线上。连接到总线的所有设备都分配有虚拟端口号。这些端口号将根据连接到总线的内容而变化。

但是,您不会直接与手机通信,而是与为其安装的任何驱动程序通信,除非您正在编写驱动程序本身。

有些电话无法以任何方式控制,其他电话可能会显示为调制解调器,因为这是其制造商通过驱动器分配给它们的功能。

我当前的手机本身作为一个设备安装(与制造商的软件一起使用)、调制解调器和存储设备。

请查看此处了解更多信息。

USB means Universal Serial Bus. Generally all os the USB connections on PC will be linked on the same bus. All devices connected to the bus are assigned virtual port numbers. These port numbers will change depending on what is connected to the bus.

However, you won't be communicating with the phone directly but with any driver that is installed for it, unless you're writing the driver itself.

Some phones are not controllable in any way, others may appear as a modem, because that is the functionality that their manufacturer has assigned them through the drive.

My current phone installs as a device in itself (for use with a manufacturers piece of software), a modem and a storage device.

Have a look here for some more information.

凉城凉梦凉人心 2024-12-22 08:13:56

嗯,取决于你所说的“端口类型”是什么意思。我想您想知道端口的名称,但您真正需要知道的是您的手机能够理解什么协议。

您需要知道手机可以通过 USB 进行通信的协议(如果有)。仅仅因为您可以将手机连接到 USB 电缆,并不意味着您可以控制手机。这取决于手机。并非所有手机都能够理解相同的协议。

此外,USB 是一种串行总线,因为它在单条线路上串行传输数据(而不是在多条线路上并行传输),但它(不一定)使用与计算机串行端口相同的 RS-232 协议。如果您有一个连接到 USB 端口的 RS-232 设备,那么您将使用 COM1(或 COM2 或 COM3,您的操作系统分配此端口名称)连接到它。

um, depends what you mean by "type of port". I think you want to know the name of the port, but what you really need to know is what protocol your phone will understand.

You need to know what protocol (if any) the phone can communicate with over USB. Just because you can connect the phone to a USB cable doesn't mean that you can control the phone. This depends on the phone. Not all phones are built to understand the same protocols.

Also, USB is a serial bus because it transmits data serially on a single line (as opposed to transmitting in parallel over multiple lines), but it doesn't (necessarily) use the same RS-232 protocol as a computer's serial port. If you had a RS-232 device connected to a USB port, then you would connect to it using COM1 (or COM2 or COM3, your operating system assigns this port name).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文