- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我知道 Raspberry Pi Zero 支持 OTG 和 USB 外设协议(protocol),这里显示了很多很酷的内置外设:https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget?view=all#other-modules
问题是我需要模拟未出现在此列表中的 USB 外围设备。我有设备的供应商 ID 和产品 ID,我正试图弄清楚如何才能做到这一点。我是否需要修改 Raspbian 内核中的 OTG USB 驱动程序?我必须完全构建自己的内核吗?还是有我什至没有意识到的更好的选择?
提前致谢!
最佳答案
Do I need to modify the OTG USB drivers in the Raspbian kernel?
第一个问题的答案是“视情况而定”,但如果您的设备没有做任何太不寻常的事情这可能是一个否:你不需要修改内核模块或内核的源代码。
您很幸运,Raspbian 支持具有 ConfigFS 支持的现代内核。使用 dtoverlay=dwc2
进行设置后,您可以像这样以 root 身份打开 FunctionFS 批量端点:
modprobe libcomposite
modprobe usb_f_fs
cd /sys/kernel/config/usb_gadget
mkdir -p myperipheral; cd myperipheral
echo 0x1234 > idVendor # put actual vendor ID here
echo 0xabcd > idProduct # put actual product ID here
mkdir configs/c.1
mkdir configs/c.1/strings/0x409
echo "My Peripheral" > configs/c.1/strings/0x409/configuration
mkdir functions/ffs.my_func_name
ln -s functions/ffs.my_func_name configs/c.1/
mkdir -p /tmp/mount_point
mount my_func_name -t functionfs /tmp/mount_point
# compile ffs-test from source, then copy and run it from /tmp/mount_point
ls /sys/class/udc > UDC
如果您需要更紧密地模拟其他设备,则由您设置bcdDevice
、bcdUSB
、序列号、制造商、产品字符串、最大功率、os_desc
,可能还有其他字段。
AFAIK FunctionFS 不支持等时端点、中断传输或异常控制传输。如果您需要这个,您可能需要开始研究使用源代码扩展现有的小工具模块 here .
更新:当我回家测试这个时,我遇到了 Raspbian 的严重警告。它最初无法创建 ffs.my_func_name
,因为默认情况下未启用 usb_f_fs。尽管您不需要修改任何内核模块,但您必须 recompile具有备用配置。 make menuconfig
-> Device Drivers -> USB support -> USB Gadget Support -> USB functions configurable through configfs/Function filesystem (FunctionFS) + 一些其他模块来测试。上传新的内核/模块后,我在 Raspbian 8 上测试了上述脚本。我还建议将 USB Gadget Drivers/Function Filesystem 设置为 (M),以防您求助于更简单的 g_ffs
遗留模块代替 ConfigFS。
关于linux - Raspberry Pi 零 USB 设备仿真,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39375475/
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我正在使用带有Grove Pi +(1.2.2固件)的Raspberry Pi 3 B模型和用于Robots Image的Raspbian。 我在I2C-1端口中插入了多 channel 气体传感器,
这看起来非常简单,但我似乎无法弄清楚如何将 -Pi 和 Pi 之间的角度映射到 0 到 2Pi 的范围内。我尝试使用 np.select 但由于某种原因它卡住了我的程序。我需要这个范围内的角度,因为它
在使用 SciPy 和 NumPy 的项目中,我应该使用 scipy.pi , numpy.pi , 或 math.pi ? 最佳答案 >>> import math >>> import numpy
Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。 想改善这个问题吗?更新问题,以便将其作为on-topic
我有一个运行 Raspbian 的 Raspberry Pi 1。我尝试在 Raspberry Pi 3 上运行 SD 卡,但它没有启动。 我已经阅读了有关升级 Raspberry Pi 2 安装以在
#include using namespace std; #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #d
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
我目前正在尝试RadiusNetworks发布的Raspberry Pi iBeacon教程,网址为 http://developer.radiusnetworks.com/2013/10/09/ho
我无法在运行Raspbian的Raspberry Pi 3上安装我创建的 Electron 应用程序。我已经使用了electronic-packager来创建软件包,然后创建了一个debian安装程序
我想在Linux上为Raspberry Pi 1设置交叉编译环境。 特别是我想尝试最新版本,即Raspbian测试+ Qt5开发分支。 这个问题: How can I create a modern
我想要从我的 Raspberry Pi Zero 到手机的低延迟流式传输。据我了解,移动浏览器不支持 RTMP 流式传输,HLS 流式传输具有高延迟,而 webRTC 是我最好的选择。 有谁知道从零开
我的公司使用 Raspberry Pi 3 作为产品中的嵌入式 Controller 。用户不会优雅地关闭它,他们只是扳动一个开关。为避免损坏,/boot 和/root 文件系统是只读的。这似乎是防弹
如何使用 Raspberry Pi 作为 b/w USB Tethered 手机和路由器的桥接器,使用“以太网电缆 b/w Raspberry Pi 和路由器”和“USB 电缆 b/w 手机和 Ras
我正在尝试在Raspberry Pi 3上安装Rakudo Star 2018.04。 我做: sudo perl Configure.pl --gen-moar --gen-nqp --prefix
我正在寻找一些可以有效完成的不错的 C 代码: while (deltaPhase >= M_PI) deltaPhase -= M_TWOPI; while (deltaPhase T Mod(T
我正在尝试为 raspberry Pi 构建跨环境以在 Eclipse CDT for windows 上构建二进制文件。 我得到了用于访问 GPIO 的 Wiring Pi,我需要使用“Window
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 7年前关闭。 Improve thi
我正在寻找一些可以有效完成的不错的 C 代码: while (deltaPhase >= M_PI) deltaPhase -= M_TWOPI; while (deltaPhase T Mod(T
这个问题在这里已经有了答案: C: How to wrap a float to the interval [-pi, pi) (15 个答案) 关闭 9 年前。 我想知道是否可以定义一个只能取 -
我是一名优秀的程序员,十分优秀!