1
0
mirror of git://projects.qi-hardware.com/iris.git synced 2024-12-28 12:39:52 +02:00

working usbfs

This commit is contained in:
Bas Wijnen 2010-01-18 07:31:19 +01:00
parent 8e6efaeb36
commit 5ef2934bf8

View File

@ -364,25 +364,28 @@ void handle_init ():
Kernel::wait ()
switch Kernel::recv.data[0].l:
case Parent::PROVIDE_DEVICE:
Dev::add (Kernel::recv.data[1].l, Kernel::recv.data[0].h, Kernel::get_arg ())
kdebug ("added dev ")
kdebug ("adding dev ")
kdebug_num (Kernel::recv.data[1].l)
kdebug (":")
kdebug_num (Kernel::recv.data[0].h)
kdebug ("\n")
Kernel::recv.reply.invoke ()
Kernel::Cap reply = Kernel::get_reply ()
Dev::add (Kernel::recv.data[1].l, Kernel::recv.data[0].h, Kernel::get_arg ())
reply.invoke ()
Kernel::free_cap (reply)
break
case Parent::GET_DEVICE:
Kernel::Cap reply = Kernel::get_reply ()
Dev *d = Dev::find (Kernel::recv.data[1].l, Kernel::recv.data[0].h)
if d:
kdebug ("given dev ")
kdebug ("giving dev ")
kdebug_num (Kernel::recv.data[1].l)
kdebug (":")
kdebug_num (Kernel::recv.data[0].h)
kdebug ("\n")
Kernel::Cap cap = d->dev.create_user (Kernel::my_memory)
d->dev.use (cap)
Kernel::recv.reply.invoke (0, 0, cap.copy ())
reply.invoke (0, 0, cap.copy ())
Kernel::free_cap (cap)
else:
kdebug ("device not found: ")
@ -391,11 +394,11 @@ void handle_init ():
kdebug_num (Kernel::recv.data[0].h)
Dev::kdebug_list ()
kdebug ("\n")
Kernel::recv.reply.invoke (~0, ~0)
reply.invoke (~0, ~0)
Kernel::panic (0)
Kernel::free_cap (reply)
break
case Parent::INIT_DONE:
kdebug ("init done\n")
return
default:
kdebug ("unknown init request\n")
@ -404,7 +407,7 @@ void handle_init ():
Kernel::Num start ():
// Wait for the debugging device to be active, in case there is one.
Kernel::schedule ()
//Dev::devs = NULL
Dev::devs = NULL
init_alloc ()
top_memory = Kernel::get_top_memory ()
Directory root = receive_devices ()
@ -419,6 +422,7 @@ Kernel::Num start ():
run (&files[index[i]], files[index[i]].name[0] == '#')
kdebug ("running\n")
handle_init ()
kdebug ("init done\n")
root.unlock_ro ()
Kernel::free_slot (slot)
Kernel::my_memory.destroy (caps)