This project demonstrates a workaround for Firefox's lack of WebUSB support by leveraging its native messaging capabilities. A small native application acts as a bridge, receiving commands from a web page via native messaging and interacting directly with USB devices. The web page communicates with this intermediary application using a custom, WebUSB-like JavaScript API, effectively emulating WebUSB functionality within Firefox. This allows web developers to write code that interacts with USB devices in a consistent manner across browsers, handling the Firefox difference behind the scenes.
This post details how to access the Qualcomm Quectel BG96 modem embedded within the RAK5010 WisBlock Core module via USB. The BG96 exposes multiple serial ports over USB, but only one is typically configured for user interaction. The post explains how to use minicom
to interact with the modem on its default port and outlines the process of switching to other ports, specifically the diagnostic port, using AT commands. This access allows for deeper interaction with the modem, enabling activities like firmware updates and more granular control, which are not possible through the default port. The author emphasizes the importance of switching back to the default port after completing tasks on the diagnostic port to restore normal functionality.
Several commenters on Hacker News discussed practical aspects of using the RAK5010 and similar devices. Some questioned the practicality of USB tethering for IoT applications, citing power consumption concerns and suggesting alternative solutions like direct TCP/IP connections over cellular. Others shared personal experiences and insights, including one commenter who detailed their success using the RAK7200 with a Quectel modem and another who noted the complexities and lack of clear documentation around AT command interactions for specific modem features. A few comments also touched upon the security implications of exposing the modem via USB, particularly in commercial deployments. The overall sentiment reflected interest in the technical details but also a pragmatic awareness of the challenges involved in this approach.
Summary of Comments ( 98 )
https://news.ycombinator.com/item?id=43360642
Hacker News commenters generally expressed frustration with Firefox's lack of WebUSB support, echoing the author's sentiments. Some pointed out that the Mozilla Developer Network (MDN) documentation misleadingly suggests WebUSB is supported, while others shared workarounds and alternative solutions, including using Chrome or a native messaging host. A few commenters questioned the security implications of granting websites access to USB devices, highlighting potential vulnerabilities. The complexity of adding WebUSB support in Firefox was also discussed, citing issues like sandboxing and driver interaction as potential roadblocks. One commenter offered a personal anecdote about the challenges of debugging WebUSB issues due to inconsistent browser implementations.
The Hacker News post "I-cant-believe-its-not-webusb: Hacking around lack of WebUSB support in Firefox" has generated a moderate discussion with several insightful comments focusing on the workaround presented, the complexities of WebUSB implementation, and potential security concerns.
One commenter points out the inherent irony and difficulty of making this kind of workaround secure. They highlight the potential for abuse if a malicious webpage could hijack the native messaging host, essentially defeating the purpose of the security sandbox. This comment raises a critical issue with the approach, suggesting that despite the cleverness, the security implications might outweigh the benefits.
Another user discusses the intricacies of WebUSB support and speculates on the reasons behind Firefox's decision not to fully implement it. They mention that WebUSB requires significant effort to implement securely and maintain, possibly posing challenges for browser vendors. They also touch upon the limitations of the workaround, particularly regarding access to isochronous endpoints which are crucial for certain USB devices like audio interfaces. This comment offers valuable context for understanding the technical hurdles involved in WebUSB implementation.
A different comment highlights the lack of detailed error messages in WebUSB, making debugging difficult for developers. This practical observation emphasizes the challenges faced by those working with WebUSB and hoping to integrate it into their applications.
One commenter also explores alternative approaches for cross-browser USB device access. They suggest WebHID and Web Serial as potentially viable options depending on the specific use case, offering practical alternatives to WebUSB.
Finally, a participant expresses their support for projects like this that attempt to bridge the gap in functionality between different browsers. They acknowledge the inherent challenges in maintaining such workarounds but appreciate the effort to provide a more unified experience for web developers.
In summary, the discussion revolves around the practicality, security implications, and technical challenges associated with the proposed WebUSB workaround. Commenters acknowledge the cleverness of the approach while also raising important concerns about its long-term viability and security. They offer alternative solutions and insights into the complexities of WebUSB implementation, providing a balanced perspective on the topic.