null pointer exception when calling setManufacturer with filename fixed
java doc updates new test for many read/write operations git-svn-id: https://svn.code.sf.net/p/libusbjava/code/trunk@271 94ad28fe-ef68-46b1-9651-e7ae4fcf1c4c
This commit is contained in:
@@ -170,12 +170,15 @@ public class Device {
|
||||
* endpoints are found in the descriptors an exception is thrown.
|
||||
*
|
||||
* @param configuration
|
||||
* the configuration
|
||||
* the configuration, see
|
||||
* {@link Usb_Config_Descriptor#getBConfigurationValue()}
|
||||
* @param interface_
|
||||
* the interface
|
||||
* the interface, see
|
||||
* {@link Usb_Interface_Descriptor#getBInterfaceNumber()}
|
||||
* @param altinterface
|
||||
* the alternate interface. If no alternate interface must be set
|
||||
* <i>-1</i> can be used.
|
||||
* the alternate interface, see
|
||||
* {@link Usb_Interface_Descriptor#getBAlternateSetting()}. If
|
||||
* no alternate interface must be set <i>-1</i> can be used.
|
||||
* @throws USBException
|
||||
*/
|
||||
public void open(int configuration, int interface_, int altinterface)
|
||||
|
||||
@@ -203,7 +203,7 @@ public class USB {
|
||||
*
|
||||
* @param idVendor
|
||||
* @param idProduct
|
||||
* @return
|
||||
* @return a newly created device or an already registered device
|
||||
*/
|
||||
public static Device getDevice(short idVendor, short idProduct) {
|
||||
return getDevice(idVendor, idProduct, null);
|
||||
@@ -225,7 +225,8 @@ public class USB {
|
||||
String filename) {
|
||||
for (Iterator<Device> iter = devices.iterator(); iter.hasNext();) {
|
||||
Device dev = iter.next();
|
||||
if (filename != null && filename.compareTo(dev.getFilename()) == 0
|
||||
if (filename != null && dev.getFilename() != null
|
||||
&& filename.compareTo(dev.getFilename()) == 0
|
||||
&& dev.getIdVendor() == idVendor
|
||||
&& dev.getIdProduct() == idProduct) {
|
||||
return dev;
|
||||
|
||||
@@ -21,13 +21,13 @@ public abstract class AbstractDeviceInfo {
|
||||
|
||||
private int altinterface;
|
||||
|
||||
private int outEPBulk;
|
||||
private int outEPBulk = -1;
|
||||
|
||||
private int inEPBulk;
|
||||
private int inEPBulk = -1;
|
||||
|
||||
private int outEPInt;
|
||||
private int outEPInt = -1;
|
||||
|
||||
private int inEPInt;
|
||||
private int inEPInt = -1;
|
||||
|
||||
private int sleepTimeout;
|
||||
|
||||
@@ -37,6 +37,12 @@ public abstract class AbstractDeviceInfo {
|
||||
|
||||
private boolean compareData = true;
|
||||
|
||||
private String manufacturer = null;
|
||||
|
||||
private String product = null;
|
||||
|
||||
private String serialVersion = null;
|
||||
|
||||
public static enum TransferMode {
|
||||
Bulk, Interrupt
|
||||
}
|
||||
@@ -158,4 +164,28 @@ public abstract class AbstractDeviceInfo {
|
||||
public void setDoCompareData(boolean compareData) {
|
||||
this.compareData = compareData;
|
||||
}
|
||||
|
||||
public String getManufacturer() {
|
||||
return manufacturer;
|
||||
}
|
||||
|
||||
public void setManufacturer(String manufacturer) {
|
||||
this.manufacturer = manufacturer;
|
||||
}
|
||||
|
||||
public String getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
public void setProduct(String product) {
|
||||
this.product = product;
|
||||
}
|
||||
|
||||
public String getSerialVersion() {
|
||||
return serialVersion;
|
||||
}
|
||||
|
||||
public void setSerialVersion(String serialVersion) {
|
||||
this.serialVersion = serialVersion;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user