Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 158685 - smartdimmer - tool to Change LCD brightness on Geforce Go 6200/7200 cards (new ebuild)
Summary: smartdimmer - tool to Change LCD brightness on Geforce Go 6200/7200 cards (ne...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Default Assignee for New Packages
URL: http://www.acc.umu.se/~erikw/program/...
Whiteboard: sunrise suggested
Keywords: EBUILD
Depends on:
Blocks:
 
Reported: 2006-12-20 14:16 UTC by Alessandro Di Marco
Modified: 2009-03-28 02:07 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
smartdimmer ebuild (smartdimmer-0.1.ebuild,705 bytes, text/plain)
2006-12-20 14:19 UTC, Alessandro Di Marco
Details
Cool fading effect à la MacBook (smartdimmer-fading.patch,5.12 KB, patch)
2006-12-20 14:34 UTC, Alessandro Di Marco
Details | Diff
Cool fading effect à la MacBook (fixed disclaimer) (smartdimmer-fading.patch,5.13 KB, patch)
2006-12-20 14:48 UTC, Alessandro Di Marco
Details | Diff
Smartdimmer ebuild with amd64 keyword (smartdimmer-0.1.ebuild,683 bytes, text/plain)
2007-12-16 14:03 UTC, Antonio Quartulli
Details
Smartdimmer ebuild with amd64 keyword - script corrections (smartdimmer-0.1.ebuild,653 bytes, text/plain)
2007-12-16 14:35 UTC, Antonio Quartulli
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alessandro Di Marco 2006-12-20 14:16:42 UTC
Small tool to adjust screen brightness on nVidia cards that supports 
SmartDimmer. Tested both with nVIDIA Geforce Go 6200 (on a Sony Vaio VGN-S480
laptop) and with nVIDIA Geforce Go 7200 (on a Sony Vaio VGN-SZ38GP
laptop.)
Comment 1 Alessandro Di Marco 2006-12-20 14:19:20 UTC
Created attachment 104467 [details]
smartdimmer ebuild

Needs the fading patch below.
Comment 2 Alessandro Di Marco 2006-12-20 14:34:10 UTC
Created attachment 104468 [details, diff]
Cool fading effect à la MacBook
Comment 3 Alessandro Di Marco 2006-12-20 14:34:10 UTC
Created attachment 104468 [details, diff]
Cool fading effect à la MacBook

Adds fading in/out capabilities to smartdimmer. Couple with a suitable screensaver to easily make a simple yet cool panel dimmer (leave me a mail for that.)
Comment 4 Alessandro Di Marco 2006-12-20 14:41:59 UTC
Comment on attachment 104468 [details, diff]
Cool fading effect à la MacBook

# Copyright (C) 2006 Alessandro Di Marco
#
# This patch is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
#
# This patch is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this patch; if not, write to the Free Software Foundation, Inc., 51 Franklin
# St, Fifth Floor, Boston, MA 02110-1301 USA
#
--- old/smartdimmer/src/smartdimmer.c	2005-07-24 05:13:46.000000000 +0200
+++ new/smartdimmer/src/smartdimmer.c	2006-12-20 23:38:51.000000000 +0100
@@ -6,6 +6,8 @@
  *                                                                            *
  * July 23, 2005                                                              *
  * Erik Waling <erikw@acc.umu.se>                                             *
+ *                                                                            *
+ * Fading logic by Alessandro Di Marco <dmr@c0nc3pt.com>                      *
  ******************************************************************************/
 
 #include <stdlib.h>
@@ -16,6 +18,8 @@
 
 static struct option long_opts[] = {
     { "get"     , no_argument      , 0, 'g' },
+    { "fade"    , required_argument, 0, 'f' },
+    { "delay"   , required_argument, 0, 'e' },
     { "set"     , required_argument, 0, 's' },
     { "increase", no_argument      , 0, 'i' },
     { "decrease", no_argument      , 0, 'd' },
@@ -30,6 +34,8 @@
     printf("Options:\n");
     printf("\t-g  --get\t\tQuery brightness level.\n");
     printf("\t-s  --set <level>\tSet brightness level (%d-%d)\n", MIN_LEVEL, MAX_LEVEL);
+    printf("\t-f  --fade <level>\tFade in/out up to the given brightness level (%d-%d)\n", MIN_LEVEL, MAX_LEVEL);
+    printf("\t-e  --delay <usecs>\tFade cycle delay\n");
     printf("\t-i  --increase\t\tIncrease brightness with one level.\n");
     printf("\t-d  --decrease\t\tDecrease brightness with one level.\n");
     printf("\t-h  --help\t\tPrints this help text.\n\n");
@@ -46,6 +52,27 @@
     nv_card.PMC[PMC_SMARTDIM_OFFSET/4] = (level << SMARTDIM_SHIFT) | (nv_card.PMC[PMC_SMARTDIM_OFFSET/4] & ~SMARTDIM_MASK); 
 }
 
+void sd_fade_level(int end, unsigned long delay) {
+    int i, start = sd_get_level();
+
+    if (end < MIN_LEVEL)
+	end = MIN_LEVEL;
+    if (end > MAX_LEVEL)
+	end = MAX_LEVEL;
+
+    if (end >= start) {
+	for (i = start + 1; i <= end; i++) {
+	    nv_card.PMC[PMC_SMARTDIM_OFFSET/4] = (i << SMARTDIM_SHIFT) | (nv_card.PMC[PMC_SMARTDIM_OFFSET/4] & ~SMARTDIM_MASK);
+	    usleep(delay);
+	}
+    } else {
+	for (i = start - 1; i >= end; i--) {
+	    nv_card.PMC[PMC_SMARTDIM_OFFSET/4] = (i << SMARTDIM_SHIFT) | (nv_card.PMC[PMC_SMARTDIM_OFFSET/4] & ~SMARTDIM_MASK);
+	    usleep(delay);
+	}
+    }
+}
+
 int sd_get_level() {
     return (nv_card.PMC[PMC_SMARTDIM_OFFSET/4] & SMARTDIM_MASK) >> SMARTDIM_SHIFT;
 }
@@ -65,6 +92,7 @@
 int main(int argc, char *argv[]) {
     
     int optind = 0, options = 0, setvalue = 0;
+    unsigned long delay = 7000;
     int c;
     
     if (argc < 2) {
@@ -72,7 +100,7 @@
         return 0;
     }
     
-    while ((c = getopt_long(argc, argv, "gs:idh", long_opts, &optind)) != -1) {
+    while ((c = getopt_long(argc, argv, "gf:s:e:idh", long_opts, &optind)) != -1) {
         switch (c) {
             case '?':
                 fprintf(stderr, "\nTry `%s --help' for help.\n", argv[0]);
@@ -93,6 +121,26 @@
                    return 1;
                }
                break;
+	    case 'e':
+	       if (isdigit(*optarg)) {
+		   delay = atol(optarg);
+		   options |= DEL_BIT;
+	       } else {
+		   fprintf(stderr, "Illegal option value (-e): "
+			   "Value has to be a non-negative number.\n");
+		   return 1;
+	       }
+	       break;
+	    case 'f':
+	       if (isdigit(*optarg)) {
+		   setvalue = atoi(optarg);
+		   options |= FAD_BIT;
+	       } else {
+		   fprintf(stderr, "Illegal option value (-f): "
+			   "Value has to be a non-negative number.\n");
+		   return 1;
+	       }
+	       break;
             case 'i':
                options |= INC_BIT;
                break;
@@ -102,7 +150,7 @@
         }
     } 
     
-    if (!options) {
+    if (!options || ((options & DEL_BIT) && !(options & FAD_BIT))) {
         sd_usage(argv[0]);
         return 1;
     }
@@ -125,6 +173,9 @@
     if (options & SET_BIT)
         sd_set_level(setvalue);
     
+    if (options & FAD_BIT)
+	sd_fade_level(setvalue, delay);
+
     if (options & GET_BIT)
         printf("SmartDimmer level: %d\n", sd_get_level());
     
--- old/smartdimmer/src/smartdimmer.h	2005-07-24 05:11:50.000000000 +0200
+++ new/smartdimmer/src/smartdimmer.h	2006-12-20 23:23:07.000000000 +0100
@@ -27,9 +27,12 @@
 #define GET_BIT    2
 #define INC_BIT    4
 #define DEC_BIT    8
+#define FAD_BIT    16
+#define DEL_BIT    32
 
 /* function prototypes */
 void sd_set_level(int level);
+void sd_fade_level(int level, unsigned long delay);
 int sd_get_level();
 int sd_init();
 void sd_usage();
Comment 5 Alessandro Di Marco 2006-12-20 14:48:18 UTC
Created attachment 104469 [details, diff]
Cool fading effect à la MacBook (fixed disclaimer)
Comment 6 Alessandro Di Marco 2006-12-20 14:48:18 UTC
Created attachment 104469 [details, diff]
Cool fading effect à la MacBook (fixed disclaimer)

Adds fading in/out capabilities to smartdimmer. Couple with a suitable
screensaver to easily make a simple yet cool panel dimmer (leave me a mail for
that.)
Comment 7 Antonio Quartulli 2007-12-16 14:03:45 UTC
Created attachment 138612 [details]
Smartdimmer ebuild with amd64 keyword

It is the same ebuild at the top, with amd64 keyword.
I am testing it on my amd64 gentoo
Comment 8 Antonio Quartulli 2007-12-16 14:35:49 UTC
Created attachment 138618 [details]
Smartdimmer ebuild with amd64 keyword - script corrections

Now it has generalized path.
Comment 9 Valery Novikov 2008-05-09 08:04:22 UTC
(In reply to comment #8)
> Created an attachment (id=138618) [edit]
> Smartdimmer ebuild with amd64 keyword - script corrections
> 
> Now it has generalized path.
> 

Thanks Antonio! Latest ebuild for amd64 is worked on x86 & amd64 machines.
I've check it on nVIDIA Geforce Go 7400.

Guys, is already possible to include this ebuild to main portage tree?
Comment 10 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2009-03-28 02:07:57 UTC
(this is an automated message based on filtering criteria that matched this bug)
'EBUILD' is in the KEYWORDS which should mean that there is a ebuild attached 
to this bug.
This bug is assigned to maintainer-wanted which means that it is not in the 
main tree.
Heuristics show that no Gentoo developer has commented on your ebuild.

Hello, The Gentoo Team would like to firstly thank you for your ebuild 
submission. We also apologize for not being able to accommodate you in a timely
manner. There are simply too many new packages.

Allow me to use this opportunity to introduce you to Gentoo Sunrise. The 
sunrise overlay[1] is a overlay for Gentoo which we allow trusted users to 
commit to and all users can have ebuilds reviewed by Gentoo devs for entry 
into the overlay. So, the sunrise team is suggesting that you look into this 
and submit your ebuild to the overlay where even *you* can commit to. =)

Because this is a mass message, we are also asking you to be patient with us. 
We anticipate a large number of requests in a short time. 

Thanks,
On behalf of the Gentoo Sunrise Team,
Jeremy.

[1]: http://www.gentoo.org/proj/en/sunrise/
[2]: http://overlays.gentoo.org/proj/sunrise/wiki/SunriseFaq