summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm/ecore_drm_tty.c
diff options
context:
space:
mode:
authorSeunghun Lee <shiin.lee@samsung.com>2014-12-10 08:03:44 -0500
committerChris Michael <cp.michael@samsung.com>2014-12-10 08:03:50 -0500
commitfed49b9709daf57a9a346eeebe6403183e9b3d45 (patch)
treeadbb2f9bcc56a39a62385d644c46035f6606be1e /src/lib/ecore_drm/ecore_drm_tty.c
parent7ac40208748c438ae144ca0adebc0cd7df0ba1ab (diff)
ecore-drm: restore VT to text mode when close tty.
Summary: if ecore-drm failed to be run after changing tty mode, need to restore VT to text mode. Test Plan: - run enlightenment(drm backend) without systemd. after changing tty graphics mode, if it's failed to be run by any reason, you'll see black screen and coulnd't control session. @fix Reviewers: devilhorns Reviewed By: devilhorns Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D1764
Diffstat (limited to 'src/lib/ecore_drm/ecore_drm_tty.c')
-rw-r--r--src/lib/ecore_drm/ecore_drm_tty.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/lib/ecore_drm/ecore_drm_tty.c b/src/lib/ecore_drm/ecore_drm_tty.c
index 86482e2f06..6b3652fbce 100644
--- a/src/lib/ecore_drm/ecore_drm_tty.c
+++ b/src/lib/ecore_drm/ecore_drm_tty.c
@@ -254,6 +254,24 @@ ecore_drm_tty_open(Ecore_Drm_Device *dev, const char *name)
254 return EINA_TRUE; 254 return EINA_TRUE;
255} 255}
256 256
257static void
258_ecore_drm_tty_restore(Ecore_Drm_Device *dev)
259{
260 int fd = dev->tty.fd;
261 struct vt_mode mode = { 0 };
262
263 if (fd < 0) return;
264
265 if (ioctl(fd, KDSETMODE, KD_TEXT))
266 ERR("Could not set KD_TEXT mode on tty: %m\n");
267
268 ecore_drm_device_master_drop(dev);
269
270 mode.mode = VT_AUTO;
271 if (ioctl(fd, VT_SETMODE, &mode) < 0)
272 ERR("Could not reset VT handling\n");
273}
274
257/** 275/**
258 * Close an already opened tty 276 * Close an already opened tty
259 * 277 *
@@ -269,6 +287,8 @@ ecore_drm_tty_close(Ecore_Drm_Device *dev)
269 /* check for valid device */ 287 /* check for valid device */
270 if ((!dev) || (!dev->drm.name)) return EINA_FALSE; 288 if ((!dev) || (!dev->drm.name)) return EINA_FALSE;
271 289
290 _ecore_drm_tty_restore(dev);
291
272 close(dev->tty.fd); 292 close(dev->tty.fd);
273 293
274 dev->tty.fd = -1; 294 dev->tty.fd = -1;