From 595ca11c68028db8bed08b4f5e628656703ed16e Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Tue, 11 Jan 2022 21:39:26 +0100 Subject: [PATCH] aux/bindings: Don't generate invalid code for missing monado_binding The closing } for a binding template was not written. --- src/xrt/auxiliary/bindings/bindings.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/xrt/auxiliary/bindings/bindings.py b/src/xrt/auxiliary/bindings/bindings.py index 35f08d4f4..e12e81c1a 100755 --- a/src/xrt/auxiliary/bindings/bindings.py +++ b/src/xrt/auxiliary/bindings/bindings.py @@ -196,21 +196,19 @@ def generate_bindings_c(file, p): component_str = component.component_str - # controllers can have input that we don't have bindings for' - if component_str not in sp_obj["monado_bindings"]: - continue + # controllers can have input that we don't have bindings for + if component_str in sp_obj["monado_bindings"]: + monado_binding = sp_obj["monado_bindings"][component_str] - monado_binding = sp_obj["monado_bindings"][component_str] + if component.is_input() and monado_binding is not None: + f.write(f'\t\t\t\t.input = {monado_binding},\n') + else: + f.write(f'\t\t\t\t.input = 0,\n') - if component.is_input() and monado_binding is not None: - f.write(f'\t\t\t\t.input = {monado_binding},\n') - else: - f.write(f'\t\t\t\t.input = 0,\n') - - if component.is_output() and monado_binding is not None: - f.write(f'\t\t\t\t.output = {monado_binding},\n') - else: - f.write(f'\t\t\t\t.output = 0,\n') + if component.is_output() and monado_binding is not None: + f.write(f'\t\t\t\t.output = {monado_binding},\n') + else: + f.write(f'\t\t\t\t.output = 0,\n') f.write(f'\t\t\t}}, // /binding_template {idx}\n')