軟體模擬 FIDO2 裝置

看到「Virtual FIDO」這個專案,用軟體模擬 FIDO2 裝置:

Virtual FIDO is a virtual USB device that implements the FIDO2/U2F protocol (like a YubiKey) to support 2FA and WebAuthN.

就安全性來說有點本末倒置,畢竟硬體確保了 secret 無法被軟體直接搬走,而這個軟體模擬的方式就沒辦法了,這個專案比較像是實驗示範性質...

翻了一下 Hacker News 上也有人提到這個問題:「Show HN: A virtual Yubikey device for 2FA/WebAuthN (github.com/bulwarkid)」,但也有提到「tpm-fido」這個專案,用 TPM 來保護:

tpm-fido is FIDO token implementation for Linux that protects the token keys by using your system's TPM. tpm-fido uses Linux's uhid facility to emulate a USB HID device so that it is properly detected by browsers.

這個至少有一點保護,但還是不像實體的 YubiKey 那樣會需要碰一下才認證。

歐盟 2024 年年底強制使用 USB-C 充電頭 (終於,iPhone...)

Hacker News Daily 上看到「EU Passes Law to Switch iPhone to USB-C by End of 2024」,裡面指到了歐盟的新聞稿:「Long-awaited common charger for mobile devices will be a reality in 2024」。

2024 年年底 (所以是 2025 年) 將強制手機與平板都使用 USB-C 充電頭,2026 年則是延伸涵蓋到筆電:

By the end of 2024, all mobile phones, tablets and cameras sold in the EU will have to be equipped with a USB Type-C charging port. From spring 2026, the obligation will extend to laptops.

終於定案公告了,之前傳言好久了...

用 USB 供電的 CR2032/CR2016

在「USB board emulates CR2032 or CR2016 coin cell battery」這邊看到的有趣東西,用 USB 供 5V 電進來,然後轉成 3V 透過 CR2032 或是 CR2016 的鈕扣電池形式提供電源:

看說明是可以拿來開發測試用:

You can now develop CR2032 or CR2016 powered devices without having to use an actual coin cell thanks to Peter Misenko’s (Bobricius) “coin cell battery emulator CR2016/CR2032”.

看起來只要旁邊的延伸段不要卡住就可以這樣玩,不過一般開發測試板應該是有 pin 腳可以灌 3V 進去啦,算是蠻有趣的東西就是了...

USB Type-C 要增加 240W 的規格...

在「USB Type-C Specification 2.1 allows up to 240W Extended Power Range (EPR)」這邊看到這個規格:

Extended Power Range cables have additional requirements to assure that these cables can deliver the full defined voltage and current range for USB PD EPR operation. EPR cables shall functionally support a reported 50 V and 5 A o peration. The minimum functional voltage that a cable shall support is 53.65 V. The electrical components potentially in the path of V BUS in an EPR cable, e.g. bypass capacitors, should be minimally rated for 63 V.

All EPR cables shall be Electronically Marked and include EPR-specific information in the eMarker as defined by the USB PD specification. As defined in the USB PD specification, EPR cables are marked as 50 V and 5 A capable. All EPR cables shall be visibly identified with EPR cable identification icons as defined by the USB-IF. This is required so that end users will be able to confirm visually that the cable supports up to as high of PDP = 240W as defined in the USB PD specification.

也是基於 E-Marker 晶片的關係,除了充電頭支援外,線本身也得支援。這解決了目前很多家桌機都自己搞 >100W 的 dock 來支援高瓦數的充電,推出一個標準來涵蓋收斂...

會不會搞到以後連桌機都可以用 USB-C 界面供電啊...

PinePower 120W 充電器

在「PinePower 120W desktop power supply features display, USB PD, QC 3.0 and wireless charging」這邊看到 PinePower 120W 這個充電器:

提供了一個 Type-A QC 3.0 (18W) + 三個 Type-A 5V/3A (15W) + 一個 Type-C PD (65W),然後還有一個 Qi (10W),算了一下這些組合全部都跑滿要 138W,然後機器的上限提供 120W,這個集縮比超低,看起來也是頗猛的...

目前 out of stock,剛好可以等其他用過的人的評價...

USB 充電器的充電速度

前陣子因為好玩買了 ZY1280P,主要是可以看充電時使用的 Protocol:

其中 D+ 與 D- 資訊可以拿來判斷現在在跑的 Protocol,網路上有不少資料可以看,就會發現各家廠商在早期出了超多的快充協定。

拿到後把家裡各種可以輸出 USB 電源的東西都測了一輪,才發現有超多東西跟預想的不一樣。

首先是 HA2-50U5Q 這顆 USB 充電器:

最左邊兩個 Port 接上去只顯示了 DCP 5V1.5A + SAMSUNG 2A,接 iPad mini 上去也的確只有 1A 左右的電流。而再往右的兩個 Port 接上去就會顯示 DCP 5V1.5A + APPLE 2.4A,這時候 iPad mini 可以吃到接近 12W 左右,另外 QC 2.0 的 Port 也能提供 APPLE 2.4A

我之前把 Lightning 的線接在最左邊,難怪充電速度不怎麼樣...

另外一個是行動電源「ASUS行動電源ZenPower 10000mAh(QC3.0)-ABTU018(藍)」:

這台也有類似的情況,QC 3.0 的 Port 可以推 DCP 5V1.5A + APPLE 2.4A 出來,但是另外一個 Port 只能給 DCP 5V1.5A + SAMSUNG 2A,然後我平常也是把 Lightning 的線接在黑色的那條上面...

不過 ZY1280P 這台的 USB Type C 有遇到狀況:有些直接接 Macbook Air 可以充電,但過了 ZY1280P 就不能充 (這邊應該是走 USB PD),另外在測 Nokia 5.3 也有類似情況 (這台沒有支援 USB PD),這邊的問題年假期間研究一下,看看有什麼設定要設...

在 Hacker News 上看到 Raspberry Pi 400 使用心得

Hacker News 看到 Raspberry Pi 400 的使用心得:「I've now played with a Raspberry Pi 400 for a week and here are my conclusions」,先前在「Raspberry Pi 400」這邊有提到 Raspberry Pi 400,主要就是一台 Raspberry Pi 4 Model B 的主機,但跟鍵盤整合在一起。

在文章裡提到了 Raspberry Pi 4 可以 USB Boot 後帶來的改變 (參考之前寫的「Raspberry Pi 4 可以透過 USB 開機了」這篇),主要是透過 USB3 外接硬碟可以讓讀寫速度大幅提昇 (尤其是 SSD),這一直都是 Raspberry Pi 上面用 SD card 的問題,看起來唯一的問題還是 CPU 的速度還是沒有像目前常見的 x86-64 強。

If you give it fast enough "disk" storage it really moves. I plugged in a Kingston brand 120GB SSD on a USB3 adapter. hdparm -t gave 292MB/s read speed and the default LXDE environment was really crisply responsive, with even a first launch of Chromium taking less than two seconds. With such good storage, the only real limitation is that heavy Javascript stuff is too slow - 5+ seconds to switch between folders in Chrome, or for the thumbnail gallery to appear in Youtube. Also, video calling is marginal. Aside from that the CPU is fast enough.

另外討論裡面也有人希望 Raspberry Pi 考慮引入 eMMC 或是提供 M.2 界面改善讀寫速度,不過我覺得 SD card 的設計算是 Raspberry Pi 當初的方向,本來就有取捨,不太可能什麼都做進去...

回到作者的心得,雖然 USB3 轉 SSD 看起來 i/o 速度快不少,但我好像主要不是遇到 i/o 速度問題,反倒是最近 chromium 的硬體解碼好像有些進度,也許看影片有機會用硬體處理 (至少一部份?),希望至少可以輕鬆看 1080p60 啊...

Raspberry Pi 4 可以透過 USB 開機了

一樣是在 Hacker News Daily 上看到這篇:「Boot from USB · Issue #28 · raspberrypi/rpi-eeprom」,不過 GitHub 上的討論沒什麼重點,主要是 Hacker News 上的討論:「Raspberry Pi 4 can finally boot directly from USB (github.com)」。

這個功能在以前的 Raspberry Pi 上是可以用的,但大概是因為 RPi4 的 USB 模組整個換掉,所以在 RPi4 推出時是沒這個功能的,直到最近更新韌體才支援。

不過就算以前可以用 USB 2.0 開機,但因為 USB 2.0 的極限值只有 480Mbps,扣掉 USB mass storage 的 protocol overhead 後,跟 SD 卡相比沒有差太多速度,大家就沒有太在意這個項目。但現在 USB 3.0 的速度快不少,讓這邊有不少發揮的空間,之後來找機會來外接個硬碟測一些東西看看好了...

然後順便提一下,以前要弄這種東西都是同事之間一起團購,但後來發現 PChome 24h 上也有賣,而且價位也算是還算可以?(加上又是隔天到?)

用 Raspberry Pi 4 與 HDMI-to-USB 組出 KVM over IP 裝置

一樣是在 Hacker News Daily 上看到的專案,弄出便宜的 KVM over IP 裝置:「TinyPilot: Build a KVM Over IP for Under $100」。

主要是他在 Twitter 看到了這則,裡面提到了「Video Capture Cards, HDMI to USB 2.0, High Definition 1080p 30fps, Video Record via DSLR,Camcorder, Action Cam for Live Broadcasting, Live Streaming, Gaming, Teaching, Video Conference」這個產品:

而作者在 eBay 上面也找到了一樣的裝置,但是更便宜 (所以是「親,$11 包郵」?XDDD):

接下來是在接觸 pikvm 的時候發現了 µStreamer 這個專案:

µStreamer is a lightweight and very quick server to stream MJPG video from any V4L2 device to the net.

最後則是發現他使用的 HDMI-to-USB 裝置直接就是輸出 MJPG 格式,連 transcoding 都不用做了,大幅把 latency 降到 200ms:

其實從作者的文章可以知道,你想做的事情說不定在地球上已經有其他人做差不多了,重點是要找出來,而不需要自己硬幹 XD

AMD 平台的前面板與 USB...

Telegram 上看到這篇在講在 AMD 平台上遇到 USB 相容性的問題:

看了敘述與裡面連結提到的「Xperia XA2: Stuck on “Sending 'boot.img'”」與「Fastboot is getting stuck while trying to flash CWM onto Nexus 4」後,我就馬上想到我在換成 AMD 的平台後,遇到了一個感覺好像應該是有關的問題...

我遇到的問題是 YubiKey 在主機的前面板的四個 USB 接口都不會動 (抓的到,但是 browser 需要認證時 YubiKey 不會閃爍請使用者確認),而接到 USB 2.0 Hub 上面也不會動 (這邊的 Hub 是接到後面 USB 3.0 的孔),只有直接接到後面板的 USB 3.0 會動,所以我後來就買了一條 USB 3.0 的延長線,從後面的 USB 3.0 孔拉到桌上用...

昨天看到文章,為了確認這個情況,就到 PChome 24h 上找了一顆 USB 3.0 Hub,今天收到後接上 PC 測試,發現 YubiKey 就順利在登入時閃爍了,看起來之後在 AMD 平台上接 USB 的時候要注意一下,有狀況的時候要多測幾種不同的接法...