Change screen resolution without monitor programmatically under Linux? [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I'm writing a GUI program which will be executed along the OS (CentOS 6.6) boots.
The resolution configuration is programmed in the init part of the GUI program, my solution right now is get the resolution sets of the monitor using xrandr and parse the result and set it to one of the candidates, you can choose one of them in the Preferences part of the GUI program later. But xrandr won't work if no monitor is plugged in, right?
If I got no monitor plugged into the box, that means I have no idea what the resolution sets one monitor can provide (at least not from xrandr), so now what I want is, if I turn on the computer, and the GUI program will be executed, after plugging a monitor later, I can see the GUI program already loaded in the monitor.
I mean I want the resolution fixed (1152x864 75.0Hz, for example) in the GUI program init part using some commands or APIs if no monitor plugged?
Does anyone know anything about the available commands or APIs?

I didn't try this with/without a monitor, but it should be possible to "prime" outputs without a display connected with xrandr.
xrandr --newmode "1024x768_2" 63.50 1024 1072 1176 1328 768 771 775 798 -hsync +vsync
to define a new, fixed mode since we can't use EDID with no monitor connected(make sure the name is unique). Also make sure you define a mode any thinkable monitor will be capable displaying (which pretty much limits you to small resolution VESA compatible modes, otherwise you risk damaging old fixed frequency monitors).
xrandr --addmode <output device> 1024x768_2
to assign this mode to a graphics card output
xrandr --output <output device> 1024x768_2
to enable this output.
set this the primary display
xrandr --primary <output device>

Related

Windows 10 Desktop Window Manager swap timing?

I have a few questions regarding the Desktop Window Manager (aka DWM) in Windows 10:
Background: For an OpenGL application I wrote in C++ I need precise timing regarding the swap of the front and back buffers in OpenGL and the realization of these commands on the OS level. (I know Windows 10, or Windows in general, is a bad choice for this, but there are other limiting factors).
Question 1: My internet research showed that the DWM manages a third buffer (making visualization a triple buffered system) which I cannot control and therefore creates an unpredictable delay. The investigation also showed that this can be bypassed by opening an OpenGL context in fullscreen mode. Is this information correct?
Question 2: Is this delay caused by the fact that the OS randomly instructs the DWM to copy the buffer?
Question 3: How long is the actual delay, my investigation showed numbers between < 1ms and up to 50ms, but there was no trustworthy source.
In fact, besides for the single fact, the mere existence of the delay, there was no trustworthy source for any of the other assumptions which I was able to find on the internet. Therefore I kindly ask anyone having an answer to this questions to include if this possible, a reference to their statement.
I don't know if this is important, but I'm using OpenGL via GLFW and GLEW.
Although I was unable to find an answer to question 2 and 3, contacting the Nvidia support provided the answer to question 1.
Nvidia statet that an application rendered in a full screen context cannot access the DWM. Only applications rendered in windowed mode are handled by it.
Warning: They also said that this was by design. Considering the fact that Microsoft attempts to force users/programmers to use the DWM there is no guarantee on how long this design decision will remain unchanged.
Original mail from Nvidia:
[...]
After checking your request with our specialized department, please note that when a game or anything is in Full Screen you cannot access this Windows Feature [annot.: DWM]. This is by design. It needs to be windowed mode if you want to access this feature.
[...]

how to get the remote computer's screen image dynamically which gives me a live watch of what is happening? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How do I to get the full control of a remote computer which I know his open port number and his IP address using C++ ?
I know that I need to establish a socket connection between these two computers which I've already done. But, how to get the remote computer's screen image dynamically which gives me a live watch of what is happening?
I'm just looking for what do I need to know to deal this.
PS: I'm trying to implement this solution, I know that there is many softwares whom deal this.
OS: Windows 7 SP1.
If you want to just see the remote computer's screen, you can take screen captures by instructions from Here or Here.
Next you should send data of bitmap pointing by a pointer like ULONG *pBitmap over network. You can put a header before each frame data and a footer after that. In the receiving side you can detect each frame packet by headers and footers ensuring that each frame data is received completely.
After receiving a frame you should display it by whatever GUI framework you are using.
This is quite complex. Things like "Remote Desktop" will implement a virtual screen driver, virtual keyboard driver and virtual mouse driver. The virtual driver then does the packaging of what is going on (when enabled) and sends the data to the local computer, which has code to redraw the remote machine's graphics. The local machine on the other hand (assuming you want to control the remote machine) will send keypresses and mouse movement to the remote machine to allow control. These will be picked up by the remote machine's virtual keyboard and mouse drivers and entered into the system as if they were "real" keyboard and mouse movements.
You could do a very simple version by simply doing a screengrab and sending the data from that to your local machine over the network. You may want to do some sort of "compare this image with the before one, only send what changed" to avoid too much data across the network.
One of many answers about screen shots here on SO:
How can I take a screenshot and save it as JPEG on Windows?
And there are interfaces to send keyboard and mouse events to the system, such as what is described here:
http://msdn.microsoft.com/en-us/library/ms171548%28v=vs.110%29.aspx

Hardware Fastboot Boot Method in XE11 not working? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I got stuck on my Glass unit with Launchy crashing (sideloaded the wrong version -_-) in XE11 every time I try to launch an application, including the built-in settings. The problem is for some reason I don't have ADB access anymore and because of Launchy, now can't even reenable Debug mode.
So I am now trying to boot into fastboot mode using the hardware method reference here: Having issues seeing GLASS in Fastboot
But when I keep the camera button pressed and press the power button briefly, the LED is solid for a few seconds and then goes on to blink at very low frequency. No matter how long I seem to keep the camera button pressed, the LED never goes solid.
I've also tried to plug in the unit to my computer and look for it show up in the System Information (the Apple Device Manager equivalent).
Does anyone know if the fastboot hardware method changed in XE11? Or what am I doing wrong?
Thanks in advance,
Charles.
The slow blink you're seeing is Glass in fastboot. Once in fastboot you can verify that it's connected by doing a device list:
$ fastboot devices
If you see output, you'll be able to run other fastboot commands.

writing a simple linux desktop environment in c++ [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I would like to write a very simple Linux desktop environment or a program that runs without a DE, and here is my requirements
the application or DE will be a IPTV player (as a IPTV set-top boxes)
and I want it to run directly after booting (no login screen or such things)
1- the DE will be full screen
2- no need to run any other GUI programs, just command line programs called through my application, so no need to window manager nor display manager (if possible)
3-minimal services, just want to connect to LAN and read rtp (udp) streams
4-use Qt and Qt Quick to write this DE or application, and if couldn't use openGL
5-MUST use libvlc or any other library to read and play rtp streams
6-use apt-get to install or remove packages
7- keyboard and mouse support
I am a c++ and Qt programmer and I have a good Linux administration background
if you have any idea to help write the DE or if any existing one that run directly on XWindow, please help
the DE will be used as if the PC a a normal DVB receiver to list channels and select one to view
How could I boot my Qt application as a DE and put it in /usr/share/xsessions
as /usr/share/xsessions/myDE.desktop
how to configure Qt to run without a window manager or display manager
should I use QApplication or any other class to run my app
I would like to start by saying, you should think only about Qt 5 for, and forget about Qt 4. The Qt 4 design with QWS is a bit old, and hence flawed. Qt 5 has a nice QPA (Qt Platform Abstraction) interface for easily adding platform plugins which makes the architecture robust and flexible.
how to configure Qt to run without a window manager or display manager
You can use Qt with the appropriate platform plugins, like eglfs, linuxfb, directfb, minimal, minimalegl, etc without complicated windows and display managers if you wanna have some lightweight solution.
Here you can find the list of the platform plugins that Qt 5 currently tries to support:
https://qt.gitorious.org/qt/qtbase/source/475cbed2446d0e3595e7b8ab71dcbc1ae5f59bcf:src/plugins/platforms
should I use QApplication or any other class to run my app
No, you should use QGuiApplication for this sort of thing. QApplication is for widgets based application with Qt 5, and that is the major Qt version you should use for this.
That being sad, Qt Quick 2 rendering depends on the availability of the OpenGL api, so you need to have that in place for your information. That does not necessarily mean hardware acceleration with GPU. Having a software based implementation of the open standard is also fine.

Having issues seeing GLASS in Fastboot [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I can see my GLASS id in adb and adb reboot-bootloader seems to work. I can not see my device id in fastboot however and fastboot oem unlock hangs on "waiting for device". Pressing the camera button does reboot the device.
Has anyone else had / seen this issue and what have you done to remedy?
I am currently on XE7 with debugging on. I have side-loaded apk's before with no issue via adb. I would like to know of any possible solutions to be able to see my GLASS in fastboot.
My Solution-
I had issues on Win 8 so I swapped over to my OS X install, unplugged all usb peripherals and then ran "./adb reboot bootloader", saw my GLASS in "./fastboot devices" and then ran "./fastboot oem unlock" twice to initiate.
I did not try unplugging all peripherals in win 8. That may help for those that have the same issue on Win 8.
You can use a hardware technique to get your Glass into fastboot. Make sure your device has some charge (15% or more should be sufficient) and follow these steps.
Power down your device by holding the power button for 15 seconds.
Press and hold the camera button. Keep holding it until step 5.
Briefly press the power button.
Wait until the LED solidly illuminates.
Release the camera button.
Now your device should be visible to fastboot. Plug it into a USB port and use fastboot to list devices:
$ fastboot devices
If your device is listed, you can now run other fastboot commands.
This issue on OS X, https://code.google.com/p/google-glass-api/issues/detail?id=243 is still not addressed (please star the issue while there), it still exists post XE8 regardless of how you start fastboot which as noted, times out and will reboot after inactivity of just a few seconds. Part of the problem is that the USB vendorId switches between Google and TI when switching between adb and fastboot (bootloader) modes.
The solution for Windows:
In android-sdk\extras\google\usb_driver\android_winusb.inf
Add to both the [Google.NTamd64] and [Google.NTx86] sections 2 additional lines:
;Google Glass
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_9001
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_9001&MI_01
%SingleBootLoaderInterface% = USB_Install, USB\VID_18D1&PID_9002
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_9002&REV_0100
Then from ControlPanel->System->Device Manager confirm the VID and PID values with the yellow warning tagged device or “unknown device” - if not the same, edit to match these values.