在Mac OSX下检测连接的USB设备 [英] Detecting attached USB devices under Mac OSX
问题描述
首先要声明:关于Mac编程,我是一个新手.但是,我的作业需要与设备进行USB通信,所以我认为我将从一些基本知识入手.
First of all a statement: I'm a newbie when it comes to programming for the Mac. However I have an assignment which requires USB communication with a device so I thought I'll start with something basic.
我从此处中获取了代码,并从终端运行它.它启动并写:
I took the code from here, built it and ran it from the Terminal. It starts up and writes:
正在寻找与供应商ID = 1351和产品ID = 8193匹配的设备.
Looking for devices matching vendor ID=1351 and product ID=8193.
开始运行循环.
但是,在此之后,如果我插入和拔出USB设备(我尝试过:iPod,GPS,鼠标),则屏幕上将不会写入任何内容,尽管据我所知,每次连接和断开设备时都应该写入.
However after this, if I plug in and out USB devices (I tried: iPod, GPS, mouse) nothing gets written on the screen, although as much as I understand there should be whenever I connect and disconnect a device.
我在做什么错了?
谢谢.
推荐答案
您也可以在终端上使用system_profiler SPUSBDataType
You can also use system_profiler SPUSBDataType
on a terminal
这篇关于在Mac OSX下检测连接的USB设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!