#!/usr/bin/php [rfid1, rfid2, ..] =========================================================*/ } function mfrc522_loop(){ /* [1] Wait for rfid card =========================================================*/ while( !($code=syscall(SOURCE_DIR.'/lib/mfrc522/read')) ); $code = strtoupper($code); slog("card '$code' read", 'mfrc522:read'); $start_ts = microtime(true); /* [2] Check for user in auth list =========================================================*/ /* [n] Wait for 0.5 s before reading again =========================================================*/ while( microtime(true)-$start_ts < 0.5 ); } slog('daemon started (loop)', 'mfrc522:loop'); while( true ) echo mfrc522_loop(); ?>