* How to receive notification of a new (disk) device being connected?
@ 2016-04-28 13:03 TJ
2016-04-28 17:55 ` Andrei Borzenkov
0 siblings, 1 reply; 2+ messages in thread
From: TJ @ 2016-04-28 13:03 UTC (permalink / raw)
To: grub-devel
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?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to receive notification of a new (disk) device being connected?
2016-04-28 13:03 How to receive notification of a new (disk) device being connected? TJ
@ 2016-04-28 17:55 ` Andrei Borzenkov
0 siblings, 0 replies; 2+ messages in thread
From: Andrei Borzenkov @ 2016-04-28 17:55 UTC (permalink / raw)
To: The development of GNU GRUB
28.04.2016 16:03, TJ пишет:
> 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?
>
No. GRUB depends on firmware for disk access and not every firmware
supports hotplugging in the first place.
> 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?
>
Hints are used to optimize search - if you can guess firmware device
name, you avoid need to search across all devices. But it is in no way
mandatory, and search should work without it.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-28 17:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-28 13:03 How to receive notification of a new (disk) device being connected? TJ
2016-04-28 17:55 ` Andrei Borzenkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).