从USB Hub到充电器、个人电脑、家用电器和树莓派,通用串行总线 (USB) 的应用可谓无处不在,名副其实。但由于 USB 拥有十多种不同的版本、大量的接口以及各种传输速率和充电功能,因此它也是一套庞大的标准,如果您不清楚自己的需求,很容易感到困惑。
如果你查看一款顶级游戏笔记本电脑或游戏台式机的规格表,可能会看到它配备一个 USB 4 接口、一个 USB 3.2 Gen 2 接口和两个 USB 2 接口。但这些接口到底是什么意思?它们各自又能提供哪些功能?这里为你准备了答案,帮助你了解每种 USB 接口的功能。
USB 版本、版本名称和速度
如果您使用 USB 接口传输数据而非仅充电,那么最重要的是了解连接的最高速度。因为要以高达 10 Gbps 的速度将文件复制到外部 SSD,您需要确保连接链上的每个环节都支持该速度:主机、数据线和硬盘本身。
如果每个 USB 端口和产品都能在其上或至少在规格表上标明最高传输速度,那就太好了。事实上,USB-IF(USB 开发者论坛)——USB 标准的维护者——也希望如此。该组织最近推出了一种新的命名规则,将所有速度达到或超过 5 Gbps 的端口分别命名为 USB 5 Gbps、USB 10 Gbps、USB 20 Gbps 或 USB 40 Gbps,不再使用版本号。获得 USB-IF 认证的 USB 产品制造商可以获得带有 USB 传输速度标识的徽标,并将其用于产品包装上。
笔记本电脑上最新的 USB 4 端口支持 DisplayPort Alt Mode 2.0,最高可支持 8K 分辨率、60Hz 刷新率和 HDR10 色彩。虽然 USB 4 本身的数据传输速率只有 40Gbps,但由于 DisplayPort 只需单向传输数据,因此可以占用全部 8 条通道,从而实现 80Gbps 的数据传输速率。
你也可以通过 USB 3.x 甚至 2.0 Type-A 端口输出视频,虽然功能比较有限。尽管 Type-A 端口不支持 USB Alt Mode(USB 替代模式),但市面上有很多扩展坞和便携式显示器都采用了 DisplayLink 技术。安装正确的驱动程序后,你的电脑会将视频压缩并通过标准的 USB 信号发送到扩展坞。
USB 线缆和向下兼容性
USB 最棒的优点之一就是它的向下兼容性。你可以把一块全新的 20Gbps USB 固态硬盘插到 1999 年的 USB 1.1 接口上,它很可能也能正常工作。但是,任何连接的速度都取决于其中速度最慢的部分。所以,如果你把一块 40Gbps 的 USB 硬盘连接到电脑的 40Gbps USB 接口上,但你用的线缆只支持 5Gbps,那么你最终只能达到 5Gbps 的速度。
随着 2017 年 USB 3.2 的推出,我们看到了 10 Gbps 和 20 Gbps 两个速度级别,两者都具备双通道功能。正是在那时,USB-IF 决定将所有 3.x 规范统一归入 USB 3.2,因此 USB 3.2(不区分 Gen 或 Gen 1)的速度为 5 Gbps,USB 3.2 Gen 2 的速度为 10 Gbps,而 USB 3.2 Gen 2×2 的速度为 20 Gbps。之所以称为 Gen 2×2,是因为它使用了两条 10 Gbps 的通道。
;
; This is an example of how a Python Launcher .ini file is structured.
; If you want to use it, copy it to py.ini and make your changes there,
; after removing this header comment.
; This file will be removed on launcher uninstallation and overwritten
; when the launcher is installed or upgraded, so don't edit this file
; as your changes will be lost.
;
[defaults]
; Uncomment out the following line to have Python 3 be the default.
python=3.8
[commands]
; Put in any customised commands you want here, in the format
; that's shown in the example line. You only need quotes around the
; executable if the path has spaces in it.
;
; You can then use e.g. #!myprog as your shebang line in scripts, and
; the launcher would invoke e.g.
;
; "c:\Program Files\MyCustom.exe" -a -b -c myscript.py
;
;myprog="c:\Program Files\MyCustom.exe" -a -b -c
for (UINTN i=0;i<1000;i++) {
UINTN x;
Print(L"%x\n",x++);
}
为了验证这个,编写一个完整的 UEFI 代码进行测试:
#include <Uefi.h>
#include <Library/UefiLib.h>
#include <Library/ShellCEntryLib.h>
/***
Print a welcoming message.
Establishes the main structure of the application.
@retval 0 The application exited normally.
@retval Other An error occurred.
***/
INTN
EFIAPI
ShellAppMain (
IN UINTN Argc,
IN CHAR16 **Argv
)
{
for (UINTN i=0;i<1000;i++) {
UINTN x;
Print(L"%x\n",x++);
}
return(0);
}