- descriptors extended from Usb_Descriptor
- toString() - javadoc added - interface changes (Strings, dll) git-svn-id: https://svn.code.sf.net/p/libusbjava/code/trunk@147 94ad28fe-ef68-46b1-9651-e7ae4fcf1c4c
This commit is contained in:
@@ -1,49 +1,75 @@
|
||||
package ch.ntb.usb;
|
||||
|
||||
public class Usb_Interface_Descriptor {
|
||||
/**
|
||||
* Represents the descriptor of a USB interface.<br>
|
||||
* The interface descriptor could be seen as a header or grouping of the
|
||||
* endpoints into a functional group performing a single feature of the device.<br>
|
||||
* <br>
|
||||
* The length of the interface descriptor is
|
||||
* {@link ch.ntb.usb.Usb_Descriptor#USB_DT_INTERFACE_SIZE} and the type is
|
||||
* {@link ch.ntb.usb.Usb_Descriptor#USB_DT_INTERFACE}.
|
||||
*
|
||||
* @author schlaepfer
|
||||
*
|
||||
*/
|
||||
public class Usb_Interface_Descriptor extends Usb_Descriptor {
|
||||
|
||||
/**
|
||||
* Maximal number of interfaces
|
||||
*/
|
||||
public static final int USB_MAXINTERFACES = 32;
|
||||
|
||||
public byte bLength;
|
||||
|
||||
public byte bDescriptorType;
|
||||
|
||||
/**
|
||||
* Number of interface
|
||||
*/
|
||||
public byte bInterfaceNumber;
|
||||
|
||||
/**
|
||||
* Value used to select alternate setting ({@link LibusbWin#usb_set_altinterface(int, int)}).
|
||||
*/
|
||||
public byte bAlternateSetting;
|
||||
|
||||
/**
|
||||
* Number of Endpoints used for this interface
|
||||
*/
|
||||
public byte bNumEndpoints;
|
||||
|
||||
/**
|
||||
* Class code (Assigned by <a href="http://www.usb.org">www.usb.org</a>)<br>
|
||||
*/
|
||||
public byte bInterfaceClass;
|
||||
|
||||
/**
|
||||
* Subclass code (Assigned by <a href="http://www.usb.org">www.usb.org</a>)<br>
|
||||
*/
|
||||
public byte bInterfaceSubClass;
|
||||
|
||||
/**
|
||||
* Protocol code (Assigned by <a href="http://www.usb.org">www.usb.org</a>)<br>
|
||||
*/
|
||||
public byte bInterfaceProtocol;
|
||||
|
||||
/**
|
||||
* Index of String descriptor describing this interface
|
||||
*/
|
||||
public byte iInterface;
|
||||
|
||||
/**
|
||||
* Endpoint descriptors
|
||||
*/
|
||||
public Usb_Endpoint_Descriptor[] endpoint;
|
||||
|
||||
// TODO: Extra descriptors are not interpreted because of their unknown
|
||||
// structure
|
||||
/**
|
||||
* Extra descriptors are currently not interpreted because of their unknown
|
||||
* structure.
|
||||
*/
|
||||
public Usb_Interface_Descriptor extra; /* Extra descriptors */
|
||||
// TODO
|
||||
|
||||
public int extralen;
|
||||
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("** Usb_Interface_Descriptor **\n");
|
||||
sb.append("\tblenght: " + bLength + "\n");
|
||||
sb.append("\tbDescriptorType: " + bDescriptorType + "\n");
|
||||
sb.append("\tbInterfaceNumber: " + bInterfaceNumber + "\n");
|
||||
sb.append("\tbAlternateSetting: " + bAlternateSetting + "\n");
|
||||
sb.append("\tbNumEndpoints: " + bNumEndpoints + "\n");
|
||||
sb.append("\tbInterfaceClass: 0x"
|
||||
+ Integer.toHexString(bInterfaceClass & 0xFF) + "\n");
|
||||
sb.append("\tbInterfaceSubClass: 0x"
|
||||
+ Integer.toHexString(bInterfaceSubClass & 0xFF) + "\n");
|
||||
sb.append("\tbInterfaceProtocol: 0x"
|
||||
+ Integer.toHexString(bInterfaceProtocol & 0xFF) + "\n");
|
||||
sb.append("\tiInterface: " + iInterface + "\n");
|
||||
return sb.toString();
|
||||
return "Usb_Interface_Descriptor bNumEndpoints: 0x"
|
||||
+ Integer.toHexString(bNumEndpoints);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user