/** * Fetch fixed screen info. * * @return Non-changing info about the display. */ public fb_fix_screeninfo getFixedScreenInfo() throws LastErrorException { fb_fix_screeninfo info = new fb_fix_screeninfo(); super.ioctl(FBIOGET_FSCREENINFO, info.getPointer()); info.read(); return info; }
/** * Fetch variable screen info. * * @return Changeable info about the display. * @throws LastErrorException when operations fails */ public fb_var_screeninfo getVariableScreenInfo() throws LastErrorException { fb_var_screeninfo info = new fb_var_screeninfo(); super.ioctl(FBIOGET_VSCREENINFO, info.getPointer()); info.read(); return info; }
/** * Get current TTY state. * * @return TTY state. * @throws LastErrorException when the operation fails. */ public vt_stat getVTstate() throws LastErrorException { vt_stat stat = new vt_stat(); super.ioctl(VT_GETSTATE, stat.getPointer()); stat.read(); return stat; }
/** * Identify which framebuffer is connected to a specified VT. * * @param console VT number. * @return Framebuffer number or -1 if console has no framebuffer. * @throws LastErrorException when operations fails */ public int mapConsoleToFramebuffer(int console) throws LastErrorException { fb_con2fbmap map = new fb_con2fbmap(); map.console = console; map.write(); super.ioctl(FBIOGET_CON2FBMAP, map.getPointer()); map.read(); return map.framebuffer; }
/** * Send variable screen info. * * @param info Changeable info about the display. * @throws LastErrorException when operations fails */ public void setVariableScreenInfo(@NonNull fb_var_screeninfo info) throws LastErrorException { info.write(); super.ioctl(FBIOPUT_VSCREENINFO, info.getPointer()); }
/** * Get current TTY mode. TTY mode is mostly about VT switching. * * @return TTY mode. * @throws LastErrorException when the operation fails. */ public vt_mode getVTmode() throws LastErrorException { vt_mode mode = new vt_mode(); super.ioctl(VT_GETMODE, mode.getPointer()); mode.read(); return mode; }
/** * Set current TTY mode. TTY mode is mostly about VT switching. * * @param mode TTY mode. * @throws LastErrorException when the operation fails. */ public void setVTmode(@NonNull vt_mode mode) throws LastErrorException { mode.write(); super.ioctl(VT_SETMODE, mode.getPointer()); }
/** * Set console mode. * * @param mode Console mode - graphics or text mode - KD_* constants. * @throws LastErrorException when the operation fails. */ public void setConsoleMode(int mode) throws LastErrorException { super.ioctl(KDSETMODE, mode); }
/** * Basic constructor. */ protected NativeFile() { this(new NativeLibc()); }
/** * Perform a Linux style ioctl operation on the associated file. * * @param req ioctl operation to be performed * @param info input as integer * @return Linux style ioctl return * @throws LastErrorException when operations fails */ public int ioctl(int req, int info) throws LastErrorException { return libc.ioctl(fd, req, info); }
/** * Open the specified file/device for native access. * * @param fname the name of the file to open * @param flags Linux style file access flags * @throws LastErrorException when operations fails */ public void open(@NonNull String fname, int flags) throws LastErrorException { fd = libc.open(fname, flags, DEFAULT_PRIVS); }
/** * Map a portion of the device into memory and return a pointer which can be * used to read/write the device. * * @param len number of bytes to map * @return a pointer that can be used to access the device memory */ public Pointer mmap(long len) throws LastErrorException { return super.mmap(len, PROT_READ | PROT_WRITE, MAP_SHARED, 0); } }
/** * Close the associated file * * @throws LastErrorException when operations fails */ @Override public void close() throws LastErrorException { if (fd != -1) { int copy = fd; fd = -1; libc.close(copy); } }
/** * Signal VT switch to the kernel. * * @param mode VT switching signal - VT_* constants. * @throws LastErrorException when the operation fails. */ public void signalSwitch(int mode) throws LastErrorException { super.ioctl(VT_RELDISP, mode); }
/** * Create a NativeFile object and open the associated file/device * for native access. * * @param fname the name of the file to open * @param flags Linux style file access flags * @param mode Linux style file access mode * @throws LastErrorException when operations fails */ public NativeFile(@NonNull String fname, int flags, int mode) throws LastErrorException { this(fname, flags, mode, new NativeLibc()); }
/** * Perform a Linux style ioctl operation on the associated file. * * @param req ioctl operation to be performed * @param buf pointer to ioctl parameters * @return Linux style ioctl return * @throws LastErrorException when operations fails */ public int ioctl(int req, @NonNull Pointer buf) throws LastErrorException { return libc.ioctl(fd, req, buf); }
/** * Open the specified file/device for native access. * * @param fname the name of the file to open * @param flags Linux style file access flags * @param mode Linux style file access mode * @throws LastErrorException when operations fails */ public void open(@NonNull String fname, int flags, int mode) throws LastErrorException { fd = libc.open(fname, flags, mode); }
/** * Set keyboard mode. * * @param mode Keyboard mode (raw, transformed or off) - K_* constants. * @throws LastErrorException when the operation fails. */ public void setKeyboardMode(int mode) throws LastErrorException { super.ioctl(KDSKBMODE, mode); }
/** * Create a NativeFile object and open the associated file/device * for native access. * * @param fname the name of the file to open * @param flags Linux style file access flags * @throws LastErrorException when operations fails */ public NativeFile(@NonNull String fname, int flags) throws LastErrorException { this(fname, flags, new NativeLibc()); }
/** * Get current keyboard mode. * * @return Keyboard mode (raw, transformed or off) - K_* constants. * @throws LastErrorException when the operation fails. */ public int getKeyboardMode() throws LastErrorException { IntByReference kbd = new IntByReference(0); super.ioctl(KDGKBMODE, kbd); return kbd.getValue(); }