File tree 1 file changed +12
-3
lines changed 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -574,16 +574,25 @@ def unlock(self):
574
574
"""Unlock access to the serial bus."""
575
575
self .lock_handle .release ()
576
576
577
- def __init__ (self , uart_id , debug = False ):
578
- """Initialize the Notecard before a reset."""
577
+ def __init__ (self , uart_id , debug = False , lock_path = None ):
578
+ """Initialize the Notecard before a reset.
579
+
580
+ Args:
581
+ uart_id: The serial port identifier.
582
+ debug: Enable debug output if True.
583
+ lock_path: Optional path for the serial lock file. Defaults to /tmp/serial.lock
584
+ or the value of NOTECARD_SERIAL_LOCK_PATH environment variable.
585
+ """
579
586
super ().__init__ (debug )
580
587
self ._user_agent ['req_interface' ] = 'serial'
581
588
self ._user_agent ['req_port' ] = str (uart_id )
582
589
583
590
self .uart = uart_id
584
591
585
592
if use_serial_lock :
586
- self .lock_handle = FileLock ('serial.lock' )
593
+ if lock_path is None :
594
+ lock_path = os .environ .get ('NOTECARD_SERIAL_LOCK_PATH' , '/tmp/serial.lock' )
595
+ self .lock_handle = FileLock (lock_path )
587
596
else :
588
597
self .lock_handle = NoOpSerialLock ()
589
598
You can’t perform that action at this time.
0 commit comments