Giter Club home page Giter Club logo

Comments (13)

vj-kumar avatar vj-kumar commented on September 27, 2024

Mm. Just tested on master. Seems to work.

(test) vijai@oxygen:/srv/mtda$ mtda-cli help
usage: mtda [options] <command> [<args>]

The most commonly used mtda commands are:
   command   Send a command (string) to the device
   console   Interact with the device console
   getenv    Get named variable from the environment
   monitor   Interact with the device monitor console (if any)
   target    Power control the device
   setenv    Set named variable to specified value in the environment
   storage   Interact with the shared storage device
   usb       Control USB devices attached to the device

(test) vijai@oxygen:/srv/mtda$

from mtda.

bhargavdas avatar bhargavdas commented on September 27, 2024

Hi, I looked into this issue seems like self._session_timer thread (main.py, line: 1335) is still running. That's why mtda-cli help doesn't return. Not only help but other commands which should exit normally are also effected.

I tried adding a signal handler where we have to press ctrl+c manually to exit from the commands.

Current Log

mtda@mtda:~$ mtda-cli help
usage: mtda [options] <command> [<args>]

The most commonly used mtda commands are:
   command   Send a command (string) to the device
   console   Interact with the device console
   getenv    Get named variable from the environment
   monitor   Interact with the device monitor console (if any)
   target    Power control the device
   setenv    Set named variable to specified value in the environment
   storage   Interact with the shared storage device
   usb       Control USB devices attached to the device

^CException ignored in: <module 'threading' from '/usr/lib/python3.9/threading.py'>
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 1428, in _shutdown
    lock.acquire()
KeyboardInterrupt:
mtda@mtda:~$

With the signal handler which stops the thread after invoking ctrl+c we don't get the errors

mtda@mtda:~$ mtda-cli help
usage: mtda [options] <command> [<args>]

The most commonly used mtda commands are:
   command   Send a command (string) to the device
   console   Interact with the device console
   getenv    Get named variable from the environment
   monitor   Interact with the device monitor console (if any)
   target    Power control the device
   setenv    Set named variable to specified value in the environment
   storage   Interact with the shared storage device
   usb       Control USB devices attached to the device

^C=========exiting======
mtda@mtda:~$

This change doesn't seem to effect any other exiting functionality as of now.

Currently I can't figure out how to exit from the commands automatically without using ctrl+c, any pointers/suggestions will be helpful.

from mtda.

chombourger avatar chombourger commented on September 27, 2024

we may want to use the python debugger to check threads that are still running. we probably need to stop them

from mtda.

chombourger avatar chombourger commented on September 27, 2024

does not seem to be reproducible now with 0.14

from mtda.

chombourger avatar chombourger commented on September 27, 2024

reopening, Hemanth was able to reproduce with 0.14 - looking forward to getting reproduction steps

from mtda.

hkoturap avatar hkoturap commented on September 27, 2024

When running any commands on mtda-assit board, we can observe it does not retun

mtda@mtda:~$ sudo mtda-cli help
sudo: unable to resolve host mtda: No address associated with hostname
Device Found
  type: 16c0 05df
  path: /dev/hidraw0
  serial_number: 
  Manufacturer: www.dcttech.com
  Product:      USBRelay2
  Release:      100
  Interface:    0
  Number of Relays =  #2

usage: mtda [options] <command> [<args>]

The most commonly used mtda commands are:
   command   Send a command (string) to the device
   console   Interact with the device console
   getenv    Get named variable from the environment
   monitor   Interact with the device monitor console (if any)
   target    Power control the device
   setenv    Set named variable to specified value in the environment
   storage   Interact with the shared storage device
   usb       Control USB devices attached to the device

Device Found
  type: 16c0 05df
  path: /dev/hidraw0
  serial_number: 
  Manufacturer: www.dcttech.com
  Product:      USBRelay2
  Release:      100
  Interface:    0
  Number of Relays = 2

When it doesn't return when we Press Ctrl+C we can observe the following

^CException ignored in: <module 'threading' from '/usr/lib/python3.9/threading.py'>
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 1428, in _shutdown
    lock.acquire()
KeyboardInterrupt:

MTDA version on Assist Board is

mtda@mtda:~$ sudo mtda-cli --version
sudo: unable to resolve host mtda: No address associated with hostname
MTDA version: 0.14

from mtda.

chombourger avatar chombourger commented on September 27, 2024

can you provide your /etc/mtda/config file for completeness?

from mtda.

hkoturap avatar hkoturap commented on September 27, 2024

Following is /etc/mtda/config file contents

mtda@mtda:~$ cat /etc/mtda/config 
[main]                                                                          
debug=0                                                                     
                                              
[storage]
variant=usbf
device=/dev/sda                                         

[console]                                                                   
variant=serial       
port=/dev/ttyGS0    
rate=9600     

[keyboard]                           
variant=hid    
device=/dev/hidg0                                                

[sdmux]                                           
variant=usbf            

[power]                                                               
variant=usbrelay
lines=HURTM_1

from mtda.

hkoturap avatar hkoturap commented on September 27, 2024

Had applied this patch and tested
help command was executing sucessfully

mtda@mtda:~$ sudo /usr/bin/mtda-cli help
sudo: unable to resolve host mtda: No address associated with hostname
[sudo] password for mtda: 
usage: mtda [options] <command> [<args>]
The most commonly used mtda commands are:
   command   Send a command (string) to the device
   console   Interact with the device console
   getenv    Get named variable from the environment
   monitor   Interact with the device monitor console (if any)
   target    Power control the device
   setenv    Set named variable to specified value in the environment
   storage   Interact with the shared storage device
   usb       Control USB devices attached to the device

mtda@mtda:~$

But running the mtda-cli target on wasn't switching the target on

mtda@mtda:~$ sudo /usr/bin/mtda-cli target on
sudo: unable to resolve host mtda: No address associated with hostname
# debug3: main.load_timeouts_config()
# debug3: main.load_timeouts_config: None
# debug3: main.start()
# debug3: main.target_on()
# debug3: main._session_check(withstand)
# debug2: session withstand: 300 seconds
# debug3: main._session_event(ACTIVE withstand)
# debug3: main.notify()
# debug3: main.notify: None
# debug3: main._session_event: None
# debug3: main._session_check: None
# debug3: main.power_locked()
# debug3: main._session_check(withstand)
# debug2: session withstand: 300 seconds
# debug3: main._session_check: None
# debug3: main.power_locked(): True
# debug3: main.target_on(): False

from mtda.

chombourger avatar chombourger commented on September 27, 2024

well that's probably a different issue. From your logs I see:

# debug3: main.target_on()
...
# debug3: main.power_locked(): True
# debug3: main.target_on(): False

The first line confirms that we have receive the command to turn on your DUT
We then see that power control is locked and target_on consequently returns False

from mtda.

chombourger avatar chombourger commented on September 27, 2024

power_locked may return True if there is no power controller or if a session has locked the DUT.
Could you provide the full log for mtda.service? (journalctl -u mtda.service)

from mtda.

chombourger avatar chombourger commented on September 27, 2024

logs from my end

Jan 06 10:18:00 mtda mtda-cli[1860]: # debug3: main.target_on()
Jan 06 10:18:00 mtda mtda-cli[1860]: # debug3: main._session_check(chombourger@frg-w10-hombou2)
Jan 06 10:18:00 mtda mtda-cli[1860]: # debug2: session chombourger@frg-w10-hombou2: 300 seconds
Jan 06 10:18:00 mtda mtda-cli[1860]: # debug3: main._session_check: None
Jan 06 10:18:00 mtda mtda-cli[1860]: # debug3: main.power_locked()
Jan 06 10:18:00 mtda mtda-cli[1860]: # debug3: main._session_check(chombourger@frg-w10-hombou2)
Jan 06 10:18:00 mtda mtda-cli[1860]: # debug2: session chombourger@frg-w10-hombou2: 300 seconds
Jan 06 10:18:00 mtda mtda-cli[1860]: # debug3: main._session_check: None
Jan 06 10:18:00 mtda mtda-cli[1860]: # debug3: main._check_locked()
Jan 06 10:18:00 mtda mtda-cli[1860]: # debug3: main.target_owner()
Jan 06 10:18:00 mtda mtda-cli[1860]: # debug3: main.power_locked(): False
Jan 06 10:18:00 mtda mtda-cli[1876]: Orig: 959BI, Serial: 959BI, Relay: 1 State: ff
Jan 06 10:18:01 mtda mtda-cli[1876]: Device Found
Jan 06 10:18:01 mtda mtda-cli[1876]:   type: 16c0 05df
Jan 06 10:18:01 mtda mtda-cli[1876]:   path: /dev/hidraw0
Jan 06 10:18:01 mtda mtda-cli[1876]:   serial_number:
Jan 06 10:18:01 mtda mtda-cli[1876]:   Manufacturer: www.dcttech.com
Jan 06 10:18:01 mtda mtda-cli[1876]:   Product:      USBRelay1
Jan 06 10:18:01 mtda mtda-cli[1876]:   Release:      100
Jan 06 10:18:01 mtda mtda-cli[1876]:   Interface:    0
Jan 06 10:18:01 mtda mtda-cli[1876]:   Number of Relays = 1
Jan 06 10:18:01 mtda mtda-cli[1876]: Serial: 959BI, Relay: 1 State: ff
Jan 06 10:18:01 mtda mtda-cli[1876]: 1 HID Serial: 959BI Serial: 959BI, Relay: 1 State: ff
Jan 06 10:18:01 mtda mtda-cli[1876]: Serial: 959BI, Relay: 1 State: ff --- Found
Jan 06 10:18:01 mtda mtda-cli[1877]: Device Found
Jan 06 10:18:01 mtda mtda-cli[1877]:   type: 16c0 05df
Jan 06 10:18:01 mtda mtda-cli[1877]:   path: /dev/hidraw0
Jan 06 10:18:01 mtda mtda-cli[1877]:   serial_number:
Jan 06 10:18:01 mtda mtda-cli[1877]:   Manufacturer: www.dcttech.com
Jan 06 10:18:01 mtda mtda-cli[1877]:   Product:      USBRelay1
Jan 06 10:18:01 mtda mtda-cli[1877]:   Release:      100
Jan 06 10:18:01 mtda mtda-cli[1877]:   Interface:    0
Jan 06 10:18:01 mtda mtda-cli[1877]:   Number of Relays = 1
Jan 06 10:18:01 mtda mtda-cli[1860]: # debug3: power.usbrelay.status: line 959BI_1 is ON
Jan 06 10:18:01 mtda mtda-cli[1860]: # debug3: main.exec_power_on_script()
Jan 06 10:18:01 mtda mtda-cli[1860]: # debug3: main.exec_power_on_script(): None
Jan 06 10:18:01 mtda mtda-cli[1860]: # debug3: main.notify()
Jan 06 10:18:01 mtda mtda-cli[1860]: # debug3: main.notify: None
Jan 06 10:18:01 mtda mtda-cli[1860]: # debug3: main.target_on(): True
Jan 06 10:18:09 mtda mtda-cli[1860]: # debug3: main._session_check(None)
Jan 06 10:18:09 mtda mtda-cli[1860]: # debug2: session chombourger@frg-w10-hombou2: 291 seconds
Jan 06 10:18:09 mtda mtda-cli[1860]: # debug3: main._session_check: None

and with the following (minimal) config

[main]
debug = 3
name = foo

[power]
variant=usbrelay
lines=959BI_1

from mtda.

hkoturap avatar hkoturap commented on September 27, 2024

Following is the log for mtda.service.

Jan 06 10:28:26 mtda systemd[1]: Started Multi-Tenant Device Access.
Jan 06 10:28:26 mtda systemd[1]: Stopping Multi-Tenant Device Access...
Jan 06 10:28:26 mtda systemd[1]: mtda.service: Succeeded.
Jan 06 10:28:26 mtda systemd[1]: Stopped Multi-Tenant Device Access.
Jan 06 10:28:26 mtda systemd[1]: Started Multi-Tenant Device Access.
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: main.load_timeouts_config()
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: main.load_timeouts_config: None
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: main.load_power_config()
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: main.load_console_config()
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: console.serial.configure()
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: main.load_keyboard_config()
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: keyboard.hid.configure()
Jan 06 10:28:43 mtda mtda-cli[336]: # debug4: keyboard.hid.configure(): will us>
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: keyboard.hid.probe()
Jan 06 10:28:43 mtda mtda-cli[336]: # debug1: keyboard.hid.probe(): /dev/hidg0 >
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: keyboard.hid.probe(): False
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: main.load_storage_config()
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: storage.writer.compression.set()
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: storage.writer.compression.set():>
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: storage.usbf.configure()
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: storage.usbf.configure(): None
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: main.start()
Jan 06 10:28:43 mtda mtda-cli[458]: Device Found
Jan 06 10:28:43 mtda mtda-cli[458]:   type: 16c0 05df
Jan 06 10:28:43 mtda mtda-cli[458]:   path: /dev/hidraw0
Jan 06 10:28:43 mtda mtda-cli[458]:   serial_number:
Jan 06 10:28:43 mtda mtda-cli[458]:   Manufacturer: www.dcttech.com
Jan 06 10:28:43 mtda mtda-cli[458]:   Product:      USBRelay2
Jan 06 10:28:43 mtda mtda-cli[458]:   Release:      100
Jan 06 10:28:43 mtda mtda-cli[458]:   Interface:    0
Jan 06 10:28:43 mtda mtda-cli[458]:   Number of Relays = 2
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: storage.usbf.probe()
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: storage.usbf.probe(): True
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: console.serial.probe()
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: console.serial.probe(): True
Jan 06 10:28:43 mtda mtda-cli[466]: Device Found
Jan 06 10:28:43 mtda mtda-cli[466]:   type: 16c0 05df
Jan 06 10:28:43 mtda mtda-cli[466]:   path: /dev/hidraw0
Jan 06 10:28:43 mtda mtda-cli[466]:   serial_number:
Jan 06 10:28:43 mtda mtda-cli[466]:   Manufacturer: www.dcttech.com
Jan 06 10:28:43 mtda mtda-cli[466]:   Product:      USBRelay2
Jan 06 10:28:43 mtda mtda-cli[466]:   Release:      100
Jan 06 10:28:43 mtda mtda-cli[466]:   Interface:    0
Jan 06 10:28:43 mtda mtda-cli[466]:   Number of Relays = 2
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: power.usbrelay.status: line HURTM>
Jan 06 10:28:43 mtda mtda-cli[336]: # debug3: power.usbrelay.status: line HURTM>
Jan 06 10:29:43 mtda mtda-cli[336]: # debug3: main._session_check(None)
Jan 06 10:29:43 mtda mtda-cli[336]: # debug3: main._session_check: None
Jan 06 10:30:43 mtda mtda-cli[336]: # debug3: main._session_check(None)
Jan 06 10:30:43 mtda mtda-cli[336]: # debug3: main._session_check: None

from mtda.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.