0

Offiline debugging for BrightScript

Hi,

is there any possibility to debug a BrightScript before putting it onto the player?

It is extremely annoying, especially when one is new to the language, being forced to write a script, put it on an SD card, insert the SD card, boot the player, open the log file, notice that the script isn't running due to a simple syntax error (i. e. non-closed paranthesis etc.), and re-do everything.

At least, a syntax checker would be great, wouldn't you agree?

Kind regards

Pascal

3 comments

  • 0
    Avatar
    Bright Scripters

    Hi Pascal,

    Looks like you could use some help :)

    It is best to debug on a player.

    It is possible to avoid removing the SD card or even rebooting the player with every code change.

    Accessing the player via ssh (and sftp) is the key for an efficient development process.

    Start by enabling ssh as described here:

    https://brightsign.atlassian.net/wiki/spaces/DOC/pages/370673607/Telnet+and+SSH

    Boot up the player with an SD card that has just the autorun.brs file, containing the code snippet below:

    reg = CreateObject("roRegistrySection""networking")
    reg.write("ssh","22") 
    n=CreateObject("roNetworkConfiguration"0) 
    n.SetLoginPassword("password")
    n.Apply()
    reg.flush()
    RebootSystem()
     
    After about 1 min you'll notice that the player is rebooting itself.
    ssh is enabled.
    Connect with ssh client to brightsign-< Your player's serial goes here >.local
     
    Next you'd want to set the player to debug mode, so it doesn't reboot with every code error.
    The debug console is your friend:
     
    Best of luck!
  • 0
    Avatar
    Brandon Stryker

    putting the RebootSystem() function call in the autorun.brs file makes the player just constantly turn on, run the script, and reboot... how are you supposed to SSH to it if it's constantly rebooting? lol

  • 0
    Avatar
    Bright Scripters

    That is of course the quick and dirty solution ;)

    Once you notice that the player is rebooting, you can remove the power plug, swap SD card and power up.

    To make it more fancy, you can remove the RebootSystem() command and place a prompt on the screen for the user with instructions.

    You might find the roTextWidget object useful

    https://brightsign.atlassian.net/wiki/spaces/DOC/pages/370672952/roTextWidget

    How about you take it from here and share your polished script?

Please sign in to leave a comment.