2016-10-20 13:47:19 +00:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
2021-01-29 12:48:00 +00:00
|
|
|
if {[have_include "power_on/qemu"] || [have_spec linux]} {
|
|
|
|
puts "Run script does not support Qemu or Linux"
|
2016-10-20 13:47:19 +00:00
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
2019-04-29 13:24:37 +00:00
|
|
|
assert_spec x86_64
|
2016-10-20 13:47:19 +00:00
|
|
|
|
2019-02-08 14:00:41 +00:00
|
|
|
#
|
|
|
|
# Please configure your reader's vendor and product IDs here
|
|
|
|
#
|
|
|
|
proc smartcard_vendor_id {} { return "0x04e6" }
|
|
|
|
proc smartcard_product_id {} { return "0x5116" }
|
|
|
|
|
2016-10-20 13:47:19 +00:00
|
|
|
#
|
|
|
|
# Build
|
|
|
|
#
|
|
|
|
|
|
|
|
set build_components {
|
2019-01-03 17:01:49 +00:00
|
|
|
core init timer
|
2021-05-21 14:16:29 +00:00
|
|
|
drivers/usb_host
|
2016-10-20 13:47:19 +00:00
|
|
|
test/smartcard
|
2020-07-23 13:14:54 +00:00
|
|
|
lib/vfs/pipe
|
2016-10-20 13:47:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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>
|
2017-05-07 20:36:11 +00:00
|
|
|
</default-route>
|
|
|
|
<default caps="100"/>}
|
2016-10-20 13:47:19 +00:00
|
|
|
|
|
|
|
append_platform_drv_config
|
|
|
|
|
|
|
|
append config {
|
|
|
|
<start name="timer">
|
|
|
|
<resource name="RAM" quantum="1M"/>
|
|
|
|
<provides><service name="Timer"/></provides>
|
|
|
|
</start>
|
2019-02-08 14:00:41 +00:00
|
|
|
<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>
|
|
|
|
|
2019-03-28 08:32:07 +00:00
|
|
|
<start name="usb_drv" caps="200">
|
2021-05-21 14:16:29 +00:00
|
|
|
<binary name="} [usb_host_drv_binary] {"/>
|
2016-10-20 13:47:19 +00:00
|
|
|
<resource name="RAM" quantum="16M"/>
|
|
|
|
<provides><service name="Usb"/></provides>
|
2019-02-05 12:36:24 +00:00
|
|
|
<config uhci="yes" ehci="yes" xhci="yes" bios_handoff="yes">
|
2021-05-21 14:16:29 +00:00
|
|
|
<report devices="yes"/>
|
|
|
|
<policy label="test-smartcard -> usb_device"
|
|
|
|
vendor_id="} [smartcard_vendor_id] {" product_id="} [smartcard_product_id] {"/>
|
2016-10-20 13:47:19 +00:00
|
|
|
</config>
|
2019-02-08 14:00:41 +00:00
|
|
|
<route>
|
|
|
|
<service name="Report"> <child name="report_rom"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
2016-10-20 13:47:19 +00:00
|
|
|
</start>
|
2019-04-29 13:24:37 +00:00
|
|
|
|
2019-02-11 11:51:28 +00:00
|
|
|
<start name="test-smartcard" caps="150">
|
2016-10-20 13:47:19 +00:00
|
|
|
<resource name="RAM" quantum="4M"/>
|
|
|
|
<config>
|
2017-03-20 11:04:55 +00:00
|
|
|
<vfs>
|
2017-12-20 11:11:11 +00:00
|
|
|
<dir name="dev"> <log/> <inline name="rtc">2018-01-01 00:01</inline> </dir>
|
2020-07-23 13:14:54 +00:00
|
|
|
<dir name="pipe"> <pipe/> </dir>
|
2017-03-20 11:04:55 +00:00
|
|
|
<dir name="ifd-ccid.bundle">
|
|
|
|
<dir name="Contents">
|
|
|
|
<rom name="Info.plist"/>
|
2016-10-20 13:47:19 +00:00
|
|
|
</dir>
|
2017-03-20 11:04:55 +00:00
|
|
|
</dir>
|
|
|
|
</vfs>
|
2020-07-23 13:14:54 +00:00
|
|
|
<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc" pipe="/pipe"/>
|
2019-08-20 13:55:24 +00:00
|
|
|
<env key="LIBUSB_DEBUG" value="1"/> <!-- log libusb errors -->
|
2016-10-20 13:47:19 +00:00
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
</config>}
|
|
|
|
|
|
|
|
install_config $config
|
|
|
|
|
|
|
|
#
|
|
|
|
# Boot modules
|
|
|
|
#
|
|
|
|
|
|
|
|
# generic modules
|
|
|
|
set boot_modules {
|
2021-05-21 14:16:29 +00:00
|
|
|
core init timer test-smartcard
|
2016-10-20 13:47:19 +00:00
|
|
|
ld.lib.so pcsc-lite.lib.so ccid.lib.so libusb.lib.so
|
2020-07-23 13:14:54 +00:00
|
|
|
libc.lib.so vfs.lib.so libm.lib.so posix.lib.so
|
|
|
|
Info.plist vfs_pipe.lib.so
|
2016-10-20 13:47:19 +00:00
|
|
|
}
|
|
|
|
|
2021-05-21 14:16:29 +00:00
|
|
|
lappend boot_modules [usb_host_drv_binary]
|
|
|
|
|
2016-10-20 13:47:19 +00:00
|
|
|
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
|