Re: Mackbook pro nvidia based video backlight

2009-01-31 Thread Rui Paulo


On 30 Jan 2009, at 07:52, Alexander Leidinger wrote:

Quoting Ed Schouten e...@80386.nl (from Thu, 29 Jan 2009 15:36:06  
+0100):



* Alexander Leidinger alexan...@leidinger.net wrote:

So you want that either
- a daemon running as root is written which listens to user
 requests to set the backlight via sysctl
or
- a SUID root program is written that sets the backlight
 via sysctl
instead of
- a character device with appropriate filesystem permissions
 which allows to not go the SUID root or daemon running as
 root way
?


Yes. The primary reason is that it is more consistent with the rest  
of
the operating system. powerd also uses sysctl's instead of a  
character

device, for example.


Powerd does not interact with the user, it is doing automatic power  
management. A backlight on the other hand needs to be adjustable by  
the user.


Normally I would expect some keys on the keyboard to handle this, so  
there should be no need to have some userland stuff, but as I don't  
know about how Apple is doing this, I assume there's some valid  
reason to handle it from userland. But then there needs to be some  
easy way to let an user handle it, even if you are on the console. A  
separate daemon or a SUID root program to control the backlight  
sounds like overkill to me.


Well, easy: only let the operator group change the sysctl and add your  
appropriate user accounts to the operator group. No daemon is needed.  
This is what I thought about when doing the Intel backlight driver,  
but I never actually did it.


Regards,
--
Rui Paulo




PGP.sig
Description: This is a digitally signed message part


Re: Mackbook pro nvidia based video backlight

2009-01-31 Thread Rui Paulo


On 30 Jan 2009, at 07:52, Alexander Leidinger wrote:

Quoting Ed Schouten e...@80386.nl (from Thu, 29 Jan 2009 15:36:06  
+0100):



* Alexander Leidinger alexan...@leidinger.net wrote:

So you want that either
- a daemon running as root is written which listens to user
  requests to set the backlight via sysctl
or
- a SUID root program is written that sets the backlight
  via sysctl
instead of
- a character device with appropriate filesystem permissions
  which allows to not go the SUID root or daemon running as
  root way
?


Yes. The primary reason is that it is more consistent with the rest  
of
the operating system. powerd also uses sysctl's instead of a  
character

device, for example.


Powerd does not interact with the user, it is doing automatic power  
management. A backlight on the other hand needs to be adjustable by  
the user.


Normally I would expect some keys on the keyboard to handle this, so  
there should be no need to have some userland stuff, but as I don't  
know about how Apple is doing this, I assume there's some valid  
reason to handle it from userland. But then there needs to be some  
easy way to let an user handle it, even if you are on the console. A  
separate daemon or a SUID root program to control the backlight  
sounds like overkill to me.


Well, easy: only let the operator group change the sysctl and add your  
appropriate user accounts to the operator group. No daemon is needed.  
This is what I thought about when doing the Intel backlight driver,  
but I never actually did it.


Regards,
--
Rui Paulo



PGP.sig
Description: This is a digitally signed message part


Re: Mackbook pro nvidia based video backlight

2009-01-30 Thread Ed Schouten
* Alexander Leidinger alexan...@leidinger.net wrote:
 The ideal solution would be to integrate it into vidcontrol, calling
 some kind of ioctl on the TTY/consolectl, but syscons is too brainless
 to know anything about hardware specific features.

 Here we are back to what was proposed instead of sysctl. I have to admin 
 that I'm confused now about what you propose as a good solution.

Well, I wouldn't like it if we create character devices, just to let it
implement a single ioctl() (/dev/backlight, for example). There is
only 1 parameter that's adjustable, namely the backlight intensity. A
sysctl is a good place to store such things.

In my opinion we should only use character devices for devices that
have the semantics of a file descriptor, namely to read/write data to
it, perform select(), etc. Saying sysctl is bad, because it doesn't
allow any permissions should be considered to be a defect of sysctl, not
an advantage of devfs.

The reason why I prefer consolectl, is because it already exists and
allows related graphics parameters to be configured.

-- 
 Ed Schouten e...@80386.nl
 WWW: http://80386.nl/


pgpHpmCQvy4nL.pgp
Description: PGP signature


Re: Mackbook pro nvidia based video backlight

2009-01-30 Thread Julian Elischer

Ed Schouten wrote:

* Alexander Leidinger alexan...@leidinger.net wrote:

The ideal solution would be to integrate it into vidcontrol, calling
some kind of ioctl on the TTY/consolectl, but syscons is too brainless
to know anything about hardware specific features.
Here we are back to what was proposed instead of sysctl. I have to admin 
that I'm confused now about what you propose as a good solution.


Well, I wouldn't like it if we create character devices, just to let it
implement a single ioctl() (/dev/backlight, for example). There is
only 1 parameter that's adjustable, namely the backlight intensity. A
sysctl is a good place to store such things.



I don't know you could flash morse code in response to a write.




In my opinion we should only use character devices for devices that
have the semantics of a file descriptor, namely to read/write data to
it, perform select(), etc. Saying sysctl is bad, because it doesn't
allow any permissions should be considered to be a defect of sysctl, not
an advantage of devfs.

The reason why I prefer consolectl, is because it already exists and
allows related graphics parameters to be configured.



___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: Mackbook pro nvidia based video backlight

2009-01-30 Thread Alexander Leidinger

Quoting Ed Schouten e...@80386.nl (from Thu, 29 Jan 2009 15:36:06 +0100):


* Alexander Leidinger alexan...@leidinger.net wrote:

So you want that either
 - a daemon running as root is written which listens to user
   requests to set the backlight via sysctl
or
 - a SUID root program is written that sets the backlight
   via sysctl
instead of
 - a character device with appropriate filesystem permissions
   which allows to not go the SUID root or daemon running as
   root way
?


Yes. The primary reason is that it is more consistent with the rest of
the operating system. powerd also uses sysctl's instead of a character
device, for example.


Powerd does not interact with the user, it is doing automatic power  
management. A backlight on the other hand needs to be adjustable by  
the user.


Normally I would expect some keys on the keyboard to handle this, so  
there should be no need to have some userland stuff, but as I don't  
know about how Apple is doing this, I assume there's some valid reason  
to handle it from userland. But then there needs to be some easy way  
to let an user handle it, even if you are on the console. A separate  
daemon or a SUID root program to control the backlight sounds like  
overkill to me.



The ideal solution would be to integrate it into vidcontrol, calling
some kind of ioctl on the TTY/consolectl, but syscons is too brainless
to know anything about hardware specific features.


Here we are back to what was proposed instead of sysctl. I have to  
admin that I'm confused now about what you propose as a good solution.


Bye,
Alexander.

--
If I had any humility I would be perfect.
-- Ted Turner

http://www.Leidinger.netAlexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org   netchild @ FreeBSD.org  : PGP ID = 72077137
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: Mackbook pro nvidia based video backlight

2009-01-29 Thread Ed Schouten
* Alexander Leidinger alexan...@leidinger.net wrote:
 So you want that either
  - a daemon running as root is written which listens to user
requests to set the backlight via sysctl
 or
  - a SUID root program is written that sets the backlight
via sysctl
 instead of
  - a character device with appropriate filesystem permissions
which allows to not go the SUID root or daemon running as
root way
 ?

Yes. The primary reason is that it is more consistent with the rest of
the operating system. powerd also uses sysctl's instead of a character
device, for example.

The ideal solution would be to integrate it into vidcontrol, calling
some kind of ioctl on the TTY/consolectl, but syscons is too brainless
to know anything about hardware specific features.

-- 
 Ed Schouten e...@80386.nl
 WWW: http://80386.nl/


pgpMgbBaYMZZ3.pgp
Description: PGP signature


Re: Mackbook pro nvidia based video backlight

2009-01-29 Thread Alexander Leidinger

Quoting Ed Schouten e...@80386.nl (from Wed, 28 Jan 2009 14:43:09 +0100):


* Daniel Lannstrom o...@trekdanne.se wrote:

 I'm asking which method will be the best to interface the driver with
 userland applications?

You might want to make it a character device driver. And write a small
userland control program. Sysctl isn't really made for this kind of
functionality.


No. sysctl is good for doing stuff like this. An even better approach


So you want that either
 - a daemon running as root is written which listens to user
   requests to set the backlight via sysctl
or
 - a SUID root program is written that sets the backlight
   via sysctl
instead of
 - a character device with appropriate filesystem permissions
   which allows to not go the SUID root or daemon running as
   root way
?

Bye,
Alexander.

--
E.T. GO HOME!!!  (And take your Smurfs with you.)

http://www.Leidinger.netAlexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org   netchild @ FreeBSD.org  : PGP ID = 72077137
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: Mackbook pro nvidia based video backlight

2009-01-28 Thread Ed Schouten
* Daniel Lannstrom o...@trekdanne.se wrote:
  I'm asking which method will be the best to interface the driver with
  userland applications?
 
 You might want to make it a character device driver. And write a small
 userland control program. Sysctl isn't really made for this kind of
 functionality.

No. sysctl is good for doing stuff like this. An even better approach
would be to integrate it to the X11 driver, but I guess it will be cold
day in hell when this happens.

-- 
 Ed Schouten e...@80386.nl
 WWW: http://80386.nl/


pgp27BNLrmNeG.pgp
Description: PGP signature


Re: Mackbook pro nvidia based video backlight

2009-01-28 Thread Rui Paulo


On 28 Jan 2009, at 13:43, Ed Schouten wrote:


* Daniel Lannstrom o...@trekdanne.se wrote:
I'm asking which method will be the best to interface the driver  
with

userland applications?


You might want to make it a character device driver. And write a  
small

userland control program. Sysctl isn't really made for this kind of
functionality.


No. sysctl is good for doing stuff like this. An even better approach
would be to integrate it to the X11 driver, but I guess it will be  
cold

day in hell when this happens.


Not really. The xorg intel driver is already able to deal with this.
I don't know about NVIDIA.

--
Rui Paulo

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: Mackbook pro nvidia based video backlight

2009-01-28 Thread Rui Paulo


On 28 Jan 2009, at 13:43, Ed Schouten wrote:


* Daniel Lannstrom o...@trekdanne.se wrote:
I'm asking which method will be the best to interface the driver  
with

userland applications?


You might want to make it a character device driver. And write a  
small

userland control program. Sysctl isn't really made for this kind of
functionality.


No. sysctl is good for doing stuff like this. An even better approach
would be to integrate it to the X11 driver, but I guess it will be  
cold

day in hell when this happens.


Not really. The xorg intel driver is already able to deal with this.
I don't know about NVIDIA.

--
Rui Paulo

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: Mackbook pro nvidia based video backlight

2009-01-28 Thread Robert Noland
On Wed, 2009-01-28 at 14:29 +, Rui Paulo wrote:
 On 28 Jan 2009, at 13:43, Ed Schouten wrote:
 
  * Daniel Lannstrom o...@trekdanne.se wrote:
  I'm asking which method will be the best to interface the driver  
  with
  userland applications?
 
  You might want to make it a character device driver. And write a  
  small
  userland control program. Sysctl isn't really made for this kind of
  functionality.
 
  No. sysctl is good for doing stuff like this. An even better approach
  would be to integrate it to the X11 driver, but I guess it will be  
  cold
  day in hell when this happens.
 
 Not really. The xorg intel driver is already able to deal with this.
 I don't know about NVIDIA.

The intel ddx driver doesn't really deal with it.  On linux the drm has
code that interfaces with acpi to deal with backlight management.  For
us, afaik we handle it in acpi_video.  I've not tried to port that part
of the drm code.

I'm not certain where the best place for this function to live is
really, but for Nvidia's proprietary driver, the only option is a
seperate kernel driver.

robert.

 --
 Rui Paulo
 
 ___
 freebsd-hackers@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
 To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


signature.asc
Description: This is a digitally signed message part


Re: Mackbook pro nvidia based video backlight

2009-01-28 Thread Ed Schouten
* Rui Paulo rpa...@freebsd.org wrote:
 Not really. The xorg intel driver is already able to deal with this.
 I don't know about NVIDIA.

Yes, but that's what I mean. It will be a cold day in hell when nv
supports this. As far as I can tell, it's just a pile of obfuscated C
code.

-- 
 Ed Schouten e...@80386.nl
 WWW: http://80386.nl/


pgpfCdduX2rYB.pgp
Description: PGP signature


Re: Mackbook pro nvidia based video backlight

2009-01-28 Thread Patrick Lamaizière
Le Wed, 28 Jan 2009 17:33:28 +0100,
Ed Schouten e...@80386.nl :

  Not really. The xorg intel driver is already able to deal with this.
  I don't know about NVIDIA.
 
 Yes, but that's what I mean. It will be a cold day in hell when nv
 supports this. As far as I can tell, it's just a pile of obfuscated C
 code.

Anyway the backlight is very very high even in the console, I don't
want to use X for this, i will not be able to set it at boot-time.

Thanks for your replies, i will use both sysctl and a character device.

Regards.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Mackbook pro nvidia based video backlight

2009-01-27 Thread Patrick Lamaizière
Hello,

I've made a small driver to set the backlight level on Apple MacBook
Pro, for the models based on the Nvida video card (model 3,1 and 3,2).
(if it works on other models please tell me)

At the moment this is a quick and dirty hack, but you don't need to
wear a pair of sunglasses anymore!

Module (FreeBSD 7.1):
http://user.lamaiziere.net/patrick/ambnb-270109.tar.gz

The driver does not check if the hardware is a suitable Macbook Pro
(TODO!), so use with care. You can check the model of your Mac with
dmidecode:

Handle 0x0011, DMI type 1, 27 bytes
System Information
Manufacturer: Apple Inc.
Product Name: MacBookPro3,1
Version: 1.0

There is a sysctl hw.ambnb.level to set the level of the backlight (0 =
level = 15).

I don't have the time for the moment, but i will try to improve it a
bit.

I'm asking which method will be the best to interface the driver with
userland applications?

Regards.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: Mackbook pro nvidia based video backlight

2009-01-27 Thread Daniel Lannstrom
 I'm asking which method will be the best to interface the driver with
 userland applications?

You might want to make it a character device driver. And write a small
userland control program. Sysctl isn't really made for this kind of
functionality.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: Mackbook pro nvidia based video backlight

2009-01-27 Thread Rui Paulo

On 27 Jan 2009, at 15:00, Daniel Lannstrom wrote:


I'm asking which method will be the best to interface the driver with
userland applications?


You might want to make it a character device driver. And write a small
userland control program. Sysctl isn't really made for this kind of
functionality.


Why not? Sysctl seems perfect to handle this.

--
Rui Paulo

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org