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.
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".
The only problem is that the device throws an exception when I try to open it
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)
How can it be fixed? is there another way to do it? any recommendation?
Here is the code that throws the exception
Device dev = USB.getDevice((short) 0x16c0, (short) 0x05dc);
dev.open(1, 0, -1);
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
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?
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.
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
Now, you can use the control endpoint for low speed communication with the controlMsg() function.
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