Created
February 22, 2013 22:49
-
-
Save theterg/5017229 to your computer and use it in GitHub Desktop.
BUG OSGI java reset a BMI port
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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