After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 365016 - Ext. monitor not DPMS'ed when lid closed
Ext. monitor not DPMS'ed when lid closed
Status: RESOLVED FIXED
Product: gnome-power-manager
Classification: Deprecated
Component: gnome-power-manager
2.16.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME Power Manager Maintainer(s)
GNOME Power Manager Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2006-10-25 15:22 UTC by Johannes Hessellund
Modified: 2006-11-08 21:00 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16


Attachments
Lid_closed.patch (3.03 KB, patch)
2006-11-03 21:50 UTC, Johannes Hessellund
none Details | Review
lid_closed.patch (3.93 KB, patch)
2006-11-06 18:26 UTC, Johannes Hessellund
none Details | Review

Description Johannes Hessellund 2006-10-25 15:22:52 UTC
Using a laptop with an external monitor and keyboard connected. (ex: using docking station or port replicator)

When LID closed the external monitor is never shut down using DPMS nor is the screensaver ever run.
Everythings fine when lid open!

Either the screensaver never sends idle signal when throttled or the g-p-m never blanks (DPMS) when screensaver is throttled.

Best thing would be to detect is laptop is docked, and only throttle screensaver if not docked.

Tested on T42 and port replicator.
Comment 1 Richard Hughes 2006-10-25 16:02:48 UTC
Do you know if DPMS can be set differently for the external and internal screen?
Comment 2 Johannes Hessellund 2006-10-25 16:25:15 UTC
It can't! At least not in my configuration.
I use the same "single" monitor xorg.conf which automaticly chooses the external monitor when lid is closed. (guess the bios actually handles this) Xorg sees only one monitor.

I think g-p-m should try to detect if an external monitor or the laptops panel is used, and there should be an option in gconf to overrule the throttle command.

I only spend 10 min. looking at gnome-screensaver and g-p-m code, so I'm not sure what where would be best to address this problem.
Comment 3 Richard Hughes 2006-10-25 17:19:17 UTC
That's what I thought - I think the dpms code is per-system rather than per-head. I could be wrong there.

g-s does not handle DPMS - gnome-power-manager does. g-s only tells us when we are idle. Really, g-p-m needs to know if an external monitor is conncted - something I don't think we can get easily from X or the kernel.

I also don't think yours is the common case - most external screens connected are projectors - and you really don't what then to blank when you are giving a talk! :-)
Comment 4 Johannes Hessellund 2006-10-25 17:35:21 UTC
I do think my case is common, as I use my laptop as primary PC. At home I put it into my port replicator (docking station), using external monitor and keyb/mouse.

I also think that using a projector, the projecting software (Impress / Powerpoint / Adobe Reader / whatever) should disable DPMS themselves or at least signal g-p-m not to blank monitor.

I found out some more:

1. While docked I opened the lid.
2. After time it then blanks my screen. OK.
3. Closed lid.
4. After shorter time blanks again.

Aha..

Tried restarting g-p-m with lid opened, and then closing it afterwards. Fine!
Tried restarting g-p-m with lid closed, no blanking.
=>
Only problem when lid closed on g-p-m initialization.
Does this give you something ?
Somewhere at startup g-p-m detects lid closed. What actions are taken on this ? Which source file should I help investigate?
Comment 5 Johannes Hessellund 2006-10-25 17:51:00 UTC
hmmm
I think I found what I was looking for.

gpm-manager.c line 1444 function idle_changed_cb
Ignoring idle state change when lid is closed!!!

Ubuntu bug 22522
https://launchpad.net/distros/ubuntu/+source/gnome-screensaver/+bug/22522

This is wrong... at least for everybody using a docking station.

Any solution ?
Comment 6 Richard Hughes 2006-10-27 09:34:33 UTC
(In reply to comment #5)
> This is wrong... at least for everybody using a docking station.

But correct for everyone who just blanks when the lid is closed. We need to detect if a docking station is used in HAL and convey this to g-p-m.

whats the difference between lshal when on docking station and standalone?
Comment 7 Johannes Hessellund 2006-10-27 13:06:41 UTC
There is no difference on lshal.

The ibm_acpi and acpi_dock modules should detect docking stations, but unfortunately their ability is very limited afaik.

I agree this would be the best and right way to go.

How many laptops does not support hardware blanking ?
Maybe some sort of whitelist ?
Maybe an option to indicate that your laptop supports hardware blanking ?

Your current fix could simply to optional with default on, until hal support detection!? Option could simply be available through gconf-editor.
Comment 8 Johannes Hessellund 2006-10-27 14:08:35 UTC
Investigating...

Maybe its not best to detect for docking stations anyway.
It might be best to detect what monitors are connected, and then not ignore idle when external monitor(s) are connected.

On my laptop I think I found some more intreresting things.

Look at /proc/acpi/video/VID/*/state
I have a CRT0, DVI0, LCD0 and TV0 directory. The query field in the state file correctly indicates which monitors are activated.
If I boot up using Laptop panel (even when docked) the LCD0/state gives query=1. Otherwise my DVI external monitor gives DVI0/state query=1.
This might be the right way to detect monitors activated.
If only LCD0 is active your "ignore idle mode change"-fix is OK, if one or more of the other monitors are active the fix should be disabled and g-p-m work as before.

What do you think ?
Comment 9 Johannes Hessellund 2006-10-31 15:21:08 UTC
Do you need more info ?
What info would be needed ?
Comment 10 Richard Hughes 2006-11-02 08:57:52 UTC
Right, seeing as the information about dock status is not available from HAL, we probably need a gconf key like you describe. I'm really busy with Uni at the moment, could you knock a patch up against CVS head please? Thanks.
Comment 11 Johannes Hessellund 2006-11-02 09:09:43 UTC
Do you know if the monitor status from /proc/acpi/video/*/* are available through HAL ?
I think the best solution will be as said in comment #8.

But the gconf key is a good temporarly solution.

I'm quite busy at uni to, so I'm not sure when I will be able to produce a patch. And I didn't produce patched before, so I'll have to look into that to..
By I will look into it if I get enough time. But don't hesitate to bring on your solution, which proporly will be better integrated as you know the source better.
Comment 12 Johannes Hessellund 2006-11-03 19:07:47 UTC
Okay, I did download the cvs version, and am implementing the fix with gconf-key.

What should be the name of the key? "enable_idle_event_when_lid_closed", "always_enable_idle_events", "ignore_idle_when_lid_closed" , other ?

How do I get access to commit changes to cvs ?

I am thinking dim_on_idle should always be disabled when lid=closed. I will implement this to.

I already did try it out, by changing the ubuntu source packages, and it works great, so now I am merging my changes to cvs source... which differs some!! ;-)
Comment 13 Richard Hughes 2006-11-03 19:18:05 UTC
(In reply to comment #12)
> Okay, I did download the cvs version, and am implementing the fix with
> gconf-key.

Good man, thanks for this.

> What should be the name of the key? "enable_idle_event_when_lid_closed",
> "always_enable_idle_events", "ignore_idle_when_lid_closed" , other ?

always_enable_idle_events

> How do I get access to commit changes to cvs ?

For the first couple of patches, attach it to the bugreport, and I will commit it with you as author. If you get really keen and want to fix more stuff, then is the time to get commit access.

> I am thinking dim_on_idle should always be disabled when lid=closed. I will
> implement this to.

Why? If the lid is closed then the backlight should be off and we won't dim anything.

> I already did try it out, by changing the ubuntu source packages, and it works
> great, so now I am merging my changes to cvs source... which differs some!! ;-)

Yes, I've made big changes, apolgies ;-)

Richard.


Comment 14 Johannes Hessellund 2006-11-03 21:00:31 UTC
(In reply to comment #13)
> > How do I get access to commit changes to cvs ?
> 
> For the first couple of patches, attach it to the bugreport, and I will commit
> it with you as author. If you get really keen and want to fix more stuff, then
> is the time to get commit access.

I am a bit unfamiliar with creating patches. What are the easy steps, any easy pointers?

Sounds great. I do have a few ideas, which might end up in another bug-report/feature request. I haven't been coding for real the last 1½ year, so its great exercise besides my law study.

 
> > I am thinking dim_on_idle should always be disabled when lid=closed. I will
> > implement this to.
> 
> Why? If the lid is closed then the backlight should be off and we won't dim
> anything.
> 

In ubuntu I always get this small window indicating brightness level. If I enabled dim on idle, I will also get these brightness indications even if lid closed. Thats the reason I will ensure dim is never done when lid is closed.

> 
> Yes, I've made big changes, apolgies ;-)
> 
> Richard.
> 

Comment 15 Johannes Hessellund 2006-11-03 21:50:24 UTC
Created attachment 75965 [details] [review]
Lid_closed.patch

gpm-manager.c and gpm-conf.h involved
Comment 16 Johannes Hessellund 2006-11-03 21:53:51 UTC
used cvs diff -N -u > lid_closed.patch to create patch. Hope this is the right way for you.

I would like to disable the screensaver throttling when always_enable_idle_events=true. I think this should be done in button_pressed_cb in gpm-screensaver.c, but I am not sure of the best way to get a gpmconf instance!?
Comment 17 Richard Hughes 2006-11-03 22:13:02 UTC
(In reply to comment #16)
> used cvs diff -N -u > lid_closed.patch to create patch. Hope this is the right
> way for you.

Yes this is great.

> I would like to disable the screensaver throttling when
> always_enable_idle_events=true. I think this should be done in
> button_pressed_cb in gpm-screensaver.c, but I am not sure of the best way to
> get a gpmconf instance!?

Have a look in gpm-screensaver.c and search for conf. You'll see we create an instance, use it, and then unref it at the end.

If we are doing things like this, then the gconf key should probably be called something like:

use_docked_settings

or something like that as we're not talking about idle anymore, we're doing other stuff also.

Richard.
Comment 18 Johannes Hessellund 2006-11-06 18:26:31 UTC
Created attachment 76103 [details] [review]
lid_closed.patch

gpm-conf.h
gpm-manager.c
gpm-screensaver.c
changed.
Comment 19 Johannes Hessellund 2006-11-06 18:31:00 UTC
gconf key: laptop_with_ext_mon
OK ?

Maybe I found a new issue. Lid button is not checked on initialization anymore ? If start g-p-m with lid closed, it thinks its open. Have to open and close before it updates the lid_closed var. !?

Else I think the patch is okay.

I hope we add support for HAL to detect external monitors soon, and then we doesn't need the gconf key any longer.

Please have a look at my minor changes.
Comment 20 Richard Hughes 2006-11-08 21:00:55 UTC
Applied to CVS HEAD. Well done, the patch looked great.

2006-11-08  Richard Hughes <richard@hughsie.com>

	* data/gnome-power-manager.schemas.in:
	* src/gpm-conf.h:
	* src/gpm-manager.c: (idle_changed_cb):
	* src/gpm-screensaver.c: (update_lid_throttle):
	Apply a patch from Johannes Hansen (slightly tweaked by me)
	to better support using a laptop with an external monitor and
	keyboard connected. This uses a gconf key for now, but support
	should be added to HAL in the future to detect this docked
	case automatically. Fixes #365016.

It would be good if you can fix the lid detection to coldplug correctly on startup - many thanks.

Richard.