genode/repos/libports/run/smartcard.run
Stefan Kalkowski 14d1ca17a9 Use new pc_usb_host_drv in all recipes and tests
* Switch from the legacy usb_host driver to the new PC version
  in recipes and automated tests
* Update documentation snippets
* Remove outdated, unused usb_rndis run-script

Fix genodelabs/genode#4416
2022-02-21 15:47:50 +01:00

136 lines
3.0 KiB
Plaintext

#
# Smartcard test
#
# NOTE: The vendor id and product id of the USB card reader to be used must be
# configured for the application and for the USB driver.
#
if {[have_include "power_on/qemu"] || [have_spec linux]} {
puts "Run script does not support Qemu or Linux"
exit 0
}
assert_spec x86_64
#
# Please configure your reader's vendor and product IDs here
#
proc smartcard_vendor_id {} { return "0x04e6" }
proc smartcard_product_id {} { return "0x5116" }
#
# Build
#
set build_components {
core init timer
drivers/usb_host
test/smartcard
lib/vfs/libusb
lib/vfs/pipe
}
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
build $build_components
create_boot_directory
#
# Generate config
#
append config {
<config>
<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>
<default caps="100"/>}
append_platform_drv_config
append config {
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="report_rom">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Report"/> <service name="ROM"/> </provides>
<config verbose="no">
<default-policy report="usb_drv -> devices"/>
</config>
</start>
<start name="usb_drv" caps="200">
<binary name="} [usb_host_drv_binary] {"/>
<resource name="RAM" quantum="16M"/>
<provides><service name="Usb"/></provides>
<config bios_handoff="yes">
<report devices="yes"/>
<policy label="test-smartcard -> usb_device"
vendor_id="} [smartcard_vendor_id] {" product_id="} [smartcard_product_id] {"/>
</config>
<route>
<service name="Report"> <child name="report_rom"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="test-smartcard" caps="150">
<resource name="RAM" quantum="4M"/>
<config>
<vfs>
<dir name="dev">
<log/>
<inline name="rtc">2018-01-01 00:01</inline>
<libusb/>
</dir>
<dir name="pipe"> <pipe/> </dir>
<dir name="ifd-ccid.bundle">
<dir name="Contents">
<rom name="Info.plist"/>
</dir>
</dir>
</vfs>
<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc" pipe="/pipe"/>
<env key="LIBUSB_DEBUG" value="1"/> <!-- log libusb errors -->
</config>
</start>
</config>}
install_config $config
#
# Boot modules
#
# generic modules
set boot_modules {
core init timer test-smartcard
ld.lib.so pcsc-lite.lib.so ccid.lib.so libusb.lib.so
libc.lib.so vfs.lib.so libm.lib.so posix.lib.so
Info.plist vfs_libusb.lib.so vfs_pipe.lib.so
}
lappend boot_modules [usb_host_drv_binary]
append_platform_drv_boot_modules
build_boot_image $boot_modules
run_genode_until { Response: 62 0A 82 01 38 83 02 3F 00 8A 01 05 90 00} 30
exec rm bin/Info.plist