[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Suspending successfully from X-windows



On Tuesday 29 January 2002 07:45 am, Brian P. Flaherty wrote:
> Oliver Johns <ojohns@metacosmos.org> writes:
>
> [some material deleted below]
>
> > Some notebooks seem to suspend OK from a virtual terminal, but not
> > from X-windows.  I had that problem and found a solution.  The setup
> > here is a Gateway Solo3350 with a Phoenix NoteBIOS 4.0 release 6.0
> > (serial 25.04). This trick may apply also to other notebooks using
> > that same BIOS.
>
> Well, I tried it on my Gateway Solo 9300 and it appears to work.  My
> BIOS is the same 4.0 and release 6.0, but I don't see a serial
> number.  At boot time it also says system software version 16.53.  I
> don't know if that is relevant or not.  I have only tried suspending X
> twice so far, but so far so good.

Great!  There's another data point.

>
> > -------------------------------------------------------------
> > #!/bin/sh
> >
> > XVT=7
> > if [ -x fgconsole -a -x chvt ]; then
> > [ $(fgconsole) -eq $XVT ] && chvt $XVT
> > fi
>
> I am still learning bash scripting, and the above is not clear to me.
> To me, it looks like line three is saying "if the current vt is 7 then
> switch to vt 7."  This cannot be correct, so what does it really mean?

No, you've got it exactly right.  If it is in vt7 (i.e., in X) then it 
"switches" to vt7 (i.e., to where it already is)..  Of course if 
$(fgconsole) does not return 7, then you are already in another console 
and so don't need to do anything, since suspend already works then.

I tried it first switching to another console.  Then, by accident, I set 
it to switch to the 7 it was already in.  It still works.  What it seems 
to be doing is making X do something (or stopping X from doing 
something??) regardless of what vt you're switching to.

>
> Also, are there any problems with running fgconsole and chvt suid
> root?  Does another group have whatever priviledges are necessary to
> do this (or could one be created)?  

Maybe.  But probably some of X would have to be set sgid for that to work. 
I think that on a laptop it is not very much of a risk to have these two 
utilities suid root.  

Could the user and the programs
> belong to this other group instead and would this work?  My laptop is
> actually never on-line directly (it is only ever behind an IP
> masquerading desktop), so maybe these programs running suid root is
> not so bad?

Yeah, that's my opinion.  My laptop is never exposed to the raw internet, 
either.

>
> Thanks for posting this.  It will be nice not to switch to VT 1--6
> prior to closing the lid.
>
> Brian

-- 
Oliver Johns <ojohns@metacosmos.org>
San Francisco, California USA
GPG KeyID=A2ACE692
GPG Fingerprint=BE4A C1B8 EB0D 8FD9 737D  CE4A 1E56 BF9B A2AC E692



Reply to: