一个接口的libusb设备搭载V-USB库AVR [英] Interfacing a libUSB device powered by V-USB library for AVR

查看:563
本文介绍了一个接口的libusb设备搭载V-USB库AVR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写了一个简单的程序(基于的教程),它通过USB端口发送从AVR芯片(Attiny 2313至电脑的数据),因为这个设备不具有一个内置的USB端口,我已经使用了> V-USB 库,通过软件模拟这样的端口。

I've wrote a simple program (based on the following tutorial) that send data from an AVR chip (Attiny 2313) to the computer via a USB port, since this device doesn't have a built-in USB port, I've used the V-USB library to emulate such a port via software.

该设备正常工作,我不得不使用的libusb 库没有问题与C接口它,不过,我想使用Java来访问它,于是我抬起头来libusb.The只有库的Java实现,我已经成功地建立了,它已经成功地找到了总线上的USB是的的libusb-win32的包装

The device works as expected, and I had no problem to interface the it with C using the libusb library, However I want to access it with Java, so I looked up for a java implementation of libusb.The only library that I've managed to set up, and it has successfully found the usb on the bus was "libusb-win32 wrapper".

唯一的问题是,该设备会抛出一个异常,当我尝试打开它

ch.ntb.usb.USBException: No USB endpoints found. Check the device configuration
at ch.ntb.usb.Device.updateMaxPacketSize(Device.java:82)
at ch.ntb.usb.Device.initDevice(Device.java:114)

如何可以把它固定?有另一种方式来做到这一点?任何建议?

下面是code抛出异常

Here is the code that throws the exception

Device dev = USB.getDevice((short) 0x16c0, (short) 0x05dc);
dev.open(1, 0, -1);

在这里我得到了有关设备VIW USBVIEW

here is data I got about the device viw USBview

Device Descriptor:
bcdUSB:             0x0110
bDeviceClass:         0xFF
bDeviceSubClass:      0x00
bDeviceProtocol:      0x00
bMaxPacketSize0:      0x08 (8)
idVendor:           0x16C0
idProduct:          0x05DC
bcdDevice:          0x0100
iManufacturer:        0x01
0x0409: "mymail@gmail.com"
iProduct:             0x02
iSerialNumber:        0x00
bNumConfigurations:   0x01

ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed:     Low
Device Address:       0x03
Open Pipes:              0

Configuration Descriptor:
wTotalLength:       0x0012
bNumInterfaces:       0x01
bConfigurationValue:  0x01
iConfiguration:       0x00
bmAttributes:         0x80 (Bus Powered )
MaxPower:             0x32 (100 Ma)

Interface Descriptor:
bInterfaceNumber:     0x00
bAlternateSetting:    0x00
bNumEndpoints:        0x00
bInterfaceClass:      0x00
bInterfaceSubClass:   0x00
bInterfaceProtocol:   0x00
iInterface:           0x00

相关的问题的答案,但我不明白要改变什么,而且如果它涉及到设备,怎么能有VUSB做什么?

related question the answer, but I couldn't understand what to change, and if its related to the device, how can it be done with a VUSB?

推荐答案

以下库不支持,没有终端设备,并作为解决endpoint.I通过使另一个端点不计数控制端点哪些我无论如何也不会使用。

The following library doesn't support a device with no endpoint, and doesn't count the control endpoint as an endpoint.I solve that by enabling another endpoint which I won't use anyway.

要启用另一个端点打开以下文件的 usbconfig.h 的V-USB文件夹中,查找以下行并将其更改为1。

To enable another endpoint open the following file usbconfig.h within the V-usb folder and look up for the following line and change it to 1.

#define USB_CFG_HAVE_INTRIN_ENDPOINT    1 //default 0

现在,您可以使用控制端点低速通信用的 controlMsg()功能。

Now, you can use the control endpoint for low speed communication with the controlMsg() function.

您可以看到(通过USBVIEW)该设备现在有一个中断端点

here you can see (via USBview) that the device now has an interruption endpoint

Endpoint Descriptor:
bEndpointAddress:     0x81  IN
Transfer Type:   Interrupt
wMaxPacketSize:     0x0008 (8)
bInterval:            0x0A

这篇关于一个接口的libusb设备搭载V-USB库AVR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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