# Board-side: record raw Goodix input_event timestamps for a fixed window. import os,struct,sys,time,select,glob,json dur=float(sys.argv[1]); out=sys.argv[2] dev=None for d in sorted(glob.glob('/sys/class/input/event*')): if 'Goodix' in open(d+'/device/name').read(): dev='/dev/input/'+os.path.basename(d) fd=os.open(dev,os.O_RDONLY|os.O_NONBLOCK); rows=[]; end=time.monotonic()+dur print(json.dumps({'device':dev,'armed_monotonic':time.monotonic(),'seconds':dur}),flush=True) while time.monotonic()