1 /* 2 * Copyright 2013, Jérôme Duval, korli@users.berlios.de. 3 * Copyright 2005, Nathan Whitehorn. 4 * 5 * Distributed under the terms of the MIT License. 6 */ 7 8 9 #include "lid_monitor.h" 10 11 #include <Messenger.h> 12 #include <Roster.h> 13 14 #include <stdio.h> 15 16 #include <RosterPrivate.h> 17 18 19 LidMonitor::LidMonitor() 20 { 21 fFD = open("/dev/power/acpi_lid/0", O_RDONLY); 22 } 23 24 25 LidMonitor::~LidMonitor() 26 { 27 if (fFD > 0) 28 close(fFD); 29 } 30 31 32 void 33 LidMonitor::HandleEvent() 34 { 35 if (fFD <= 0) 36 return; 37 38 uint8 status; 39 read(fFD, &status, 1); 40 41 if (status == 1) { 42 printf("lid status 1\n"); 43 } 44 } 45