On 8 April 2016 at 10:21, Elaine Wu (wuyanjun) wu.wu@hisilicon.com wrote:
hi, all,
I am using the new uefi, it use the cursor movement and the Enter to enter the entry.
So I use the config file to write it, but I found it can not work well. the config is below.
boot_cmds_ramdisk_sata = expect "Move Highlight", sendline "\033[B",
We have sendcontrol to avoid problems with escaping characters because the device commands need to be mapped into python from a config file and this process can result in a mismatch between the script in the config file (not python) and the actual command sent to pexpect.
After I read the source code of LAVA. I found it use the pexpect.spawn to interact with the terminal, So I directly writte a python file to directly use spawn to interact with the terminal, and it can work well . The source code is below.
import sys from pexpect import spawn
The commands in the config file need to be of a form that results in the string below being processed by python.
child.sendline("\033[B") child.sendcontrol("M")
So I don't know why in LAVA it can not work.
It is a similar problem to quote handling in a shell script - there is another process between the commands in the configuration file and the expression of those commands to the python functions.
Also I have realized a function named sendcursor similar with the sendcontrol in the lava_dispatcher package especially in the /usr/lib/python2.7/dist-package/lava_dispatcher/utils.py, and it call the pexpect.spawn.sendline to send contents to the child process. But it still have the same phenomenon with using sendline(namely won't select the entry in the uefi menu).
I'd have to see the patch to go further with that. It should be possible to create a sendcursor command which takes a movement string and maps that to the correct sendline operation - as long as the escape characters are not in the config and are inserted directly from the python code.
However, that is unlikely to be supportable in LAVA V1 - it would need to be V2 support.
Alternatively, move this entire problem into a different area by fixing the position of the item you need from the menu at the top of the menu and remove the need for any cursor movement.
Another alternative was already discussed - interacting with the device outside the menu, e.g. using Grub.