summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm2/ecore_drm2_device.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/ecore_drm2/ecore_drm2_device.c')
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_device.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/src/lib/ecore_drm2/ecore_drm2_device.c b/src/lib/ecore_drm2/ecore_drm2_device.c
index aa8917ce4e..42a21c0742 100644
--- a/src/lib/ecore_drm2/ecore_drm2_device.c
+++ b/src/lib/ecore_drm2/ecore_drm2_device.c
@@ -593,43 +593,29 @@ _drm2_atomic_state_free(Ecore_Drm2_Atomic_State *state)
593} 593}
594 594
595EAPI Ecore_Drm2_Device * 595EAPI Ecore_Drm2_Device *
596ecore_drm2_device_find(const char *seat, unsigned int tty) 596ecore_drm2_device_open(const char *seat, unsigned int tty)
597{ 597{
598 Ecore_Drm2_Device *dev; 598 Ecore_Drm2_Device *device;
599 599
600 dev = calloc(1, sizeof(Ecore_Drm2_Device)); 600 device = calloc(1, sizeof(Ecore_Drm2_Device));
601 if (!dev) return NULL; 601 if (!device) return NULL;
602 602
603 dev->em = elput_manager_connect(seat, tty); 603 device->em = elput_manager_connect(seat, tty);
604 if (!dev->em) 604 if (!device->em)
605 { 605 {
606 ERR("Could not connect to input manager"); 606 ERR("Could not connect to input manager");
607 goto man_err; 607 goto man_err;
608 } 608 }
609 609
610 dev->path = _drm2_device_find(dev->em, seat); 610 device->path = _drm2_device_find(device->em, seat);
611 if (!dev->path) 611 if (!device->path)
612 { 612 {
613 ERR("Could not find drm device on seat %s", seat); 613 ERR("Could not find drm device on seat %s", seat);
614 goto path_err; 614 goto path_err;
615 } 615 }
616 616
617 return dev;
618
619path_err:
620 elput_manager_disconnect(dev->em);
621man_err:
622 free(dev);
623 return NULL;
624}
625
626EAPI int
627ecore_drm2_device_open(Ecore_Drm2_Device *device)
628{
629 EINA_SAFETY_ON_NULL_RETURN_VAL(device, -1);
630
631 device->fd = elput_manager_open(device->em, device->path, -1); 617 device->fd = elput_manager_open(device->em, device->path, -1);
632 if (device->fd < 0) goto open_err; 618 if (device->fd < 0) goto path_err;
633 619
634 if (!elput_input_init(device->em)) 620 if (!elput_input_init(device->em))
635 { 621 {
@@ -681,12 +667,15 @@ ecore_drm2_device_open(Ecore_Drm2_Device *device)
681 ecore_event_handler_add(ELPUT_EVENT_DEVICE_CHANGE, 667 ecore_event_handler_add(ELPUT_EVENT_DEVICE_CHANGE,
682 _cb_device_change, device); 668 _cb_device_change, device);
683 669
684 return device->fd; 670 return device;
685 671
686input_err: 672input_err:
687 elput_manager_close(device->em, device->fd); 673 elput_manager_close(device->em, device->fd);
688open_err: 674path_err:
689 return -1; 675 elput_manager_disconnect(device->em);
676man_err:
677 free(device);
678 return NULL;
690} 679}
691 680
692EAPI void 681EAPI void