Received: from list by lists.gnu.org with archive (Exim 4.71) id 1avlbX-0004mP-Uq for mharc-grub-devel@gnu.org; Thu, 28 Apr 2016 09:03:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33965) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avlbU-0004eh-UX for grub-devel@gnu.org; Thu, 28 Apr 2016 09:03:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1avlbQ-0001aN-Rm for grub-devel@gnu.org; Thu, 28 Apr 2016 09:03:36 -0400 Received: from yes.iam.tj ([109.74.197.121]:40818 helo=iam.tj) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avlbQ-0001Zh-Mi for grub-devel@gnu.org; Thu, 28 Apr 2016 09:03:32 -0400 Received: by iam.tj (Postfix, from userid 1013) id B684734109; Thu, 28 Apr 2016 14:03:27 +0100 (BST) To: grub-devel@gnu.org Subject: How to receive notification of a new (disk) device being =?UTF-8?Q?connected=3F?= X-PHP-Originating-Script: 1013:rcmail.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 28 Apr 2016 14:03:27 +0100 From: TJ Message-ID: <3df1c98b8135d4f64b0f9c3a8fa02df6@iam.tj> X-Sender: grub-devel@iam.tj User-Agent: Roundcube Webmail/RCMAIL_VERSION X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 109.74.197.121 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2016 13:03:38 -0000 I'm currently finalising a patch that adds key-file support to cryptodisk::cryptomount and luks. As well as being able to grub_device_iterate(hook,...) to search the existing devices for the key-file the code needs to wait for TIMEOUT seconds for additional (usually USB Mass Storage) devices to be connected and when they are search them for the key-file. Is there an existing mechanism to receive such notifications, or a blocking call that returns if a device is connected or a timeout is hit? Otherwise it looks like I'll have to track which devices are connected when the TIMEOUT loop is first entered, grub_sleep(), then grub_device_iterate() and see if the device list has any new entries. Secondly: am I correct to think using grub_search_fs_file(keyfile_name, variable_name, ...) is the correct way to search for the key-file across all devices, or do I need to use a specific hint type to indicate all devices should be searched?