Linux下禁用笔记本屏幕,启动外接VGA

时间:2021-09-02 06:30:35

公司某款产品使用了atom n2600。结果不知道是设计有问题,还是这款产品天生有缺陷。首先,居然无linux下显卡驱动xf86-video-intel驱动到2015年Q4也没有支持。

后来只好使用VGA做输出测试,当要使用1920x1080时根本启动不起来。

当然在Linux下可以查到有LVDS,VGA两个显示器,好吧,度娘可以告诉我LVDS就是笔记本的LCD显示器,laptop。那VGA才是我们现在使用的显示器,明明LVDS根本没有外接,为什么他一定要探测到有显示器呢,硬件BUG不表了。那么有没有什么办法可以让他的默认输出为VGA,而不是LVDS呢,度娘反正是告诉我,她不知道。

度娘不知道了,只能找谷哥了,想不到谷哥的回答果然有好多。于是暂时记录下此解决方法,再验证此方法,但是人家说的有道理,应该不会错。

I managed to find a fix for my problem. I simply added this to my /etc/default/grub file:

GRUB_CMDLINE_LINUX_DEFAULT="<default paramaters> video=LVDS-1:d"

Then did a good ol' fashin grub-update.

This disabled the laptop's LCD on boot, and allowed the external monitor to automatically set its resolution, which worked without a hitch.

其实这原理也比较简单

A mode can be forced on the kernel command line. Unfortunately, the command line option video is poorly documented in the DRM case. Bit and pieces on how to use it can be found in

http://cgit.freedesktop.org/nouveau/linux-2.6/tree/Documentation/fb/modedb.txt
http://cgit.freedesktop.org/nouveau/linux-2.6/tree/drivers/gpu/drm/drm_fb_helper.c

The format is:

video=<conn>:<xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m][eDd]

<conn>: Connector, e.g. DVI-I-1, see your kernel log.
<xres> x <yres>: resolution
M: compute a CVT mode?
R: reduced blanking?
-<bpp>: color depth
@<refresh>: refresh rate
i: interlaced (non-CVT mode)
m: margins?
e: output forced to on
d: output forced to off
D: digital output forced to on (e.g. DVI-I connector) 

You can override the modes of several outputs using "video" several times, for instance, to force DVI to 1024x768 at 85 Hz and TV-out off:

video=DVI-I-1:1024x768@85 video=TV-1:d


实际操作中,自己操作系统中的显露器名称具体是什么,要自己查看才知道。

命令如下

xrandr
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 2048 x 768
VGA-0 disconnected (normal left inverted right x axis y axis)
LVDS connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1024x768       60.0*+   60.0 
   800x600        60.3 
   640x480        59.9 
代表两个显示器分别是VGA-0,LVDS。那么在GRUB中就要使用此名称禁用。对于双屏问题,xrandr可以做更多。

xrandr --output VGA1 --right-of LVDS1 --auto

xrandr --output LVDS1 off

xrandr --output VGA1 auto

原文地址:

http://superuser.com/questions/636617/disabling-laptop-monitor-on-boot




Halox answer didn't fix the issue, as GDM3 configures the X server on it's own and re-enables the disabled monitor (silly).

After reading the docs I added xrandr --output LVDS1 --off at the top of /etc/gdm/Init/Default and finally got it to work.

This makes linux ignore the LVDS output altogether. That way it will not be used by all login managers, and won't appear in display configuration dialogs.

Create a file /usr/share/X11/xorg.conf.d/50-disable-lvds.conf and write there:

Section "Monitor"
        Identifier      "lvds monitor"
        Option  "ignore"        "true"
EndSection
Section "Device"
        Identifier      "onboard"
        Option  "Monitor-LVDS1" "lvds monitor"
EndSection
http://superuser.com/questions/626482/permanently-disable-second-screen


更有一个大神写的脚本,网页为:

http://ubuntuforums.org/showthread.php?t=1243541