mirror of
https://github.com/genodelabs/genode.git
synced 2025-05-29 13:44:26 +00:00
black_hole: serve real USB sessions
* The server now answers session requests with a session instead of an exception# * The test expects a session but doesn't access it so far Ref #4419
This commit is contained in:
parent
40a5eabf88
commit
6a61b60a5d
@ -25,7 +25,3 @@ in the configuration of the component:
|
|||||||
<gpu/>
|
<gpu/>
|
||||||
<usb/>
|
<usb/>
|
||||||
</config>
|
</config>
|
||||||
|
|
||||||
Be aware, that the USB service is merely announced but always throws a
|
|
||||||
Service_denied exception when trying to request a session. This is considered
|
|
||||||
a temporary solution.
|
|
||||||
|
@ -34,6 +34,13 @@ class Black_hole::Usb_session : public Usb::Session_rpc_object
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
Usb_session(Ram_dataspace_capability tx_ds,
|
||||||
|
Entrypoint &ep,
|
||||||
|
Region_map &rm)
|
||||||
|
:
|
||||||
|
Session_rpc_object { tx_ds, ep.rpc_ep(), rm }
|
||||||
|
{ }
|
||||||
|
|
||||||
void sigh_state_change(Signal_context_capability /* sigh */) override { }
|
void sigh_state_change(Signal_context_capability /* sigh */) override { }
|
||||||
|
|
||||||
bool plugged() override { return false; }
|
bool plugged() override { return false; }
|
||||||
@ -70,17 +77,23 @@ class Black_hole::Usb_root : public Root_component<Usb_session>
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Usb_session *_create_session(char const * /* args */) override
|
Usb_session *_create_session(char const *args) override
|
||||||
{
|
{
|
||||||
/*
|
size_t const ram_quota {
|
||||||
* FIXME
|
Arg_string::find_arg(args, "ram_quota" ).ulong_value(0) };
|
||||||
*
|
|
||||||
* Currently, we're fine with a service that is routable but
|
size_t const tx_buf_size {
|
||||||
* not usable. In the long term, this exception should be removed
|
Arg_string::find_arg(args, "tx_buf_size").ulong_value(0) };
|
||||||
* and a session object should be returned that can be used as if
|
|
||||||
* it was a real USB session.
|
size_t const session_size {
|
||||||
*/
|
max<size_t>(4096, sizeof(Usb_session)) };
|
||||||
throw Service_denied { };
|
|
||||||
|
if (ram_quota < session_size + tx_buf_size) {
|
||||||
|
throw Insufficient_ram_quota { };
|
||||||
|
}
|
||||||
|
Ram_dataspace_capability tx_ds { _env.ram().alloc(tx_buf_size) };
|
||||||
|
return new (md_alloc())
|
||||||
|
Usb_session { tx_ds, _env.ep(), _env.rm() };
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* FIXME
|
* FIXME
|
||||||
*
|
*
|
||||||
* Accessing the Audio_in and Audio_out connections is yet missing.
|
* Accessing the Audio_in, Audio_out and Usb connections is yet missing.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -334,9 +334,10 @@ class Black_hole_test::Usb_test
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Env &_env;
|
Env &_env;
|
||||||
Allocator_avl _alloc;
|
Allocator_avl _alloc;
|
||||||
bool _finished { false };
|
Usb::Connection _connection { _env, &_alloc };
|
||||||
|
bool _finished { false };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -346,15 +347,7 @@ class Black_hole_test::Usb_test
|
|||||||
_env { env },
|
_env { env },
|
||||||
_alloc { &heap }
|
_alloc { &heap }
|
||||||
{
|
{
|
||||||
try {
|
_finished = true;
|
||||||
Usb::Connection connection { _env, &_alloc };
|
|
||||||
class Session_request_succeeded { };
|
|
||||||
throw Session_request_succeeded { };
|
|
||||||
|
|
||||||
} catch (Service_denied) {
|
|
||||||
|
|
||||||
_finished = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool finished() const
|
bool finished() const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user