mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-15 13:48:17 +00:00
committed by
Norman Feske
parent
873eb687b0
commit
b7a379546e
@ -140,6 +140,8 @@ class Root : public Root_component<genode_usb_session>
|
|||||||
Env & _env;
|
Env & _env;
|
||||||
Signal_context_capability _sigh_cap;
|
Signal_context_capability _sigh_cap;
|
||||||
Attached_rom_dataspace _config { _env, "config" };
|
Attached_rom_dataspace _config { _env, "config" };
|
||||||
|
Signal_handler<Root> _config_handler { _env.ep(), *this,
|
||||||
|
&Root::_announce_service };
|
||||||
Reporter _reporter { _env, "devices" };
|
Reporter _reporter { _env, "devices" };
|
||||||
Constructible<Device> _devices[MAX_DEVICES];
|
Constructible<Device> _devices[MAX_DEVICES];
|
||||||
List<List_element<genode_usb_session>> _sessions {};
|
List<List_element<genode_usb_session>> _sessions {};
|
||||||
@ -180,6 +182,8 @@ class Root : public Root_component<genode_usb_session>
|
|||||||
*/
|
*/
|
||||||
bool _matches(Device & d, genode_usb_session & s);
|
bool _matches(Device & d, genode_usb_session & s);
|
||||||
|
|
||||||
|
void _announce_service();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Root(Env & env, Allocator & alloc, Signal_context_capability);
|
Root(Env & env, Allocator & alloc, Signal_context_capability);
|
||||||
@ -546,6 +550,27 @@ void ::Root::_report()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ::Root::_announce_service()
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Defer the startup of the USB driver until the first configuration
|
||||||
|
* becomes available. This is needed in scenarios where the configuration
|
||||||
|
* is dynamically generated and supplied to the USB driver via the
|
||||||
|
* report-ROM service.
|
||||||
|
*/
|
||||||
|
_config.update();
|
||||||
|
|
||||||
|
if (_announced)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_config.xml().type() == "config") {
|
||||||
|
log(_config.xml());
|
||||||
|
_env.parent().announce(_env.ep().manage(*this));
|
||||||
|
_announced = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ::Root::announce_device(unsigned long vendor,
|
void ::Root::announce_device(unsigned long vendor,
|
||||||
unsigned long product,
|
unsigned long product,
|
||||||
unsigned long cla,
|
unsigned long cla,
|
||||||
@ -557,10 +582,7 @@ void ::Root::announce_device(unsigned long vendor,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
_devices[idx].construct(vendor, product, cla, bus, dev);
|
_devices[idx].construct(vendor, product, cla, bus, dev);
|
||||||
if (!_announced) {
|
_announce_service();
|
||||||
_env.parent().announce(_env.ep().manage(*this));
|
|
||||||
_announced = true;
|
|
||||||
}
|
|
||||||
_report();
|
_report();
|
||||||
|
|
||||||
_for_each_session([&] (genode_usb_session & s) {
|
_for_each_session([&] (genode_usb_session & s) {
|
||||||
@ -637,6 +659,7 @@ bool ::Root::device_associated(genode_usb_session * session,
|
|||||||
{
|
{
|
||||||
/* Reserve id zero which is invalid */
|
/* Reserve id zero which is invalid */
|
||||||
_id_alloc.alloc();
|
_id_alloc.alloc();
|
||||||
|
_config.sigh(_config_handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user