public byte[] readEEPROM(DeviceHandle handle,short offset,int length) throws IllegalArgumentException {
  if (offset + length > 256) {
    throw new IllegalArgumentException("cannot read more than 256 " + "bytes from EEPROM - requested to read to byte [" + (offset + length) + "]");
  }
  byte[] data=new byte[length];
  ByteBuffer buffer=ByteBuffer.allocateDirect(1);
  try {
    writeRegister(handle,Block.I2C,EEPROM_ADDRESS,(byte)offset,1);
  }
 catch (  LibUsbException e) {
    mLog.error("usb error while attempting to set read address to " + "EEPROM register, prior to reading the EEPROM device " + "descriptor",e);
  }
  for (int x=0; x < length; x++) {
    try {
      read(handle,EEPROM_ADDRESS,Block.I2C,buffer);
      data[x]=buffer.get();
      buffer.rewind();
    }
 catch (    Exception e) {
      mLog.error("error while reading eeprom byte [" + x + "/"+ length+ "] aborting eeprom read and returning partially "+ "filled descriptor byte array",e);
      x=length;
    }
  }
  return data;
}

public byte [ ] readEEPROM ( DeviceHandle handle , short offset , int length ) throws IllegalArgumentException { if ( offset + length > 256 ) { throw new IllegalArgumentException ( "cannot read more than 256 " + "bytes from EEPROM - requested to read to byte [" + ( offset + length ) + "]" ) ; } byte [ ] data = new byte [ length ] ; ByteBuffer buffer = ByteBuffer . allocateDirect ( 1 ) ; try { writeRegister ( handle , Block . I2C , EEPROM_ADDRESS , ( byte ) offset , 1 ) ; } catch ( LibUsbException e ) { mLog . error ( "usb error while attempting to set read address to " + "EEPROM register, prior to reading the EEPROM device " + "descriptor" , e ) ; } for ( int x = 0 ; x < length ; x ++ ) { try { read ( handle , EEPROM_ADDRESS , Block . I2C , buffer ) ; data [ x ] = buffer . get ( ) ; buffer . rewind ( ) ; } catch ( Exception e ) { mLog . error ( "error while reading eeprom byte [" + x + "/" + length + "] aborting eeprom read and returning partially " + "filled descriptor byte array" , e ) ; x = length ; } } return data ; }
returns contents of the 256 - byte eeprom . the contents are as follows : 256 - byte eeprom ( in hex ) : 00 / 01 - 2832 signature 03 / 02 - 0bda vendor id 05 / 04 - 2832 product id 06 - a5 ( has serial id ? ) 07 - 16 ( bit field - bit 0 = remote wakeup , bit 1 = ir enabled 08 - 02 or 12 10 / 09 0310 etx ( 0x03 ) plus label length ( includes length and etx bytes ) 12 / 11 first utf - 16 character 14 / 13 second utf - 16 character . . . label 1 : vendor label 2 : product label 3 : serial label 4 , 5 . . . ( user defined )
