这是一个小脚本,用于测量 Mac OS X 上 SD 卡(或 USB 记忆棒或其他磁盘)的速度。它非常原始,但易于使用和适应。
我试图找出是否有办法重命名设备,如游戏控制器屏幕中所示。
它们是廉价的 HID 设备,并且它们似乎都共享相同的硬件 ID(如果这是相关信息)VID_0E8F&PID_3013
我可以按照本指南在设备管理器中更改它们的名称:http://www.eightforums.com/customization/15321-tutorial-how-change-device-names-device-manager.html
但是,我一生都无法弄清楚如何更改上图中显示的名称。我计划在我的电脑上添加 8 个游戏控制器,当它们都共享相同的名称时,会变得非常混乱。
任何帮助是极大的赞赏。
我目前正在使用 Yocto 创建替代 BSP 来替换现有的 BSP。我是 Yocto 的新手,我需要知道如何向 Yocto 添加 libusb 支持以在连接时检测蓝牙适配器。
问候, 帕万
我正在尝试在 MAC OSX 下发现 USB 大容量存储设备。我希望获得设备类别,并在此基础上决定该设备是否是大容量存储。但是,对于我拥有的所有 USB 闪存驱动器,我得到的设备类 == 0,这似乎是一个复合设备。请帮助我弄清楚我做错了什么,或者,也许还有什么其他可靠的方法来发现 USB 大容量存储设备(我需要获取 PID、VID 和安装点)。这是我的代码:
#import <iostream>
#import <IOKit/IOkitLib.h>
#import <IOKit/usb/IOUSBLib.h>
#import <IOKit/IOCFPlugIn.h>
#import <IOKit/usb/USBSpec.h>
#import <CoreFoundation/CoreFoundation.h>
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
CFMutableDictionaryRef matchingDictionary = NULL;
io_iterator_t foundIterator = 0;
io_service_t usbDevice;
matchingDictionary = IOServiceMatching(kIOUSBDeviceClassName);
IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDictionary, &foundIterator);
for(usbDevice = IOIteratorNext(foundIterator); usbDevice; usbDevice = IOIteratorNext(foundIterator))
{
IOCFPlugInInterface** plugin = NULL;
SInt32 theScore=0;
IOReturn err;
err = IOCreatePlugInInterfaceForService(usbDevice, kIOUSBDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &plugin, &theScore);
if (err!= 0){
std::cout<<"error, error …Run Code Online (Sandbox Code Playgroud) 我想在带有 WINUSB 驱动程序的 Windows10-PC 上使用 iMX7-SOM 作为供应商特定设备(小工具)。我使用的是基于 Angstrom、Yocto 制作的映像,内核为 v4.9.166。
我使用 libusbgx 配置了小工具,将 functionfs 安装在 /ffs 并将描述符写入 /ffs/ep0。设备按预期枚举,并且我在端点 0 上获取命令(如“BIND”、“ENABLE”、“DISABLE”等)。
这么久了,真好……
在端点 0 接收到“ENABLE”时,我想打开 /ffs/ep1 并使用 poll() 读取传入数据。但 poll() 立即返回,而 read() 永远不会返回(仅当我拔掉设备时)。在主机端没有应用程序正在运行。
我使用 select() 代替,但结果完全相同。
当我使用 ioctl(fd_of_ep_1, FUNCTIONFS_FIFO_STATUS) 时,我收到错误消息“不支持操作”。
int fd = open("/ffs/ep1", O_RDWR);
fd_set read_set;
FD_ZERO(&read_set);
FD_SET(fd, &read_set);
int ret = select(fd + 1, &read_set, NULL, NULL, NULL);
if (ret < 0)
{
perror("select");
}
else if (FD_ISSET(fd, &read_set))
{
int foo = ioctl(fd, FUNCTIONFS_FIFO_STATUS);
if (foo < 0) …Run Code Online (Sandbox Code Playgroud) currently I try to sent 720 bytes from Windows application to custom STM32 device (now for testing purposes I use Blue Pill - STM32F103xxx). Ah, I forgot to point that I am totally newbie into programming :). So on device side I have 1000 bytes buffers for receiving and sending (Thanks to STMCube for this). Testing device with terminal program ( packets < than 64 bytes) works. Then I rework one of Microsoft examples to be able to sent more …
我正在构建一个宏键盘,我尝试实现的功能之一是 Ctrl+Shift+R,但在定义中,固定 8 字节字符串中仅存在一个修饰符。如何实施额外的修饰符?
我正在尝试使用 udev 规则和 systemd 来安装和卸载 USB 闪存盘。
我的解决方案基于此博客中的一个示例,其中 ENV{SYSTEMD_WANTS} 用于“添加”udev 规则。我无法让 ENV{SYSTEMD_WANTS} 用于“删除”规则,因此我最终使用了此博客文章中的示例,该示例从 udev RUN 键运行 systemd 服务文件。
尽管此解决方案有效,但udev 手册页显示:“长时间运行事件进程可能会阻止该设备或相关设备的所有进一步事件。”
这些是我使用的规则...
添加规则:
ACTION=="add", SUBSYSTEM=="block", ENV{ID_TYPE}="disk", \
ENV{DEVTYPE}=="partition", ENV{ENV_MOUNT_USB}="MOUNT", \
PROGRAM="/usr/bin/systemd-escape -p --template=usb-mount@.service \
$env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c"
Run Code Online (Sandbox Code Playgroud)
删除规则:
ACTION=="remove", SUBSYSTEM=="block", ENV{ID_TYPE}="disk", \
ENV{DEVTYPE}=="partition", RUN+="/bin/systemctl start usb-umount@%k.service"
Run Code Online (Sandbox Code Playgroud)
这些是 udev 规则启动的 systemd 服务文件。他们只需执行 bash 脚本来挂载和卸载 USB 闪存盘。
usb-mount@.service
[Unit]
Description=Mount USB Drive on %i
BindTo=%i.device
After=%i.device
[Service]
Type=oneshot
TimeoutStartSec=300
ExecStart=/usr/local/sbin/usb-mount.sh /%I
Run Code Online (Sandbox Code Playgroud)
usb-umount@.service
[Unit]
Description=UnMount USB Drive on %i …Run Code Online (Sandbox Code Playgroud)