mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 21:57:55 +00:00
sculpt: improve USB hotplug handling
- Don't reset sculpt partition on USB changes whenever ram fs is selected for use. - Reconfigure runtime immediately when plugging USB devices. This prevents the usb-block driver and part_block from dangling in the graph. They disappear immediately now.
This commit is contained in:
parent
a90eab8b9a
commit
ab5770c492
@ -147,6 +147,8 @@ struct Sculpt::Usb_storage_device_update_policy
|
||||
Env &_env;
|
||||
Allocator &_alloc;
|
||||
|
||||
bool device_added_or_vanished = false;
|
||||
|
||||
Signal_context_capability _sigh;
|
||||
|
||||
Usb_storage_device_update_policy(Env &env, Allocator &alloc,
|
||||
@ -157,10 +159,17 @@ struct Sculpt::Usb_storage_device_update_policy
|
||||
|
||||
typedef Usb_storage_device::Label Label;
|
||||
|
||||
void destroy_element(Usb_storage_device &elem) { destroy(_alloc, &elem); }
|
||||
void destroy_element(Usb_storage_device &elem)
|
||||
{
|
||||
device_added_or_vanished = true;
|
||||
|
||||
destroy(_alloc, &elem);
|
||||
}
|
||||
|
||||
Usb_storage_device &create_element(Xml_node node)
|
||||
{
|
||||
device_added_or_vanished = true;
|
||||
|
||||
return *new (_alloc)
|
||||
Usb_storage_device(_env, _alloc, _sigh,
|
||||
node.attribute_value("label_suffix", Label()));
|
||||
|
@ -41,6 +41,9 @@ void Sculpt::Storage::handle_storage_devices_update()
|
||||
|
||||
_storage_devices.update_usb_storage_devices_from_xml(policy, raw);
|
||||
|
||||
if (policy.device_added_or_vanished)
|
||||
reconfigure_runtime = true;
|
||||
|
||||
_storage_devices.usb_storage_devices.for_each([&] (Usb_storage_device &dev) {
|
||||
|
||||
dev.process_driver_report();
|
||||
@ -66,7 +69,12 @@ void Sculpt::Storage::handle_storage_devices_update()
|
||||
* target to use.
|
||||
*/
|
||||
if (_sculpt_partition.valid()) {
|
||||
|
||||
bool sculpt_partition_exists = false;
|
||||
|
||||
if (_sculpt_partition.ram_fs())
|
||||
sculpt_partition_exists = true;
|
||||
|
||||
_storage_devices.for_each([&] (Storage_device const &device) {
|
||||
device.for_each_partition([&] (Partition const &partition) {
|
||||
if (device.label == _sculpt_partition.device
|
||||
|
Loading…
Reference in New Issue
Block a user