安装 iPod 时显示奇怪的 URI 字符串
我编写了一个小程序来检测设备何时安装在运行 Linux 的桌面上。我为此使用了 GIO。我正在提取已安装资源的 URI 并将其显示给用户。当我放入 CD 时,我得到一个 URI 字符串,看起来像 file:///media/cdrom0/
,我可以理解。但是当我安装 iPod 时,我看到的 URI 类似于 gphoto2://[usb:002,028]
。这意味着什么?我观察到,每次我取出设备并重新插入时,第二个数字 (028) 都会不断增加。有人可以帮我解释一下这个 URI 吗?
更新:正如shodanex所回答的,这两个数字分别是总线号和设备号。 gphoto2://
表示协议(PTP/MTP)。
I have written a small program to detect whenever a device is mounted on a desktop running Linux. I have used GIO
for this. I am extracting the URI of the mounted resource and displaying it to the user. When I put in a CD I get a URI string which looks like file:///media/cdrom0/
which I can understand. But when I mount an iPod the URI I see is something like gphoto2://[usb:002,028]
. What does this mean? I have observed that the second number (028) keeps increasing every time I take the device out and plug it back in. Can some one interpret this URI for me?
Update: As shodanex answered, the two numbers are the bus number and device number respectively. gphoto2://
indicates the protocol (PTP/MTP).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
gphoto2://[usb:002,028]
我猜002是总线号,28是该总线上设备的地址。
它映射到 lsusb util 输出的第二个和第四个字段。这是一个例子
在我的系统上:
我想它会翻译成:
gphoto2://[usb:002,028]
I guess 002 is the bus number, and 28 is the adress of the device on that bus.
It maps to the second and fourth field of the lsusb util output. Here is an example
on my system :
I guess it would translate to :
我在 Nautilus 中也有此类 URL,但其他响应没有解释它与磁盘上的安装位置有何关系。我可以通过 Nautilus 文件浏览器浏览 SD 卡上的文件,但我在 /mnt/ 或 /media/ 或我通常寻找自动安装的文件系统的其他任何地方都看不到任何这些文件。
最终我尝试右键单击该文件夹,选择“用其他应用程序打开”,选择文本编辑器,然后我可以看到该文件夹实际上安装在:
'~/.gvfs/gphoto2 mount on usb%3A001,010'
我希望 ubuntu 中的 Nautilus 和其他工具能够提供一些更明显的方式来查找这些文件...这看起来相当不直观。
I have these kinds of URL's in Nautilus too, but the other response doesn't explain how that relates to a mount location on disk. I can navigate through the files on an SD card via the Nautilus file browser, but I don't see any of these files in /mnt/ or /media/ or anywhere else I would typically look for automatically mounted file systems.
Eventually I tried right-clicking the folder, selecting "Open with other application," choosing a text editor, and then I could see that the folder was actually mounted at:
'~/.gvfs/gphoto2 mount on usb%3A001,010'
I wish Nautilus and other tools in ubuntu would provide some more obvious way to find these files... this seems pretty un-intuitive.