12-03-2018 09:04 AM
Hello
I am working width NI Linux Real-time on CRIO-9037 Labview 2015SP1.
First I attached a 2 meter VGA cable through a 'miniDisplay to VGA' adapter to my crio. The monitor resolution is 1440*900 and my front panel works well with it. After a while I need to increase the length of VGA cable , so I used a longer cable. But with the same monitor , the resolution decreased to 1024*768. I use the link below to fix my problem:
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019LZYSA2&l=en-US
I used the commands in the link and the resolution became 1440*900 again. I need to set the resolution each time when I turn on the crio. I copied the commands to a file (for the first step) and save them to a location on crio , when I tried to run the script I saved from terminal , I received the message "Can't open display : 0". It is confusing me because when I copy the same command from that file to terminal and hit 'Enter' the commands run successfully but when run the file , they not work and give me the message I said.
Also I tried to run the commands in my startup labview app (By System Exec vi) and I received the same message in labview vi.
This is the commands I used:
export DISPLAY=:0
xrandr --newmode "NewMode" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
xrandr --addmode DP1 NewMode
xrandr --output DP1 --mode NewMode
Solved! Go to Solution.
12-04-2018 10:39 AM - edited 12-04-2018 10:40 AM
Hi smojtabaei,
I just ran through the following processes and all worked successfully. In all tests, I used the commands you listed.
#!/bin/bash
export DISPLAY=:0
xrandr --newmode "NewMode" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
xrandr --addmode DP1 NewMode
xrandr --output DP1 --mode NewMode
Thanks,
Andy
12-05-2018 04:38 PM
I used the commands in the link and the resolution became 1440*900 again. I need to set the resolution each time when I turn on the crio. I copied the commands to a file (for the first step) and save them to a location on crio , when I tried to run the script I saved from terminal , I received the message "Can't open display : 0". It is confusing me because when I copy the same command from that file to terminal and hit 'Enter' the commands run successfully but when run the file , they not work and give me the message I said.
Also I tried to run the commands in my startup labview app (By System Exec vi) and I received the same message in labview vi.
The likely reason you're seeing the "Can't open display :0" error is because the desktop environment has not (fully) started by the time the script gets run i.e. the script runs before X/Xfce starts so there's no "display" yet. This is definitively true for a LabVIEW startup app which starts early in the boot process. If you do want to run this from LabVIEW then you will have to retry the commands if an error is returned (with some delay to give things a chance to start).
There are other ways to do this:
#!/bin/sh
export DISPLAY=:0
xrandr --newmode "NewMode" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
xrandr --addmode DP1 NewMode
xrandr --output DP1 --mode NewMode
Let me know how it goes, there are other ways to implement this if necessary, for example by using the xfconf-query utility to set the display settings. This integrates with the other Embedded UI (Xfce) settings and persists reboots.
12-16-2018 07:23 AM
Thanks for detailed response.
The UI Start-up app didn't worked. I use ".bashrc" file and finally it works but with some notes that you and "tic.not.tock" mentioned in your responses.
Here's what id did:
- First I used putty to connect to CRIO terminal.
- Then edit ".bashrc" file in location "/home/lvuser/.bashrc" using vi editor.
- Add following lines to file :
#code for init of costum res
export DISPLAY=:0
xrandr --newmode "mode3" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
xrandr --addmode DP1 mode3
xrandr --output DP1 --mode mode3
- Save the file
After reboot it finally works.