声明界面时出现错误的usb4java库 [英] Usb4java library, error while claiming an interface

查看:133
本文介绍了声明界面时出现错误的usb4java库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里我使用库usb4java来访问我的usb设备。



问题是当我尝试声明我的usb设备的接口时出错。错误在这一行:



int msg = LibUsb.claimInterface(deviceHandler,1);



错误:USB错误3:无法声明界面:访问被拒绝(权限不足)



是否有人知道我为什么会出现此错误或如何解决此问题?

解决方案

我遇到了同样的问题,我的环境是Mac OS X 10.9



<经过长时间的谷歌搜索,我终于找到了这个只是获取连接到系统的USB设备的名称?帮助了我,现在我的代码就像魅力一样。



解决方案是< a href =http://www.proxmark.org/forum/viewtopic.php?id=986 =nofollow noreferrer>这里,原因mac将自动声明设备,我们可以创建一个虚拟设备它的驱动程序。



这是步骤如何做。


  1. 创建Info.plist i n /System/Library/Extensions/Proxmark3.kext/Contents ,你应该创建父文件夹,如果缺少,文件内容shuold是这样的:

 <?xml version =1.0encoding = UTF-8\" >?; <!DOCTYPE plist PUBLIC -  // Apple Computer // DTD PLIST 1.0 // ENhttp://www.apple.com/DTDs/PropertyList-1.0.dtd\"> <! - 这是一个绑定到Proxmark的虚拟驱动程序。它 - > <! - 不包含实际代码;它唯一的目的是 - > <! - 专门阻止Apple的USBHID驱动程序 - > <! - 打开设备。 - > < plist version =1.0> <字典> <密钥GT; CFBundleDevelopmentRegion< /密钥GT; <串GT;英语< /串GT; <密钥GT; CFBundleIconFile< /密钥GT; <串GT;< /串GT; <密钥GT; CFBundleIdentifier< /密钥GT; <串GT; com.proxmark.driver.dummy< /串GT; <密钥GT; CFBundleInfoDictionaryVersion< /密钥GT; <串GT; 6.0< /串GT; <密钥GT; CFBundlePackageType< /密钥GT; <串GT; KEXT< /串GT; <密钥GT; CFBundleSignature< /密钥GT; <串GT; ????< /串GT; <密钥GT; CFBundleVersion< /密钥GT; <串GT; 1.0.0d1< /串GT; <密钥GT; IOKitPersonalities< /密钥GT; <字典> <! -  Proxmark3 USB接口 - > <密钥GT; Proxmark3< /密钥GT; <字典> <密钥GT; CFBundleIdentifier< /密钥GT; <串GT; com.apple.kpi.iokit< /串GT; <密钥GT; IOClass< /密钥GT; <串GT; IOService的< /串GT; <密钥GT;&的IOProviderClass LT; /密钥GT; <串GT; IOUSBInterface< /串GT; <密钥GT;&的bConfiguration Value LT; /密钥GT; <整数大于1< /整数> <密钥GT; bInterfaceNumber< /密钥GT; <整数大于0< /整数> <密钥GT; idProduct< /密钥GT; <整数> {您-USB-硬件产品-ID}< /整数> <密钥GT; idVendor< /密钥GT; <整数> {您-USB-硬件供应商的ID}< /整数> < /字典> < /字典> <密钥GT; OSBundleLibraries< /密钥GT; <字典> <密钥GT; com.apple.iokit.IOUSBFamily< /密钥GT; <串GT; 1.8< /串GT; < /字典> < / dict>< / plist>  



注意:{your-usb-hardware-product-id}和{your-usb-hardware-vendor-id}必须是您自己的硬件ID,可以从关于此mac - 系统报告 - 硬件 - USB


  1. 输入 / System / Library / Extensions ,并以 ROOT

  2. <运行




sudo chown -R root:wheel Proxmark3.kext



sudo chmod -R 755 Proxmark3.kext



sudo kextcache -system-caches





  1. 重新启动系统并查看结果。


Here I use the library usb4java to access to my usb device.

The problem is I have an error while I try to claim an interface of my usb device. The error is on this line:

int msg = LibUsb.claimInterface(deviceHandler, 1);

error: USB error 3: Unable to claim interface: Access denied (insufficient permissions)

Is there someone who know why I have this error or how fix it ?

解决方案

I have the same issue you got, and my env is Mac OS X 10.9

After a long search with google, I finally found this just get the names of USB devices attached to a system? which helped me out, now my code works like charm。

solution is here,Cause mac will automatically claim devices, and we could create a dummy driver for it.

Here is step how to do it.

  1. create Info.plist in /System/Library/Extensions/Proxmark3.kext/Contents , And you should create parent folder if is missing, file content shuold be like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <!-- This is a dummy driver which binds to Proxmark. It -->
    <!-- contains no actual code; its only purpose is to     -->
    <!-- prevent Apple's USBHID driver from exclusively      -->
    <!-- opening the device.                                 -->
    <plist version="1.0">
    <dict>
        <key>CFBundleDevelopmentRegion</key>
        <string>English</string>
        <key>CFBundleIconFile</key>
        <string></string>
        <key>CFBundleIdentifier</key>
        <string>com.proxmark.driver.dummy</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundlePackageType</key>
        <string>KEXT</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <string>1.0.0d1</string>
        <key>IOKitPersonalities</key>
        <dict>
            <!-- The Proxmark3 USB interface -->
            <key>Proxmark3</key>
            <dict>
                <key>CFBundleIdentifier</key>
                <string>com.apple.kpi.iokit</string>
                <key>IOClass</key>
                <string>IOService</string>
                <key>IOProviderClass</key>
                <string>IOUSBInterface</string>
                <key>bConfigurationValue</key>
                <integer>1</integer>
                <key>bInterfaceNumber</key>
                <integer>0</integer>
                <key>idProduct</key>
                <integer>{your-usb-hardware-product-id}</integer>
                <key>idVendor</key>
                <integer>{your-usb-hardware-vendor-id}</integer>
            </dict>
        </dict>
        <key>OSBundleLibraries</key>
        <dict>
            <key>com.apple.iokit.IOUSBFamily</key>
            <string>1.8</string>
        </dict>
    </dict>
</plist>

note: {your-usb-hardware-product-id} and {your-usb-hardware-vendor-id} have to be your own hardware ids, which can be obtained from About this mac - System Report - Hardware - USB .

  1. Enter /System/Library/Extensions, and run as ROOT

sudo chown -R root:wheel Proxmark3.kext

sudo chmod -R 755 Proxmark3.kext

sudo kextcache -system-caches

  1. reboot your system and see the result.

这篇关于声明界面时出现错误的usb4java库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆