diff --git a/java/src/ch/ntb/usb/Device.java b/java/src/ch/ntb/usb/Device.java
index ae2106e..f31865f 100644
--- a/java/src/ch/ntb/usb/Device.java
+++ b/java/src/ch/ntb/usb/Device.java
@@ -61,21 +61,20 @@ public class Device {
throw new USBException("LibusbWin.usb_get_busses(): "
+ LibusbJava.usb_strerror());
}
-
return bus;
}
private void updateMaxPacketSize(Usb_Device device) throws USBException {
maxPacketSize = -1;
- Usb_Config_Descriptor[] confDesc = device.config;
+ Usb_Config_Descriptor[] confDesc = device.getConfig();
for (int i = 0; i < confDesc.length; i++) {
- Usb_Interface[] int_ = confDesc[i].interface_;
+ Usb_Interface[] int_ = confDesc[i].getInterface();
for (int j = 0; j < int_.length; j++) {
- Usb_Interface_Descriptor[] intDesc = int_[j].altsetting;
+ Usb_Interface_Descriptor[] intDesc = int_[j].getAltsetting();
for (int k = 0; k < intDesc.length; k++) {
- Usb_Endpoint_Descriptor[] epDesc = intDesc[k].endpoint;
+ Usb_Endpoint_Descriptor[] epDesc = intDesc[k].getEndpoint();
for (int l = 0; l < epDesc.length; l++) {
- maxPacketSize = Math.max(epDesc[l].wMaxPacketSize,
+ maxPacketSize = Math.max(epDesc[l].getWMaxPacketSize(),
maxPacketSize);
}
}
@@ -93,18 +92,18 @@ public class Device {
Usb_Device device = null;
// search for device
while (bus != null) {
- device = bus.devices;
+ device = bus.getDevices();
while (device != null) {
- Usb_Device_Descriptor devDesc = device.descriptor;
- if ((devDesc.idVendor == idVendor)
- && (devDesc.idProduct == idProduct)) {
- logger.info("Device found: " + device.filename);
+ Usb_Device_Descriptor devDesc = device.getDescriptor();
+ if ((devDesc.getIdVendor() == idVendor)
+ && (devDesc.getIdProduct() == idProduct)) {
+ logger.info("Device found: " + device.getFilename());
updateMaxPacketSize(device);
return device;
}
- device = device.next;
+ device = device.getNext();
}
- bus = bus.next;
+ bus = bus.getNext();
}
return null;
}
@@ -134,7 +133,7 @@ public class Device {
if (dev == null) {
return null;
}
- return dev.descriptor;
+ return dev.getDescriptor();
}
/**
@@ -149,7 +148,7 @@ public class Device {
if (dev == null) {
return null;
}
- return dev.config;
+ return dev.getConfig();
}
/**
diff --git a/java/src/ch/ntb/usb/Usb_Bus.java b/java/src/ch/ntb/usb/Usb_Bus.java
index b28dfe5..f6cf798 100644
--- a/java/src/ch/ntb/usb/Usb_Bus.java
+++ b/java/src/ch/ntb/usb/Usb_Bus.java
@@ -16,27 +16,69 @@ package ch.ntb.usb;
*/
public class Usb_Bus {
- /**
- * The next and previous bus object
- */
- public Usb_Bus next, prev;
+ private Usb_Bus next, prev;
+
+ private String dirname;
+
+ private Usb_Device devices;
+
+ private long location;
+
+ private Usb_Device root_dev;
/**
- * Systems String representation of the bus
+ * Get the first device ojects of the devices linked list.
+ *
+ * @return the first device ojects of the devices linked list or null
*/
- public String dirname;
+ public Usb_Device getDevices() {
+ return devices;
+ }
/**
- * Device objects attached to this bus
+ * Returns the systems String representation of the bus.
+ *
+ * @return the systems String representation of the bus
*/
- public Usb_Device devices;
+ public String getDirname() {
+ return dirname;
+ }
/**
- * Location in the USB bus linked list
+ * Returns the next bus object.
+ *
+ * @return Returns the next bus object or null
*/
- public long location;
+ public Usb_Bus getNext() {
+ return next;
+ }
- public Usb_Device root_dev;
+ /**
+ * Returns the previous bus object.
+ *
+ * @return Returns the previous bus object or null
+ */
+ public Usb_Bus getPrev() {
+ return prev;
+ }
+
+ /**
+ * Get the root device of this bus.
+ *
+ * @return the root device oject or null
+ */
+ public Usb_Device getRootDev() {
+ return root_dev;
+ }
+
+ /**
+ * Returns the location in the USB bus linked list.
+ *
+ * @return the location in the USB bus linked list
+ */
+ public long getLocation() {
+ return location;
+ }
@Override
public String toString() {
diff --git a/java/src/ch/ntb/usb/Usb_Config_Descriptor.java b/java/src/ch/ntb/usb/Usb_Config_Descriptor.java
index 0a2c87e..da19c7f 100644
--- a/java/src/ch/ntb/usb/Usb_Config_Descriptor.java
+++ b/java/src/ch/ntb/usb/Usb_Config_Descriptor.java
@@ -20,62 +20,119 @@ package ch.ntb.usb;
public class Usb_Config_Descriptor extends Usb_Descriptor {
/**
- * Maximum number of configuration per device
+ * Maximum number of configurations per device
*/
public static final int USB_MAXCONFIG = 8;
- /**
- * Total length in bytes of data returned.
- * When the configuration descriptor is read, it returns the entire
- * configuration hierarchy which includes all related interface and endpoint
- * descriptors. The wTotalLength field reflects the number of
- * bytes in the hierarchy.
- */
- public short wTotalLength;
+ private short wTotalLength;
+
+ private byte bNumInterfaces;
+
+ private byte bConfigurationValue;
+
+ private byte iConfiguration;
+
+ private byte bmAttributes;
+
+ private byte MaxPower;
+
+ private Usb_Interface[] interface_;
+
+ private Usb_Config_Descriptor extra; /* Extra descriptors */
+
+ private int extralen;
/**
- * Number of interfaces
+ * Returns the value to use as an argument to select this configuration ({@link LibusbJava#usb_set_configuration(int, int)}).
+ *
+ * @return the value to use as an argument to select this configuration
*/
- public byte bNumInterfaces;
+ public byte getBConfigurationValue() {
+ return bConfigurationValue;
+ }
/**
- * Value to use as an argument to select this configuration ({@link LibusbJava#usb_set_configuration(int, int)}).
- */
- public byte bConfigurationValue;
-
- /**
- * Index of String descriptor describing this configuration
- */
- public byte iConfiguration;
-
- /**
- * Specifies power parameters for this configuration
+ * Returns the power parameters for this configuration.
*
* Bit 7: Reserved, set to 1 (USB 1.0 Bus Powered)
* Bit 6: Self Powered
* Bit 5: Remote Wakeup
* Bit 4..0: Reserved, set to 0
+ *
+ * @return the power parameters for this configuration
*/
- public byte bmAttributes;
+ public byte getBmAttributes() {
+ return bmAttributes;
+ }
/**
- * Maximum power consumption in 2mA units
+ * Returns the number of interfaces.
+ *
+ * @return the number of interfaces
*/
- public byte MaxPower;
-
- /**
- * USB interface descriptors
- */
- public Usb_Interface[] interface_;
+ public byte getBNumInterfaces() {
+ return bNumInterfaces;
+ }
/**
* Extra descriptors are currently not interpreted because of their unknown
* structure.
+ *
+ * @return null
*/
- public Usb_Config_Descriptor extra; /* Extra descriptors */
- // TODO
+ // TODO: implementation
+ public Usb_Config_Descriptor getExtra() {
+ return extra;
+ }
- public int extralen;
+ /**
+ * Returns the number of bytes of the extra descriptor.
+ *
+ * @return the number of bytes of the extra descriptor
+ */
+ public int getExtralen() {
+ return extralen;
+ }
+
+ /**
+ * Returns the index of the String descriptor describing this configuration.
+ *
+ * @return the index of the String descriptor
+ */
+ public byte getIConfiguration() {
+ return iConfiguration;
+ }
+
+ /**
+ * Returns the USB interface descriptors.
+ *
+ * @return the USB interface descriptors
+ */
+ public Usb_Interface[] getInterface() {
+ return interface_;
+ }
+
+ /**
+ * Returns the maximum power consumption in 2mA units.
+ *
+ * @return the maximum power consumption in 2mA units
+ */
+ public byte getMaxPower() {
+ return MaxPower;
+ }
+
+ /**
+ * Returns the total length in bytes of all descriptors.
+ * When the configuration descriptor is read, it returns the entire
+ * configuration hierarchy which includes all related interface and endpoint
+ * descriptors. The wTotalLength field reflects the number of
+ * bytes in the hierarchy.
+ *
+ * @return the total length in bytes of all descriptors
+ */
+ public short getWTotalLength() {
+ return wTotalLength;
+ }
@Override
public String toString() {
diff --git a/java/src/ch/ntb/usb/Usb_Descriptor.java b/java/src/ch/ntb/usb/Usb_Descriptor.java
index 204509c..b73cfa2 100644
--- a/java/src/ch/ntb/usb/Usb_Descriptor.java
+++ b/java/src/ch/ntb/usb/Usb_Descriptor.java
@@ -35,14 +35,26 @@ public class Usb_Descriptor {
USB_DT_ENDPOINT_AUDIO_SIZE = 9 /* Audio extension */,
USB_DT_HUB_NONVAR_SIZE = 7;
- /**
- * Size of descriptor in bytes
- */
- public byte bLength;
+ private byte bLength;
+
+ private byte bDescriptorType;
/**
- * Type of descriptor
+ * Get the type of this descriptor.
+ *
+ * @return the type of this descriptor
*/
- public byte bDescriptorType;
+ public byte getBDescriptorType() {
+ return bDescriptorType;
+ }
+
+ /**
+ * Get the size of this descriptor in bytes.
+ *
+ * @return the size of this descriptor in bytes
+ */
+ public byte getBLength() {
+ return bLength;
+ }
}
diff --git a/java/src/ch/ntb/usb/Usb_Device.java b/java/src/ch/ntb/usb/Usb_Device.java
index 19428db..c8d2421 100644
--- a/java/src/ch/ntb/usb/Usb_Device.java
+++ b/java/src/ch/ntb/usb/Usb_Device.java
@@ -16,49 +16,105 @@ package ch.ntb.usb;
*/
public class Usb_Device {
- /**
- * Pointers to the next and previous device
- */
- public Usb_Device next, prev;
+ private Usb_Device next, prev;
+
+ private String filename;
+
+ private Usb_Bus bus;
+
+ private Usb_Device_Descriptor descriptor;
+
+ private Usb_Config_Descriptor[] config;
+
+ private byte devnum;
+
+ private byte num_children;
+
+ private Usb_Device children;
/**
- * Systems String representation
+ * Returns the reference to the bus to which this device is connected.
+ *
+ * @return the reference to the bus to which this device is connected
*/
- public String filename;
+ public Usb_Bus getBus() {
+ return bus;
+ }
/**
- * Reference to the bus to which this device is connected
+ * Returns a reference to the first child.
+ *
+ * @return a reference to the first child
*/
- public Usb_Bus bus;
+ public Usb_Device getChildren() {
+ return children;
+ }
/**
- * USB device descriptor
+ * Returns the USB config descriptors.
+ *
+ * @return the USB config descriptors
*/
- public Usb_Device_Descriptor descriptor;
+ public Usb_Config_Descriptor[] getConfig() {
+ return config;
+ }
/**
- * USB config descriptors
+ * Returns the USB device descriptor.
+ *
+ * @return the USB device descriptor
*/
- public Usb_Config_Descriptor[] config;
+ public Usb_Device_Descriptor getDescriptor() {
+ return descriptor;
+ }
/**
- * Number assigned to this device
+ * Returns the number assigned to this device.
+ *
+ * @return the number assigned to this device
*/
- public byte devnum;
+ public byte getDevnum() {
+ return devnum;
+ }
/**
- * Number of children of this device
+ * Returns the systems String representation.
+ *
+ * @return the systems String representation
*/
- public byte num_children;
+ public String getFilename() {
+ return filename;
+ }
/**
- * Reference to the first child
+ * Returns the pointer to the next device.
+ *
+ * @return the pointer to the next device or null
*/
- public Usb_Device children;
+ public Usb_Device getNext() {
+ return next;
+ }
+
+ /**
+ * Returns the number of children of this device.
+ *
+ * @return the number of children of this device
+ */
+ public byte getNumChildren() {
+ return num_children;
+ }
+
+ /**
+ * Returns the pointer to the previous device.
+ *
+ * @return the pointer to the previous device or null
+ */
+ public Usb_Device getPrev() {
+ return prev;
+ }
@Override
public String toString() {
return "Usb_Device " + filename;
}
-
}
\ No newline at end of file
diff --git a/java/src/ch/ntb/usb/Usb_Device_Descriptor.java b/java/src/ch/ntb/usb/Usb_Device_Descriptor.java
index c8c93db..8f543fe 100644
--- a/java/src/ch/ntb/usb/Usb_Device_Descriptor.java
+++ b/java/src/ch/ntb/usb/Usb_Device_Descriptor.java
@@ -27,79 +27,158 @@ public class Usb_Device_Descriptor extends Usb_Descriptor {
USB_CLASS_MASS_STORAGE = 8, USB_CLASS_HUB = 9, USB_CLASS_DATA = 10,
USB_CLASS_VENDOR_SPEC = 0xff;
+ private short bcdUSB;
+
+ private byte bDeviceClass;
+
+ private byte bDeviceSubClass;
+
+ private byte bDeviceProtocol;
+
+ private byte bMaxPacketSize0;
+
+ private short idVendor;
+
+ private short idProduct;
+
+ private short bcdDevice;
+
+ private byte iManufacturer;
+
+ private byte iProduct;
+
+ private byte iSerialNumber;
+
+ private byte bNumConfigurations;
+
/**
- * USB Specification number to which the device complies to.
+ * Returns the device release number.
+ * Assigned by the manufacturer of the device.
+ *
+ * @return the device release number
+ */
+ public short getBcdDevice() {
+ return bcdDevice;
+ }
+
+ /**
+ * Returns the USB specification number to which the device complies to.
* This field reports the highest version of USB the device supports. The
* value is in binary coded decimal with a format of 0xJJMN where JJ is the
* major version number, M is the minor version number and N is the sub
* minor version number.
* Examples: USB 2.0 is reported as 0x0200, USB 1.1 as 0x0110 and USB 1.0 as
* 0x100
+ *
+ * @return the USB specification number to which the device complies to
*/
- public short bcdUSB;
+ public short getBcdUSB() {
+ return bcdUSB;
+ }
/**
- * Class code (Assigned by www.usb.org)
+ * Returns the class code (Assigned by www.usb.org)
* If equal to zero, each interface specifies it's own class code. If equal
* to 0xFF, the class code is vendor specified. Otherwise the field is a
* valid class code.
+ *
+ * @return the class code
*/
- public byte bDeviceClass;
+ public byte getBDeviceClass() {
+ return bDeviceClass;
+ }
/**
- * Subclass code (Assigned by www.usb.org)
+ * Returns the protocol code (Assigned by www.usb.org)
+ *
+ * @return the protocol code
*/
- public byte bDeviceSubClass;
+ public byte getBDeviceProtocol() {
+ return bDeviceProtocol;
+ }
/**
- * Protocol code (Assigned by www.usb.org)
+ * Returns the subclass code (Assigned by www.usb.org)
+ *
+ * @return the subclass code
*/
- public byte bDeviceProtocol;
+ public byte getBDeviceSubClass() {
+ return bDeviceSubClass;
+ }
/**
- * Maximum packet size for endpoint zero.
+ * Returns the maximum packet size for endpoint zero.
* Valid sizes are 8, 16, 32, 64.
+ *
+ * @return the maximum packet size for endpoint zero
*/
- public byte bMaxPacketSize0;
+ public byte getBMaxPacketSize0() {
+ return bMaxPacketSize0;
+ }
/**
- * Vendor ID (Assigned by www.usb.org)
+ * Returns the number of possible configurations supported at its current
+ * speed.
+ *
+ * @return the number of possible configurations supported at its current
+ * speed
*/
- public short idVendor;
+ public byte getBNumConfigurations() {
+ return bNumConfigurations;
+ }
/**
- * Product ID (Assigned by www.usb.org)
+ * Returns the product ID (Assigned by www.usb.org)
+ *
+ * @return the product ID
*/
- public short idProduct;
+ public short getIdProduct() {
+ return idProduct;
+ }
/**
- * Device release number
- * Assigned by the manufacturer of the device.
+ * Returns the Vendor ID (Assigned by www.usb.org)
+ *
+ * @return the Vendor ID
*/
- public short bcdDevice;
+ public short getIdVendor() {
+ return idVendor;
+ }
/**
- * Index of manufacturer string descriptor
+ * Returns the index of the manufacturer string descriptor.
* If this value is 0, no string descriptor is used.
+ *
+ * @return the index of the manufacturer string descriptor
*/
- public byte iManufacturer;
+ public byte getIManufacturer() {
+ return iManufacturer;
+ }
/**
- * Index of product string descriptor
+ * Returns the index of the product string descriptor.
* If this value is 0, no string descriptor is used.
+ *
+ * @return the index of the product string descriptor
*/
- public byte iProduct;
+ public byte getIProduct() {
+ return iProduct;
+ }
/**
- * Index of serial number string descriptor
+ * Returns the index of serial number string descriptor.
* If this value is 0, no string descriptor is used.
+ *
+ * @return the index of serial number string descriptor
*/
- public byte iSerialNumber;
-
- /**
- * Number of possible configurations supported at its current speed
- */
- public byte bNumConfigurations;
+ public byte getISerialNumber() {
+ return iSerialNumber;
+ }
@Override
public String toString() {
diff --git a/java/src/ch/ntb/usb/Usb_Endpoint_Descriptor.java b/java/src/ch/ntb/usb/Usb_Endpoint_Descriptor.java
index 54ddd0a..485151e 100644
--- a/java/src/ch/ntb/usb/Usb_Endpoint_Descriptor.java
+++ b/java/src/ch/ntb/usb/Usb_Endpoint_Descriptor.java
@@ -7,7 +7,7 @@
package ch.ntb.usb;
/**
- * Represents the descriptor of a USB endpoint.
+ * Represents the descriptor of an USB endpoint.
* Endpoint descriptors are used to describe endpoints other than endpoint zero.
* Endpoint zero is always assumed to be a control endpoint and is configured
* before any descriptors are even requested. The host will use the information
@@ -38,7 +38,7 @@ public class Usb_Endpoint_Descriptor extends Usb_Descriptor {
* Endpoint type mask (in bmAttributes).
*/
public static final int USB_ENDPOINT_TYPE_MASK = 0x03;
-
+
/**
* Possible endpoint types (in bmAttributes).
*/
@@ -46,60 +46,110 @@ public class Usb_Endpoint_Descriptor extends Usb_Descriptor {
USB_ENDPOINT_TYPE_ISOCHRONOUS = 1, USB_ENDPOINT_TYPE_BULK = 2,
USB_ENDPOINT_TYPE_INTERRUPT = 3;
+ private byte bEndpointAddress;
+
+ private byte bmAttributes;
+
+ private short wMaxPacketSize;
+
+ private byte bInterval;
+
+ private byte bRefresh;
+
+ private byte bSynchAddress;
+
+ private Usb_Endpoint_Descriptor extra; /* Extra descriptors */
+
+ private int extralen;
+
/**
- * Endpoint Address
+ * Returns the endpoint address.
*
* Bits 3..0: Endpoint number
* Bits 6..4: Reserved. Set to zero
* Bit 7: Direction. 0 = Out, 1 = In (ignored for control endpoints)
+ *
+ * @return the endpoint address
*/
- public byte bEndpointAddress;
+ public byte getBEndpointAddress() {
+ return bEndpointAddress;
+ }
/**
+ * Returns the intervall for polling endpoint data transfers.
+ * Value in frame counts. Ignored for Bulk & Control eEndpoints. Isochronous
+ * endpoints must equal 1 and field may range from 1 to 255 for interrupt
+ * endpoints.
+ *
+ * @return the intervall for polling endpoint data transfers
+ */
+ public byte getBInterval() {
+ return bInterval;
+ }
+
+ /**
+ * Returns the attributes of this endpoint.
+ *
* Bits 1..0: Transfer Type (see USB_ENDPOINT_TYPE_XXX).
* Bits 7..2: Reserved.
*
*
- * If isochronous endpoint:
+ * If isochronous endpoint:
* Bits 3..2: Synchronisation type
- * 00 = No synchronisation
+ * 00 = No synchronisation
* 01 = Asynchronous
- * 10 = Adaptive
- * 11 = Synchronous
- * Bits 5..4: Usage Type
- * 00 = Data endpoint
- * 01 = Feedback endpoint
- * 10 = Explicit feedback data endpoint
- * 11 = Reserved
+ * 10 = Adaptive
+ * 11 = Synchronous
+ * Bits 5..4: Usage Type
+ * 00 = Data endpoint
+ * 01 = Feedback endpoint
+ * 10 = Explicit feedback data endpoint
+ * 11 = Reserved
*
+ *
+ * @return the attributes of this endpoint
*/
- public byte bmAttributes;
+ public byte getBmAttributes() {
+ return bmAttributes;
+ }
- /**
- * Maximum packet size this endpoint is capable of sending or receiving
- */
- public short wMaxPacketSize;
+ public byte getBRefresh() {
+ return bRefresh;
+ }
- /**
- * Intervall for polling endpoint data transfers.
- * Value in frame counts. Ignored for Bulk & Control eEndpoints. Isochronous
- * endpoints must equal 1 and field may range from 1 to 255 for interrupt
- * endpoints.
- */
- public byte bInterval;
-
- public byte bRefresh;
-
- public byte bSynchAddress;
+ public byte getBSynchAddress() {
+ return bSynchAddress;
+ }
/**
* Extra descriptors are currently not interpreted because of their unknown
* structure.
+ *
+ * @return null
*/
- public Usb_Endpoint_Descriptor extra; /* Extra descriptors */
- // TODO
+ // TODO: implementation
+ public Usb_Endpoint_Descriptor getExtra() {
+ return extra;
+ }
- public int extralen;
+ /**
+ * Returns the number of bytes of the extra descriptor.
+ *
+ * @return the number of bytes of the extra descriptor
+ */
+ public int getExtralen() {
+ return extralen;
+ }
+
+ /**
+ * Returns the maximum packet size of this endpoint is capable of sending or
+ * receiving.
+ *
+ * @return the maximum packet size
+ */
+ public short getWMaxPacketSize() {
+ return wMaxPacketSize;
+ }
@Override
public String toString() {
diff --git a/java/src/ch/ntb/usb/Usb_Interface.java b/java/src/ch/ntb/usb/Usb_Interface.java
index e56885f..b97d91a 100644
--- a/java/src/ch/ntb/usb/Usb_Interface.java
+++ b/java/src/ch/ntb/usb/Usb_Interface.java
@@ -20,15 +20,9 @@ public class Usb_Interface {
*/
public static final int USB_MAXALTSETTING = 128; /* Hard limit */
- /**
- * Interface descriptors
- */
- public Usb_Interface_Descriptor[] altsetting;
+ private Usb_Interface_Descriptor[] altsetting;
- /**
- * Number of alternate settings
- */
- public int num_altsetting;
+ private int num_altsetting;
@Override
public String toString() {
@@ -36,4 +30,22 @@ public class Usb_Interface {
+ Integer.toHexString(num_altsetting);
}
+ /**
+ * Retuns an array of interface descriptors.
+ *
+ * @return an array of interface descriptors
+ */
+ public Usb_Interface_Descriptor[] getAltsetting() {
+ return altsetting;
+ }
+
+ /**
+ * Returns the number of alternate settings.
+ *
+ * @return the number of alternate settings
+ */
+ public int getNumAltsetting() {
+ return num_altsetting;
+ }
+
}
diff --git a/java/src/ch/ntb/usb/Usb_Interface_Descriptor.java b/java/src/ch/ntb/usb/Usb_Interface_Descriptor.java
index 36582a1..1640bdf 100644
--- a/java/src/ch/ntb/usb/Usb_Interface_Descriptor.java
+++ b/java/src/ch/ntb/usb/Usb_Interface_Descriptor.java
@@ -21,62 +21,128 @@ package ch.ntb.usb;
public class Usb_Interface_Descriptor extends Usb_Descriptor {
/**
- * Maximal number of interfaces
+ * Maximum number of interfaces
*/
public static final int USB_MAXINTERFACES = 32;
- /**
- * Number (identifier) of interface
- */
- public byte bInterfaceNumber;
+ private byte bInterfaceNumber;
- /**
- * Value used to select alternate setting ({@link LibusbJava#usb_set_altinterface(int, int)}).
- */
- public byte bAlternateSetting;
+ private byte bAlternateSetting;
- /**
- * Number of Endpoints used for this interface
- */
- public byte bNumEndpoints;
+ private byte bNumEndpoints;
- /**
- * Class code (Assigned by www.usb.org)
- */
- public byte bInterfaceClass;
+ private byte bInterfaceClass;
- /**
- * Subclass code (Assigned by www.usb.org)
- */
- public byte bInterfaceSubClass;
+ private byte bInterfaceSubClass;
- /**
- * Protocol code (Assigned by www.usb.org)
- */
- public byte bInterfaceProtocol;
+ private byte bInterfaceProtocol;
- /**
- * Index of String descriptor describing this interface
- */
- public byte iInterface;
+ private byte iInterface;
- /**
- * Endpoint descriptors
- */
- public Usb_Endpoint_Descriptor[] endpoint;
+ private Usb_Endpoint_Descriptor[] endpoint;
- /**
- * Extra descriptors are currently not interpreted because of their unknown
- * structure.
- */
- public Usb_Interface_Descriptor extra; /* Extra descriptors */
- // TODO
+ private Usb_Interface_Descriptor extra; /* Extra descriptors */
- public int extralen;
+ private int extralen;
@Override
public String toString() {
return "Usb_Interface_Descriptor bNumEndpoints: 0x"
+ Integer.toHexString(bNumEndpoints);
}
+
+ /**
+ * Returns the value used to select the alternate setting ({@link LibusbJava#usb_set_altinterface(int, int)}).
+ *
+ * @return the alternate setting
+ */
+ public byte getBAlternateSetting() {
+ return bAlternateSetting;
+ }
+
+ /**
+ * Returns the class code (Assigned by www.usb.org).
+ *
+ * @return the class code
+ */
+ public byte getBInterfaceClass() {
+ return bInterfaceClass;
+ }
+
+ /**
+ * Returns the number (identifier) of this interface.
+ *
+ * @return the number (identifier) of this interface
+ */
+ public byte getBInterfaceNumber() {
+ return bInterfaceNumber;
+ }
+
+ /**
+ * Returns the protocol code (Assigned by www.usb.org).
+ *
+ * @return the protocol code
+ */
+ public byte getBInterfaceProtocol() {
+ return bInterfaceProtocol;
+ }
+
+ /**
+ * Returns the subclass code (Assigned by www.usb.org).
+ *
+ * @return the subclass code
+ */
+ public byte getBInterfaceSubClass() {
+ return bInterfaceSubClass;
+ }
+
+ /**
+ * Returns the number of endpoints used for this interface.
+ *
+ * @return the number of endpoints used for this interface
+ */
+ public byte getBNumEndpoints() {
+ return bNumEndpoints;
+ }
+
+ /**
+ * Returns an array of endpoint descriptors.
+ *
+ * @return an array of endpoint descriptors
+ */
+ public Usb_Endpoint_Descriptor[] getEndpoint() {
+ return endpoint;
+ }
+
+ /**
+ * Extra descriptors are currently not interpreted because of their unknown
+ * structure.
+ *
+ * @return null
+ */
+ // TODO: implementation
+ public Usb_Interface_Descriptor getExtra() {
+ return extra;
+ }
+
+ /**
+ * Returns the number of bytes of the extra descriptor.
+ *
+ * @return the number of bytes of the extra descriptor
+ */
+ public int getExtralen() {
+ return extralen;
+ }
+
+ /**
+ * Returns the index of the String descriptor describing this interface.
+ *
+ * @return the index of the String descriptor
+ */
+ public byte getIInterface() {
+ return iInterface;
+ }
}
diff --git a/java/src/ch/ntb/usb/Utils.java b/java/src/ch/ntb/usb/Utils.java
index 2e8a6e9..06395d2 100644
--- a/java/src/ch/ntb/usb/Utils.java
+++ b/java/src/ch/ntb/usb/Utils.java
@@ -12,26 +12,26 @@ public class Utils {
Usb_Bus usb_Bus = bus;
while (usb_Bus != null) {
System.out.println(usb_Bus.toString());
- Usb_Device dev = usb_Bus.devices;
+ Usb_Device dev = usb_Bus.getDevices();
while (dev != null) {
System.out.println("\t" + dev.toString());
// Usb_Device_Descriptor
- Usb_Device_Descriptor defDesc = dev.descriptor;
+ Usb_Device_Descriptor defDesc = dev.getDescriptor();
System.out.println("\t\t" + defDesc.toString());
// Usb_Config_Descriptor
- Usb_Config_Descriptor[] confDesc = dev.config;
+ Usb_Config_Descriptor[] confDesc = dev.getConfig();
for (int i = 0; i < confDesc.length; i++) {
System.out.println("\t\t" + confDesc[i].toString());
- Usb_Interface[] int_ = confDesc[i].interface_;
+ Usb_Interface[] int_ = confDesc[i].getInterface();
if (int_ != null) {
for (int j = 0; j < int_.length; j++) {
System.out.println("\t\t\t" + int_[j].toString());
- Usb_Interface_Descriptor[] intDesc = int_[j].altsetting;
+ Usb_Interface_Descriptor[] intDesc = int_[j].getAltsetting();
if (intDesc != null) {
for (int k = 0; k < intDesc.length; k++) {
System.out.println("\t\t\t\t"
+ intDesc[k].toString());
- Usb_Endpoint_Descriptor[] epDesc = intDesc[k].endpoint;
+ Usb_Endpoint_Descriptor[] epDesc = intDesc[k].getEndpoint();
if (epDesc != null) {
for (int e = 0; e < epDesc.length; e++) {
System.out.println("\t\t\t\t\t"
@@ -43,9 +43,9 @@ public class Utils {
}
}
}
- dev = dev.next;
+ dev = dev.getNext();
}
- usb_Bus = usb_Bus.next;
+ usb_Bus = usb_Bus.getNext();
}
}
}
diff --git a/java/src/ch/ntb/usb/usbView/UsbTreeModel.java b/java/src/ch/ntb/usb/usbView/UsbTreeModel.java
index dd3c0a7..5ae9e8f 100644
--- a/java/src/ch/ntb/usb/usbView/UsbTreeModel.java
+++ b/java/src/ch/ntb/usb/usbView/UsbTreeModel.java
@@ -59,37 +59,37 @@ public class UsbTreeModel implements TreeModel, TreeSelectionListener {
*/
public Object getChild(Object parent, int index) {
if (parent instanceof Usb_Bus) {
- Usb_Device device = ((Usb_Bus) parent).devices;
+ Usb_Device device = ((Usb_Bus) parent).getDevices();
int count = 0;
while (device != null) {
if (count == index)
return device;
count++;
- device = device.next;
+ device = device.getNext();
}
return null;
} else if (parent instanceof Usb_Device) {
Usb_Device dev = (Usb_Device) parent;
// return the Usb_Device_Descriptor at index 0
if (index == 0) {
- return dev.descriptor;
+ return dev.getDescriptor();
}
- Usb_Config_Descriptor[] confDescs = dev.config;
+ Usb_Config_Descriptor[] confDescs = dev.getConfig();
if (index >= confDescs.length + 1)
return null;
return confDescs[index - 1];
} else if (parent instanceof Usb_Config_Descriptor) {
- Usb_Interface[] intDescs = ((Usb_Config_Descriptor) parent).interface_;
+ Usb_Interface[] intDescs = ((Usb_Config_Descriptor) parent).getInterface();
if (index >= intDescs.length)
return null;
return intDescs[index];
} else if (parent instanceof Usb_Interface) {
- Usb_Interface_Descriptor[] altSettings = ((Usb_Interface) parent).altsetting;
+ Usb_Interface_Descriptor[] altSettings = ((Usb_Interface) parent).getAltsetting();
if (index >= altSettings.length)
return null;
return altSettings[index];
} else if (parent instanceof Usb_Interface_Descriptor) {
- Usb_Endpoint_Descriptor[] endpoints = ((Usb_Interface_Descriptor) parent).endpoint;
+ Usb_Endpoint_Descriptor[] endpoints = ((Usb_Interface_Descriptor) parent).getEndpoint();
if (index >= endpoints.length)
return null;
return endpoints[index];
@@ -102,22 +102,22 @@ public class UsbTreeModel implements TreeModel, TreeSelectionListener {
*/
public int getChildCount(Object parent) {
if (parent instanceof Usb_Bus) {
- Usb_Device device = ((Usb_Bus) parent).devices;
+ Usb_Device device = ((Usb_Bus) parent).getDevices();
int count = 0;
while (device != null) {
count++;
- device = device.next;
+ device = device.getNext();
}
return count;
} else if (parent instanceof Usb_Device) {
// add the Usb_Device_Descriptor
- return ((Usb_Device) parent).config.length + 1;
+ return ((Usb_Device) parent).getConfig().length + 1;
} else if (parent instanceof Usb_Config_Descriptor) {
- return ((Usb_Config_Descriptor) parent).interface_.length;
+ return ((Usb_Config_Descriptor) parent).getInterface().length;
} else if (parent instanceof Usb_Interface) {
- return ((Usb_Interface) parent).altsetting.length;
+ return ((Usb_Interface) parent).getAltsetting().length;
} else if (parent instanceof Usb_Interface_Descriptor) {
- return ((Usb_Interface_Descriptor) parent).endpoint.length;
+ return ((Usb_Interface_Descriptor) parent).getEndpoint().length;
}
return 0;
}
@@ -172,59 +172,59 @@ public class UsbTreeModel implements TreeModel, TreeSelectionListener {
if (component instanceof Usb_Bus) {
Usb_Bus bus = (Usb_Bus) component;
StringBuffer sb = new StringBuffer("Usb_Bus\n");
- sb.append("\tdirname: " + bus.dirname + "\n");
- sb.append("\tlocation: 0x" + Long.toHexString(bus.location) + "\n");
+ sb.append("\tdirname: " + bus.getDirname() + "\n");
+ sb.append("\tlocation: 0x" + Long.toHexString(bus.getLocation()) + "\n");
textArea.setText(sb.toString());
} else if (component instanceof Usb_Device) {
Usb_Device device = (Usb_Device) component;
StringBuffer sb = new StringBuffer("Usb_Device\n");
- sb.append("\tfilename: " + device.filename + "\n");
- sb.append("\tdevnum: " + device.devnum + "\n");
- sb.append("\tnum_children: " + device.num_children + "\n");
+ sb.append("\tfilename: " + device.getFilename() + "\n");
+ sb.append("\tdevnum: " + device.getDevnum() + "\n");
+ sb.append("\tnum_children: " + device.getNumChildren() + "\n");
textArea.setText(sb.toString());
} else if (component instanceof Usb_Device_Descriptor) {
Usb_Device_Descriptor devDesc = (Usb_Device_Descriptor) component;
StringBuffer sb = new StringBuffer("Usb_Device_Descriptor\n");
- sb.append("\tblenght: 0x" + Integer.toHexString(devDesc.bLength)
+ sb.append("\tblenght: 0x" + Integer.toHexString(devDesc.getBLength())
+ "\n");
sb.append("\tbDescriptorType: 0x"
- + Integer.toHexString(devDesc.bDescriptorType) + "\n");
+ + Integer.toHexString(devDesc.getBDescriptorType()) + "\n");
sb.append("\tbcdUSB: 0x"
- + Integer.toHexString(devDesc.bcdUSB & 0xFFFF) + "\n");
+ + Integer.toHexString(devDesc.getBcdUSB() & 0xFFFF) + "\n");
sb.append("\tbDeviceClass: 0x"
- + Integer.toHexString(devDesc.bDeviceClass & 0xFF) + "\n");
+ + Integer.toHexString(devDesc.getBDeviceClass() & 0xFF) + "\n");
sb.append("\tbDeviceSubClass: 0x"
- + Integer.toHexString(devDesc.bDeviceSubClass & 0xFF)
+ + Integer.toHexString(devDesc.getBDeviceSubClass() & 0xFF)
+ "\n");
sb.append("\tbDeviceProtocol: 0x"
- + Integer.toHexString(devDesc.bDeviceProtocol & 0xFF)
+ + Integer.toHexString(devDesc.getBDeviceProtocol() & 0xFF)
+ "\n");
sb.append("\tbMaxPacketSize0: 0x"
- + Integer.toHexString(devDesc.bMaxPacketSize0 & 0xFF)
- + " (" + devDesc.bMaxPacketSize0 + ")\n");
+ + Integer.toHexString(devDesc.getBMaxPacketSize0() & 0xFF)
+ + " (" + devDesc.getBMaxPacketSize0() + ")\n");
sb.append("\tidVendor: 0x"
- + Integer.toHexString(devDesc.idVendor & 0xFFFF) + "\n");
+ + Integer.toHexString(devDesc.getIdVendor() & 0xFFFF) + "\n");
sb.append("\tidProduct: 0x"
- + Integer.toHexString(devDesc.idProduct & 0xFFFF) + "\n");
+ + Integer.toHexString(devDesc.getIdProduct() & 0xFFFF) + "\n");
sb.append("\tbcdDevice: 0x"
- + Integer.toHexString(devDesc.bcdDevice) + "\n");
+ + Integer.toHexString(devDesc.getBcdDevice()) + "\n");
sb.append("\tiManufacturer: 0x"
- + Integer.toHexString(devDesc.iManufacturer) + "\n");
- sb.append("\tiProduct: 0x" + Integer.toHexString(devDesc.iProduct)
+ + Integer.toHexString(devDesc.getIManufacturer()) + "\n");
+ sb.append("\tiProduct: 0x" + Integer.toHexString(devDesc.getIProduct())
+ "\n");
sb.append("\tiSerialNumber: 0x"
- + Integer.toHexString(devDesc.iSerialNumber) + "\n");
+ + Integer.toHexString(devDesc.getISerialNumber()) + "\n");
sb.append("\tbNumConfigurations: 0x"
- + Integer.toHexString(devDesc.bNumConfigurations) + "\n");
+ + Integer.toHexString(devDesc.getBNumConfigurations()) + "\n");
// get device handle to retrieve string descriptors
Usb_Bus bus = rootBus;
while (bus != null) {
- Usb_Device dev = bus.devices;
+ Usb_Device dev = bus.getDevices();
while (dev != null) {
- Usb_Device_Descriptor tmpDevDesc = dev.descriptor;
- if ((dev.descriptor != null)
- && ((dev.descriptor.iManufacturer > 0)
- || (dev.descriptor.iProduct > 0) || (dev.descriptor.iSerialNumber > 0))) {
+ Usb_Device_Descriptor tmpDevDesc = dev.getDescriptor();
+ if ((dev.getDescriptor() != null)
+ && ((dev.getDescriptor().getIManufacturer() > 0)
+ || (dev.getDescriptor().getIProduct() > 0) || (dev.getDescriptor().getISerialNumber() > 0))) {
if (tmpDevDesc.equals(devDesc)) {
int handle = LibusbJava.usb_open(dev);
sb.append("\nString descriptors\n");
@@ -232,27 +232,27 @@ public class UsbTreeModel implements TreeModel, TreeSelectionListener {
sb.append("\terror opening the device\n");
break;
}
- if (dev.descriptor.iManufacturer > 0) {
+ if (dev.getDescriptor().getIManufacturer() > 0) {
String manufacturer = LibusbJava
.usb_get_string_simple(handle,
- devDesc.iManufacturer);
+ devDesc.getIManufacturer());
if (manufacturer == null)
manufacturer = "unable to fetch manufacturer string";
sb.append("\tiManufacturer: " + manufacturer
+ "\n");
}
- if (dev.descriptor.iProduct > 0) {
+ if (dev.getDescriptor().getIProduct() > 0) {
String product = LibusbJava
.usb_get_string_simple(handle,
- devDesc.iProduct);
+ devDesc.getIProduct());
if (product == null)
product = "unable to fetch product string";
sb.append("\tiProduct: " + product + "\n");
}
- if (dev.descriptor.iSerialNumber > 0) {
+ if (dev.getDescriptor().getISerialNumber() > 0) {
String serialNumber = LibusbJava
.usb_get_string_simple(handle,
- devDesc.iSerialNumber);
+ devDesc.getISerialNumber());
if (serialNumber == null)
serialNumber = "unable to fetch serial number string";
sb.append("\tiSerialNumber: " + serialNumber
@@ -261,41 +261,41 @@ public class UsbTreeModel implements TreeModel, TreeSelectionListener {
LibusbJava.usb_close(handle);
}
}
- dev = dev.next;
+ dev = dev.getNext();
}
- bus = bus.next;
+ bus = bus.getNext();
}
textArea.setText(sb.toString());
} else if (component instanceof Usb_Config_Descriptor) {
Usb_Config_Descriptor confDesc = (Usb_Config_Descriptor) component;
StringBuffer sb = new StringBuffer("Usb_Config_Descriptor\n");
- sb.append("\tblenght: 0x" + Integer.toHexString(confDesc.bLength)
+ sb.append("\tblenght: 0x" + Integer.toHexString(confDesc.getBLength())
+ "\n");
sb.append("\tbDescriptorType: 0x"
- + Integer.toHexString(confDesc.bDescriptorType) + "\n");
+ + Integer.toHexString(confDesc.getBDescriptorType()) + "\n");
sb.append("\tbNumInterfaces: 0x"
- + Integer.toHexString(confDesc.bNumInterfaces) + "\n");
+ + Integer.toHexString(confDesc.getBNumInterfaces()) + "\n");
sb.append("\tbConfigurationValue: 0x"
- + Integer.toHexString(confDesc.bConfigurationValue) + "\n");
+ + Integer.toHexString(confDesc.getBConfigurationValue()) + "\n");
sb.append("\tiConfiguration: 0x"
- + Integer.toHexString(confDesc.iConfiguration) + "\n");
+ + Integer.toHexString(confDesc.getIConfiguration()) + "\n");
sb.append("\tbmAttributes: 0x"
- + Integer.toHexString(confDesc.bmAttributes & 0xFF) + "\n");
+ + Integer.toHexString(confDesc.getBmAttributes() & 0xFF) + "\n");
sb.append("\tMaxPower [mA]: 0x"
- + Integer.toHexString(confDesc.MaxPower & 0xFF) + " ("
- + confDesc.MaxPower + ")\n");
- sb.append("\textralen: 0x" + Integer.toHexString(confDesc.extralen)
+ + Integer.toHexString(confDesc.getMaxPower() & 0xFF) + " ("
+ + confDesc.getMaxPower() + ")\n");
+ sb.append("\textralen: 0x" + Integer.toHexString(confDesc.getExtralen())
+ "\n");
- sb.append("\textra: " + confDesc.extra + "\n");
+ sb.append("\textra: " + confDesc.getExtra() + "\n");
// get device handle to retrieve string descriptors
Usb_Bus bus = rootBus;
while (bus != null) {
- Usb_Device dev = bus.devices;
+ Usb_Device dev = bus.getDevices();
while (dev != null) {
- Usb_Config_Descriptor[] tmpConfDesc = dev.config;
+ Usb_Config_Descriptor[] tmpConfDesc = dev.getConfig();
for (int i = 0; i < tmpConfDesc.length; i++) {
if ((tmpConfDesc.equals(confDesc))
- && (confDesc.iConfiguration > 0)) {
+ && (confDesc.getIConfiguration() > 0)) {
int handle = LibusbJava.usb_open(dev);
sb.append("\nString descriptors\n");
if (handle <= 0) {
@@ -304,7 +304,7 @@ public class UsbTreeModel implements TreeModel, TreeSelectionListener {
}
String configuration = LibusbJava
.usb_get_string_simple(handle,
- confDesc.iConfiguration);
+ confDesc.getIConfiguration());
if (configuration == null)
configuration = "unable to fetch configuration string";
sb.append("\tiConfiguration: " + configuration
@@ -314,58 +314,58 @@ public class UsbTreeModel implements TreeModel, TreeSelectionListener {
}
}
- dev = dev.next;
+ dev = dev.getNext();
}
- bus = bus.next;
+ bus = bus.getNext();
}
textArea.setText(sb.toString());
} else if (component instanceof Usb_Interface) {
Usb_Interface int_ = (Usb_Interface) component;
StringBuffer sb = new StringBuffer("Usb_Interface\n");
sb.append("\tnum_altsetting: 0x"
- + Integer.toHexString(int_.num_altsetting) + "\n");
- sb.append("\taltsetting: " + int_.altsetting + "\n");
+ + Integer.toHexString(int_.getNumAltsetting()) + "\n");
+ sb.append("\taltsetting: " + int_.getAltsetting() + "\n");
textArea.setText(sb.toString());
} else if (component instanceof Usb_Interface_Descriptor) {
Usb_Interface_Descriptor intDesc = (Usb_Interface_Descriptor) component;
StringBuffer sb = new StringBuffer("Usb_Interface_Descriptor\n");
- sb.append("\tblenght: 0x" + Integer.toHexString(intDesc.bLength)
+ sb.append("\tblenght: 0x" + Integer.toHexString(intDesc.getBLength())
+ "\n");
sb.append("\tbDescriptorType: 0x"
- + Integer.toHexString(intDesc.bDescriptorType) + "\n");
+ + Integer.toHexString(intDesc.getBDescriptorType()) + "\n");
sb.append("\tbInterfaceNumber: 0x"
- + Integer.toHexString(intDesc.bInterfaceNumber) + "\n");
+ + Integer.toHexString(intDesc.getBInterfaceNumber()) + "\n");
sb.append("\tbAlternateSetting: 0x"
- + Integer.toHexString(intDesc.bAlternateSetting) + "\n");
+ + Integer.toHexString(intDesc.getBAlternateSetting()) + "\n");
sb.append("\tbNumEndpoints: 0x"
- + Integer.toHexString(intDesc.bNumEndpoints) + "\n");
+ + Integer.toHexString(intDesc.getBNumEndpoints()) + "\n");
sb.append("\tbInterfaceClass: 0x"
- + Integer.toHexString(intDesc.bInterfaceClass & 0xFF)
+ + Integer.toHexString(intDesc.getBInterfaceClass() & 0xFF)
+ "\n");
sb.append("\tbInterfaceSubClass: 0x"
- + Integer.toHexString(intDesc.bInterfaceSubClass & 0xFF)
+ + Integer.toHexString(intDesc.getBInterfaceSubClass() & 0xFF)
+ "\n");
sb.append("\tbInterfaceProtocol: 0x"
- + Integer.toHexString(intDesc.bInterfaceProtocol & 0xFF)
+ + Integer.toHexString(intDesc.getBInterfaceProtocol() & 0xFF)
+ "\n");
sb.append("\tiInterface: 0x"
- + Integer.toHexString(intDesc.iInterface) + "\n");
- sb.append("\textralen: 0x" + Integer.toHexString(intDesc.extralen)
+ + Integer.toHexString(intDesc.getIInterface()) + "\n");
+ sb.append("\textralen: 0x" + Integer.toHexString(intDesc.getExtralen())
+ "\n");
- sb.append("\textra: " + intDesc.extra + "\n");
+ sb.append("\textra: " + intDesc.getExtra() + "\n");
// get device handle to retrieve string descriptors
Usb_Bus bus = rootBus;
while (bus != null) {
- Usb_Device dev = bus.devices;
+ Usb_Device dev = bus.getDevices();
while (dev != null) {
- Usb_Config_Descriptor[] confDescs = dev.config;
+ Usb_Config_Descriptor[] confDescs = dev.getConfig();
for (int i = 0; i < confDescs.length; i++) {
- Usb_Interface[] ints = confDescs[i].interface_;
+ Usb_Interface[] ints = confDescs[i].getInterface();
for (int j = 0; j < ints.length; j++) {
- Usb_Interface_Descriptor[] tmpIntDescs = ints[j].altsetting;
+ Usb_Interface_Descriptor[] tmpIntDescs = ints[j].getAltsetting();
for (int k = 0; k < ints.length; k++) {
if (tmpIntDescs[i].equals(intDesc)
- && (intDesc.iInterface > 0)) {
+ && (intDesc.getIInterface() > 0)) {
int handle = LibusbJava.usb_open(dev);
sb.append("\nString descriptors\n");
if (handle <= 0) {
@@ -375,7 +375,7 @@ public class UsbTreeModel implements TreeModel, TreeSelectionListener {
}
String interface_ = LibusbJava
.usb_get_string_simple(handle,
- intDesc.iInterface);
+ intDesc.getIInterface());
if (interface_ == null)
interface_ = "unable to fetch interface string";
sb.append("\tiInterface: " + interface_
@@ -385,35 +385,35 @@ public class UsbTreeModel implements TreeModel, TreeSelectionListener {
}
}
}
- dev = dev.next;
+ dev = dev.getNext();
}
- bus = bus.next;
+ bus = bus.getNext();
}
textArea.setText(sb.toString());
} else if (component instanceof Usb_Endpoint_Descriptor) {
Usb_Endpoint_Descriptor epDesc = (Usb_Endpoint_Descriptor) component;
StringBuffer sb = new StringBuffer("Usb_Endpoint_Descriptor\n");
- sb.append("\tblenght: 0x" + Integer.toHexString(epDesc.bLength)
+ sb.append("\tblenght: 0x" + Integer.toHexString(epDesc.getBLength())
+ "\n");
sb.append("\tbDescriptorType: 0x"
- + Integer.toHexString(epDesc.bDescriptorType) + "\n");
+ + Integer.toHexString(epDesc.getBDescriptorType()) + "\n");
sb.append("\tbEndpointAddress: 0x"
- + Integer.toHexString(epDesc.bEndpointAddress & 0xFF)
+ + Integer.toHexString(epDesc.getBEndpointAddress() & 0xFF)
+ "\n");
sb.append("\tbmAttributes: 0x"
- + Integer.toHexString(epDesc.bmAttributes & 0xFF) + "\n");
+ + Integer.toHexString(epDesc.getBmAttributes() & 0xFF) + "\n");
sb.append("\twMaxPacketSize: 0x"
- + Integer.toHexString(epDesc.wMaxPacketSize & 0xFFFF)
- + " (" + epDesc.wMaxPacketSize + ")\n");
- sb.append("\tbInterval: 0x" + Integer.toHexString(epDesc.bInterval)
+ + Integer.toHexString(epDesc.getWMaxPacketSize() & 0xFFFF)
+ + " (" + epDesc.getWMaxPacketSize() + ")\n");
+ sb.append("\tbInterval: 0x" + Integer.toHexString(epDesc.getBInterval())
+ "\n");
- sb.append("\tbRefresh: 0x" + Integer.toHexString(epDesc.bRefresh)
+ sb.append("\tbRefresh: 0x" + Integer.toHexString(epDesc.getBRefresh())
+ "\n");
sb.append("\tbSynchAddress: 0x"
- + Integer.toHexString(epDesc.bSynchAddress) + "\n");
- sb.append("\textralen: 0x" + Integer.toHexString(epDesc.extralen)
+ + Integer.toHexString(epDesc.getBSynchAddress()) + "\n");
+ sb.append("\textralen: 0x" + Integer.toHexString(epDesc.getExtralen())
+ "\n");
- sb.append("\textra: " + epDesc.extra + "\n");
+ sb.append("\textra: " + epDesc.getExtra() + "\n");
textArea.setText(sb.toString());
}
}
diff --git a/java/test/ch/ntb/usb/test/DeviceTest.java b/java/test/ch/ntb/usb/test/DeviceTest.java
index 98eb638..c745fae 100644
--- a/java/test/ch/ntb/usb/test/DeviceTest.java
+++ b/java/test/ch/ntb/usb/test/DeviceTest.java
@@ -72,11 +72,11 @@ public class DeviceTest {
dev.updateDescriptors();
Usb_Device_Descriptor devDescriptor = dev.getDeviceDescriptor();
assertTrue(devDescriptor != null);
- assertEquals(devinfo.getIdProduct(), devDescriptor.idProduct);
- assertEquals(devinfo.getIdVendor(), devDescriptor.idVendor);
+ assertEquals(devinfo.getIdProduct(), devDescriptor.getIdProduct());
+ assertEquals(devinfo.getIdVendor(), devDescriptor.getIdVendor());
Usb_Config_Descriptor confDescriptors[] = dev.getConfigDescriptors();
assertTrue(confDescriptors != null);
- assertTrue(confDescriptors[0].interface_.length > 0);
+ assertTrue(confDescriptors[0].getInterface().length > 0);
}
@Test