From 1ad00e96fe0d10c4fa9b870b42f3ea90b17a2d7f Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Fri, 1 Oct 2010 18:55:43 -0700 Subject: Wait for initial device scan to finish before updating config. This change narrows the opportunity for a race condition setting the resource Configuration while devices are being updated. Change-Id: I58efa563f4129ab0fce7108511d16a99dff7e451 --- include/ui/EventHub.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'include/ui/EventHub.h') diff --git a/include/ui/EventHub.h b/include/ui/EventHub.h index d077d0e424..d78e35fbfa 100644 --- a/include/ui/EventHub.h +++ b/include/ui/EventHub.h @@ -142,8 +142,13 @@ protected: public: // Synthetic raw event type codes produced when devices are added or removed. enum { + // Sent when a device is added. DEVICE_ADDED = 0x10000000, - DEVICE_REMOVED = 0x20000000 + // Sent when a device is removed. + DEVICE_REMOVED = 0x20000000, + // Sent when all added/removed devices from the most recent scan have been reported. + // This event is always sent at least once. + FINISHED_DEVICE_SCAN = 0x30000000, }; virtual uint32_t getDeviceClasses(int32_t deviceId) const = 0; @@ -221,10 +226,10 @@ protected: private: bool openPlatformInput(void); - int open_device(const char *device); - int close_device(const char *device); - int scan_dir(const char *dirname); - int read_notify(int nfd); + int openDevice(const char *device); + int closeDevice(const char *device); + int scanDir(const char *dirname); + int readNotify(int nfd); status_t mError; @@ -273,6 +278,7 @@ private: int mFDCount; bool mOpened; + bool mNeedToSendFinishedDeviceScan; List mExcludedDevices; // device ids that report particular switches. -- cgit v1.2.3-59-g8ed1b