public static void main(String[] args) throws Exception {
final String devId = (args.length > 0) ? args[0] : "" /*"fb0"*/;
Surface g = null;
try {
Device dev = null;
if ("".equals(devId)) {
final Collection<Device> devs = DeviceUtils.getDevicesByAPI(FrameBufferAPI.class);
int dev_count = devs.size();
if (dev_count > 0) {
Device[] dev_a = devs.toArray(new Device[dev_count]);
dev = dev_a[0];
}
}
if (dev == null) {
final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
dev = dm.getDevice(devId);
}
final FrameBufferAPI api = dev.getAPI(FrameBufferAPI.class);
final FrameBufferConfiguration conf = api.getConfigurations()[0];
g = api.open(conf);
TextScreenConsoleManager mgr = new TextScreenConsoleManager();
ScrollableTextScreen ts = new FBConsole.FBPcTextScreen(g).createCompatibleScrollableBufferScreen(500);
ScrollableTextScreenConsole first =
new ScrollableTextScreenConsole(mgr, "console", ts,
ConsoleManager.CreateOptions.TEXT |
ConsoleManager.CreateOptions.SCROLLABLE);
mgr.registerConsole(first);
mgr.focus(first);
new CommandShell(first).run();
Thread.sleep(60 * 1000);
} catch (Throwable ex) {
log.error("Error in FBConsole", ex);
} finally {
if (g != null) {
log.info("Close graphics");
g.close();
}
}
}