Skip to content

Instantly share code, notes, and snippets.

@theterg
Created February 22, 2013 22:49
Show Gist options
  • Save theterg/5017229 to your computer and use it in GitHub Desktop.
Save theterg/5017229 to your computer and use it in GitHub Desktop.
BUG OSGI java reset a BMI port
public void run(Map<Object, Object> services) {
IVonHippelModuleControl vh = (IVonHippelModuleControl) services.get(IVonHippelModuleControl.class.getName());
System.out.println("sysfstest start");
try {
vh.setIOX(0);
vh.setIOX(1);
vh.setIOX(2);
vh.setIOX(3);
} catch (IOException e) { e.printStackTrace(); }
try {
Thread.sleep(1000);
System.out.println("attempting to suspend");
FileWriter fs = new FileWriter("/sys/bus/bmi/devices/bmi-dev-0/suspend");
fs.write("1");
fs.flush();
Thread.sleep(1000);
System.out.println("attempting to wake up");
fs.write("0");
fs.flush();
} catch (IOException e) { e.printStackTrace();
} catch (InterruptedException e) { }
System.out.println("turning LEDs back on");
try {
vh.setIOX(0);
vh.setIOX(1);
vh.setIOX(2);
vh.setIOX(3);
} catch (IOException e) { e.printStackTrace(); }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment