无法声明接口:资源繁忙 [英] Unable to claim interface: Resource busy

查看:703
本文介绍了无法声明接口:资源繁忙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用USB4Java(低级版本),并且基本上从这个代码工作此处
我正在Ubuntu工作,我遇到一个有关权限的问题,但是可以通过从终端使用gksu运行eclipse来解决。

I am working with USB4Java (the low-level version) and am basically working from this code here. I'm working in Ubuntu, and I was running into a problem about permissions but was able to resolve by running eclipse using gksu from the terminal.

现在我有一个新的问题:
当我到这里的代码点:

Now I am having a new problem: When I get to the point in the code here:

public static void claimDevice(DeviceHandle handle, int interfaceNum){
    int r = LibUsb.claimInterface(handle, interfaceNum);
    .
    .
    .

我收到一个例外,告诉我资源很忙:

I'm getting an exception telling me that the "Resource is Busy":

USB error 6: Unable to claim interface: Resource busy

我以前使用过Ubuntu(但从来不用于开发,所以我真的很新)。
如果这不是处理这个问题的地方,请告诉我哪里可以得到答案。

I've used Ubuntu before (but never for development so I'm really new to this). If this isn't where this question should be handled then please tell me where to take it so I can get an answer.

具体来说,问题是这是什么意思,我该如何解决?
我的目标,在这种情况下,这是一个自定义的USB设备,是创建一个低级跨平台...基于java的...驱动程序(使用该术语松散)。我现在正在使用Ubuntu,因为终端lsusb命令在相关设备上提供了大量的信息。

Specifically, the question is, what does this mean and how can I resolve it? My goal, in this case, this being a custom USB device, is to create a low-level cross-platform... java based... "driver" (using that term loosely). I'm working with Ubuntu right now because the terminal lsusb command gives a good amount of information on the device in question.

推荐答案

我能够(感谢一些哄骗)找到Google的答案:对于遇到这个错误而不想挖掘的任何人,在我正在工作的上下文中,我需要从内核中分离界面在我可以声明之前,如下所示:

I was able (thanks to some coaxing) to find the answer by Google: For anyone else who comes across this error and doesn't want to dig, in the context with which I was working I was required to detach the interface from the kernel before I could claim it, like so:

public static void claimDevice(DeviceHandle handle, int interfaceNum){
    int r = LibUsb.detachKernelDriver(handle, interfaceNum);
    if (r != LibUsb.SUCCESS && 
        r != LibUsb.ERROR_NOT_SUPPORTED && 
        r != LibUsb.ERROR_NOT_FOUND) throw new LibUsbException("Unable to detach kernel     driver", r);
    .
    .
    .

希望这也有助于您。

这篇关于无法声明接口:资源繁忙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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