2016-10-12 15:55:32 +00:00
|
|
|
#
|
|
|
|
# This run script tests the VirtualBox USB device pass-through feature
|
|
|
|
# by running the 'usb_hid' test in a VM.
|
|
|
|
#
|
|
|
|
# See 'usb_hid.run' for more information about the setup of the 'Pro Micro' USB
|
|
|
|
# device for automated testing.
|
|
|
|
#
|
|
|
|
# Note: the USB device(s) to be passed through must be included in the whitelist.
|
|
|
|
#
|
|
|
|
|
2018-05-02 14:10:39 +00:00
|
|
|
if { [have_include "power_on/qemu"] || ![have_spec nova] || ![have_spec x86_64]} {
|
|
|
|
puts "Run script is only supported on 64-bit NOVA on real hardware"
|
2016-10-12 15:55:32 +00:00
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
set build_components {
|
|
|
|
drivers/framebuffer
|
2020-08-14 10:03:09 +00:00
|
|
|
drivers/ps2
|
2016-10-12 15:55:32 +00:00
|
|
|
drivers/usb
|
|
|
|
server/log_terminal
|
|
|
|
server/fs_rom
|
2020-04-20 12:00:57 +00:00
|
|
|
server/vfs lib/vfs/import
|
2016-10-12 15:55:32 +00:00
|
|
|
server/report_rom
|
|
|
|
app/usb_report_filter
|
2018-05-02 14:10:39 +00:00
|
|
|
virtualbox5
|
2016-10-12 15:55:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
source ${genode_dir}/repos/base/run/platform_drv.inc
|
|
|
|
|
|
|
|
# override defaults of platform_drv.inc
|
|
|
|
proc platform_drv_priority {} { return { priority="-1"} }
|
|
|
|
|
|
|
|
append_platform_drv_build_components
|
|
|
|
|
|
|
|
build $build_components
|
|
|
|
|
|
|
|
create_boot_directory
|
|
|
|
|
2019-03-04 12:53:40 +00:00
|
|
|
import_from_depot [depot_user]/src/[base_src] \
|
|
|
|
[depot_user]/src/init \
|
2020-07-23 13:14:54 +00:00
|
|
|
[depot_user]/src/nitpicker \
|
|
|
|
[depot_user]/src/vfs_pipe
|
2019-03-04 12:53:40 +00:00
|
|
|
|
|
|
|
|
2016-10-12 15:55:32 +00:00
|
|
|
set config {
|
|
|
|
<config prio_levels="4">
|
|
|
|
<parent-provides>
|
|
|
|
<service name="ROM"/>
|
|
|
|
<service name="IRQ"/>
|
|
|
|
<service name="IO_MEM"/>
|
|
|
|
<service name="IO_PORT"/>
|
|
|
|
<service name="PD"/>
|
|
|
|
<service name="RM"/>
|
|
|
|
<service name="CPU"/>
|
|
|
|
<service name="LOG"/>
|
|
|
|
</parent-provides>
|
|
|
|
<default-route>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</default-route>
|
2018-05-02 14:10:39 +00:00
|
|
|
<default caps="150"/>}
|
2016-10-12 15:55:32 +00:00
|
|
|
|
|
|
|
append_platform_drv_config
|
|
|
|
|
|
|
|
append config {
|
|
|
|
|
|
|
|
<start name="timer">
|
|
|
|
<resource name="RAM" quantum="1M"/>
|
|
|
|
<provides><service name="Timer"/></provides>
|
|
|
|
</start>
|
|
|
|
|
|
|
|
<start name="ps2_drv" priority="-1">
|
|
|
|
<resource name="RAM" quantum="1M"/>
|
2020-08-13 11:39:09 +00:00
|
|
|
<config/>
|
2016-10-12 15:55:32 +00:00
|
|
|
</start>
|
|
|
|
|
|
|
|
<start name="usb_config_fs" priority="-1">
|
2020-04-20 12:00:57 +00:00
|
|
|
<binary name="vfs"/>
|
2016-10-12 15:55:32 +00:00
|
|
|
<resource name="RAM" quantum="1M"/>
|
|
|
|
<provides><service name="File_system"/></provides>
|
|
|
|
<config verbose="yes">
|
2020-04-20 12:00:57 +00:00
|
|
|
<vfs>
|
|
|
|
<ram/>
|
|
|
|
<import>
|
|
|
|
<inline name="usb_drv.config">
|
2016-10-12 15:55:32 +00:00
|
|
|
<config uhci="yes" ehci="yes" xhci="yes">
|
|
|
|
<raw>
|
|
|
|
<report devices="yes"/>
|
|
|
|
</raw>
|
|
|
|
</config>
|
2020-04-20 12:00:57 +00:00
|
|
|
</inline>
|
|
|
|
<inline name="usb_report_filter.config">
|
2016-10-12 15:55:32 +00:00
|
|
|
<config>
|
|
|
|
<!-- USB device whitelist -->
|
|
|
|
<client label="virtualbox"/>
|
|
|
|
<device vendor_id="0x03eb" product_id="0x204d"/> <!-- 'Pro Micro' test device -->
|
|
|
|
</config>
|
2020-04-20 12:00:57 +00:00
|
|
|
</inline>
|
|
|
|
</import>
|
|
|
|
</vfs>
|
2016-10-12 15:55:32 +00:00
|
|
|
<policy label_prefix="usb_report_filter" root="/" writeable="yes" />
|
|
|
|
<policy label_prefix="usb_config_rom" root="/"/>
|
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
|
|
|
|
<start name="usb_config_rom" priority="-1">
|
|
|
|
<binary name="fs_rom"/>
|
|
|
|
<resource name="RAM" quantum="1200K"/>
|
|
|
|
<provides><service name="ROM"/></provides>
|
|
|
|
<route>
|
|
|
|
<service name="File_system"><child name="usb_config_fs"/></service>
|
|
|
|
<any-service><parent/><any-child/></any-service>
|
|
|
|
</route>
|
|
|
|
</start>
|
|
|
|
|
|
|
|
<start name="usb_report_filter" priority="-1">
|
|
|
|
<resource name="RAM" quantum="1200K"/>
|
|
|
|
<route>
|
|
|
|
<service name="Report"><child name="report_rom" /></service>
|
2020-05-08 14:21:20 +00:00
|
|
|
<service name="ROM" label="config">
|
|
|
|
<child name="usb_config_rom" label="usb_report_filter.config"/>
|
2016-10-12 15:55:32 +00:00
|
|
|
</service>
|
|
|
|
<service name="ROM" label="devices">
|
|
|
|
<child name="report_rom"/>
|
|
|
|
</service>
|
|
|
|
<service name="ROM" label="usb_drv_config">
|
|
|
|
<child name="report_rom"/>
|
|
|
|
</service>
|
|
|
|
<service name="File_system" label="usb_drv.config">
|
|
|
|
<child name="usb_config_fs"/>
|
|
|
|
</service>
|
|
|
|
<any-service><parent/><any-child /></any-service>
|
|
|
|
</route>
|
|
|
|
</start>
|
|
|
|
|
|
|
|
<start name="usb_drv" priority="-1">
|
|
|
|
<resource name="RAM" quantum="16M"/>
|
2020-05-08 14:21:20 +00:00
|
|
|
<provides> <service name="Usb"/> </provides>
|
2016-10-12 15:55:32 +00:00
|
|
|
<route>
|
|
|
|
<service name="IRQ"><child name="acpi_drv" /></service>
|
|
|
|
<service name="Report"> <child name="report_rom" /> </service>
|
2020-05-08 14:21:20 +00:00
|
|
|
<service name="ROM" label="config">
|
|
|
|
<child name="usb_config_rom" label="usb_drv.config"/> </service>
|
2016-10-12 15:55:32 +00:00
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
</start>
|
|
|
|
|
|
|
|
<start name="fb_drv" priority="-1">
|
2019-05-03 11:51:49 +00:00
|
|
|
<binary name="vesa_fb_drv"/>
|
2020-06-16 13:46:59 +00:00
|
|
|
<resource name="RAM" quantum="16M"/>
|
2020-07-01 20:26:11 +00:00
|
|
|
<config/>
|
2016-10-12 15:55:32 +00:00
|
|
|
</start>
|
|
|
|
|
2019-03-04 12:53:40 +00:00
|
|
|
<start name="nitpicker" priority="-1">
|
|
|
|
<resource name="RAM" quantum="12M"/>
|
2020-08-13 11:39:09 +00:00
|
|
|
<provides>
|
|
|
|
<service name="Gui"/> <service name="Capture"/> <service name="Event"/>
|
|
|
|
</provides>
|
2019-03-04 12:53:40 +00:00
|
|
|
<route>
|
|
|
|
<service name="Report"> <child name="report_rom" /> </service>
|
|
|
|
<any-service> <parent/> <any-child /> </any-service>
|
|
|
|
</route>
|
2020-08-13 15:25:21 +00:00
|
|
|
<config>
|
2020-08-13 11:39:09 +00:00
|
|
|
<capture/> <event/>
|
2019-03-04 12:53:40 +00:00
|
|
|
<report focus="yes" hover="yes" />
|
|
|
|
|
|
|
|
<domain name="pointer" layer="1" content="client" label="no" origin="pointer" />
|
|
|
|
<domain name="cpu_load" layer="2" content="client" label="no" />
|
|
|
|
<domain name="" layer="3" content="client" label="no" focus="click" hover="always" />
|
|
|
|
|
|
|
|
<policy label_prefix="pointer" domain="pointer"/>
|
|
|
|
<policy label_prefix="cpu_load_display" domain="cpu_load"/>
|
|
|
|
<default-policy domain=""/>
|
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
|
|
|
|
<start name="pointer" priority="-1">
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<provides> <service name="Report"/> </provides>
|
|
|
|
<config shapes="yes"/>
|
|
|
|
<route>
|
2020-06-11 14:06:21 +00:00
|
|
|
<service name="Gui"> <child name="nitpicker"/> </service>
|
2019-03-04 12:53:40 +00:00
|
|
|
<service name="ROM" label="hover"> <child name="report_rom"/> </service>
|
|
|
|
<service name="ROM" label="xray"> <child name="report_rom"/> </service>
|
|
|
|
<any-service> <parent/> </any-service>
|
|
|
|
</route>
|
|
|
|
</start>
|
|
|
|
|
2016-10-12 15:55:32 +00:00
|
|
|
<start name="log_terminal" priority="-1">
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<provides>
|
|
|
|
<service name="Terminal"/>
|
|
|
|
</provides>
|
|
|
|
</start>
|
|
|
|
|
|
|
|
<start name="report_rom" priority="-1">
|
|
|
|
<resource name="RAM" quantum="1M"/>
|
|
|
|
<provides> <service name="Report"/> <service name="ROM"/> </provides>
|
|
|
|
<config>
|
2019-03-04 12:53:40 +00:00
|
|
|
<policy label="pointer -> hover" report="nitpicker -> hover"/>
|
|
|
|
<policy label="pointer -> xray" report="nitpicker -> xray"/>
|
2016-11-02 10:38:20 +00:00
|
|
|
<policy label="usb_report_filter -> devices" report="usb_drv -> devices"/>
|
|
|
|
<policy label="usb_report_filter -> usb_drv_config" report="usb_drv -> config"/>
|
|
|
|
<policy label="virtualbox -> usb_devices" report="usb_report_filter -> usb_devices"/>
|
2016-10-12 15:55:32 +00:00
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
|
2018-05-02 14:10:39 +00:00
|
|
|
<start name="virtualbox" caps="800" priority="-2">
|
|
|
|
<binary name="virtualbox5-nova"/>
|
2016-10-12 15:55:32 +00:00
|
|
|
<resource name="RAM" quantum="448M"/>
|
2018-05-02 14:10:39 +00:00
|
|
|
<config vbox_file="vm_genode_usb_hid.vbox" vm_name="TestVM" xhci="yes">
|
|
|
|
<vfs>
|
2019-10-04 13:47:08 +00:00
|
|
|
<dir name="dev"> <log/> <terminal/> </dir>
|
2020-07-23 13:14:54 +00:00
|
|
|
<dir name="pipe"> <pipe/> </dir>
|
2018-05-02 14:10:39 +00:00
|
|
|
<rom name="vm_genode_usb_hid.vbox" />
|
|
|
|
<rom name="usb_hid.iso" />
|
|
|
|
</vfs>
|
2020-07-23 13:14:54 +00:00
|
|
|
<libc stdout="/dev/log" stderr="/dev/log" pipe="/pipe"/>
|
2016-10-12 15:55:32 +00:00
|
|
|
</config>
|
|
|
|
<route>
|
|
|
|
<service name="Report"><child name="report_rom" /></service>
|
2017-01-18 16:10:07 +00:00
|
|
|
<service name="ROM" label="usb_devices"> <child name="report_rom"/> </service>
|
2016-10-12 15:55:32 +00:00
|
|
|
<any-service> <parent/> <any-child /> </any-service>
|
|
|
|
</route>
|
|
|
|
</start>
|
|
|
|
</config>
|
|
|
|
}
|
|
|
|
|
|
|
|
install_config $config
|
|
|
|
|
|
|
|
puts "--- executing the 'usb_hid' run script to generate the 'usb_hid.iso' image ---"
|
|
|
|
|
|
|
|
global specs
|
|
|
|
global repositories
|
|
|
|
|
|
|
|
exec -ignorestderr \
|
|
|
|
$::argv0 \
|
|
|
|
--genode-dir [genode_dir] \
|
|
|
|
--name usb_hid \
|
|
|
|
--specs "$specs" \
|
|
|
|
--repositories "$repositories" \
|
|
|
|
--cross-dev-prefix "[cross_dev_prefix]" \
|
|
|
|
--include boot_dir/nova \
|
|
|
|
--include image/iso \
|
|
|
|
--include [repository_contains /run/usb_hid.run]/run/usb_hid.run
|
|
|
|
|
|
|
|
exec ln -sf ${genode_dir}/repos/ports/run/vm_genode_usb_hid.vbox bin/
|
2018-05-02 14:10:39 +00:00
|
|
|
exec ln -sf ../../usb_hid.iso bin/
|
2016-10-12 15:55:32 +00:00
|
|
|
|
|
|
|
set boot_modules {
|
|
|
|
core
|
|
|
|
init
|
|
|
|
timer
|
2019-05-03 11:51:49 +00:00
|
|
|
vesa_fb_drv
|
2016-10-12 15:55:32 +00:00
|
|
|
ps2_drv
|
|
|
|
log_terminal
|
|
|
|
usb_drv
|
|
|
|
usb_report_filter
|
|
|
|
fs_rom
|
2020-04-20 12:00:57 +00:00
|
|
|
vfs vfs.lib.so vfs_import.lib.so
|
2016-10-12 15:55:32 +00:00
|
|
|
report_rom
|
2018-05-02 14:10:39 +00:00
|
|
|
virtualbox5-nova
|
2016-10-12 15:55:32 +00:00
|
|
|
usb_hid.iso
|
|
|
|
vm_genode_usb_hid.vbox
|
2020-07-23 13:14:54 +00:00
|
|
|
ld.lib.so libc.lib.so libm.lib.so
|
2019-05-24 15:24:36 +00:00
|
|
|
libiconv.lib.so stdcxx.lib.so
|
2016-10-12 15:55:32 +00:00
|
|
|
qemu-usb.lib.so
|
|
|
|
}
|
|
|
|
|
|
|
|
append_platform_drv_boot_modules
|
|
|
|
|
|
|
|
build_boot_image $boot_modules
|
|
|
|
|
|
|
|
if { ![get_cmd_switch --autopilot] } { run_genode_until forever }
|
|
|
|
|
|
|
|
# autopilot test
|
|
|
|
|
2020-08-13 14:03:59 +00:00
|
|
|
run_genode_until {\[init -\> log_terminal\] \[init -\> event_dump\] Input event #0\t} 90
|
2016-10-12 15:55:32 +00:00
|
|
|
|
|
|
|
# remove everything before the first interesting line
|
2020-08-13 14:03:59 +00:00
|
|
|
regexp {(\[init -\> log_terminal\] \[init -\> event_dump\] Input event #0\t.*)} $output all output
|
2016-10-12 15:55:32 +00:00
|
|
|
|
2020-08-13 14:03:59 +00:00
|
|
|
run_genode_until {.*\[init -\> event_dump\] Input event #11.*\n} 60 [output_spawn_id]
|
2016-10-12 15:55:32 +00:00
|
|
|
|
|
|
|
unify_output { number [0-9]+} ""
|
2019-02-11 13:08:23 +00:00
|
|
|
unify_output {(?n)on usb-dummy.*$} ""
|
2016-10-12 15:55:32 +00:00
|
|
|
unify_output {(?n)using .*$} ""
|
|
|
|
unify_output {(?n)^.*__wait_event.*$} ""
|
|
|
|
unify_output {(?n)^.*Failed to submit URB.*$} ""
|
|
|
|
unify_output {(?n)^.*dev_warn.*$} ""
|
|
|
|
unify_output {(?n)^.*dangling allocation.*$} ""
|
2018-05-02 14:10:39 +00:00
|
|
|
unify_output {(?n)^.*Warning:.*$} ""
|
2016-10-12 15:55:32 +00:00
|
|
|
unify_output { [0-9][0-9][0-9][0-9]:[0-9][0-9][0-9][0-9] } " "
|
|
|
|
filter_out_color_escape_sequences
|
|
|
|
trim_lines
|
|
|
|
|
|
|
|
compare_output_to {
|
2020-08-13 14:03:59 +00:00
|
|
|
[init -> log_terminal] [init -> event_dump] Input event #0 PRESS KEY_X 65534 key count: 1
|
|
|
|
[init -> log_terminal] [init -> event_dump] Input event #1 RELEASE KEY_X key count: 0
|
|
|
|
[init -> log_terminal] [init -> event_dump] Input event #2 PRESS BTN_LEFT 65534 key count: 1
|
|
|
|
[init -> log_terminal] [init -> event_dump] Input event #3 REL_MOTION -1+0 key count: 1
|
|
|
|
[init -> log_terminal] [init -> event_dump] Input event #4 REL_MOTION +0+1 key count: 1
|
|
|
|
[init -> log_terminal] [init -> event_dump] Input event #5 RELEASE BTN_LEFT key count: 0
|
2016-10-12 15:55:32 +00:00
|
|
|
[init -> usb_drv] dev_info: USB disconnect, device
|
|
|
|
[init -> log_terminal] [init -> usb_drv] dev_info: USB disconnect, device
|
|
|
|
[init -> usb_drv] dev_info: new full-speed USB device
|
|
|
|
[init -> virtualbox] Attach USB device (vendor=3eb, product=204d)
|
|
|
|
[init -> log_terminal] [init -> usb_drv] dev_info: new full-speed USB device
|
2019-02-11 13:08:23 +00:00
|
|
|
[init -> log_terminal] [init -> usb_drv] dev_info: D L
|
|
|
|
[init -> log_terminal] [init -> usb_drv] dev_info: input: USB HID v1.11 Keyboard [D L]
|
|
|
|
[init -> log_terminal] [init -> usb_drv] dev_info: D L
|
|
|
|
[init -> log_terminal] [init -> usb_drv] dev_info: input: USB HID v1.11 Mouse [D L]
|
2020-08-13 14:03:59 +00:00
|
|
|
[init -> log_terminal] [init -> event_dump] Input event #6 PRESS KEY_X 65534 key count: 1
|
|
|
|
[init -> log_terminal] [init -> event_dump] Input event #7 RELEASE KEY_X key count: 0
|
|
|
|
[init -> log_terminal] [init -> event_dump] Input event #8 PRESS BTN_LEFT 65534 key count: 1
|
|
|
|
[init -> log_terminal] [init -> event_dump] Input event #9 REL_MOTION -1+0 key count: 1
|
|
|
|
[init -> log_terminal] [init -> event_dump] Input event #10 REL_MOTION +0+1 key count: 1
|
|
|
|
[init -> log_terminal] [init -> event_dump] Input event #11 RELEASE BTN_LEFT key count: 0
|
2016-10-12 15:55:32 +00:00
|
|
|
}
|