Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_fb
Modified Files:
Tag: SPLIT
Ecore_Fb.h ecore_fb.c
Log Message:
backlight control is in... :)
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_fb/Attic/Ecore_Fb.h,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -3 -r1.1.2.4 -r1.1.2.5
--- Ecore_Fb.h 17 Feb 2003 08:33:24 -0000 1.1.2.4
+++ Ecore_Fb.h 17 Feb 2003 12:00:59 -0000 1.1.2.5
@@ -3,10 +3,10 @@
/* FIXME:
* add
- * - code to control backlight (only for ipaq for now)
* - code to control led's (only for ipaq for now)
* - code to read from /proc/hal/light_sensor or use FLITE_ON ioctl
* - code to control screen contrast
+ * maybe a new module?
* - code to get battery info
* - code to get thermal info
*/
@@ -66,7 +66,13 @@
void ecore_fb_touch_screen_calibrate_set(int xscale, int xtrans, int yscale, int
ytrans, int xyswap);
void ecore_fb_touch_screen_calibrate_get(int *xscale, int *xtrans, int *yscale, int
*ytrans, int *xyswap);
-
+
+void ecore_fb_backlight_set(int on);
+int ecore_fb_backlight_get(void);
+
+void ecore_fb_backlight_brightness_set(double br);
+double ecore_fb_backlight_brightness_get(void);
+
#ifdef __cplusplus
}
#endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_fb/Attic/ecore_fb.c,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -3 -r1.1.2.5 -r1.1.2.6
--- ecore_fb.c 16 Feb 2003 15:00:36 -0000 1.1.2.5
+++ ecore_fb.c 17 Feb 2003 12:01:00 -0000 1.1.2.6
@@ -23,9 +23,17 @@
#ifndef TS_GET_CAL
#define TS_GET_CAL 0x8014660a
#endif
+#ifndef TS_SET_BACKLIGHT
+#define TS_SET_BACKLIGHT 0x40086614
+#endif
+#ifndef TS_GET_BACKLIGHT
+#define TS_GET_BACKLIGHT 0x80086614
+#endif
typedef struct _Ecore_Fb_Ts_Event Ecore_Fb_Ts_Event;
typedef struct _Ecore_Fb_Ts_Calibrate Ecore_Fb_Ts_Calibrate;
+typedef struct _Ecore_Fb_Ts_Backlight Ecore_Fb_Ts_Backlight;
+typedef struct _Ecore_Fb_Ts_Led Ecore_Fb_Ts_Led;
typedef struct _Ecore_Fb_Ps2_Event Ecore_Fb_Ps2_Event;
struct _Ecore_Fb_Ts_Event
@@ -45,6 +53,20 @@
int xyswap;
};
+struct _Ecore_Fb_Ts_Backlight
+{
+ int on;
+ unsigned char brightness;
+};
+
+struct _Ecore_Fb_Ts_Led
+{
+ unsigned char onoff;
+ unsigned char blink_time;
+ unsigned char on_time;
+ unsigned char off_time;
+};
+
struct _Ecore_Fb_Ps2_Event
{
unsigned char button;
@@ -338,7 +360,7 @@
ecore_fb_init(const char *name)
{
int prev_flags;
-
+
_ecore_fb_init_count++;
if (_ecore_fb_init_count > 1) return _ecore_fb_init_count;
@@ -553,6 +575,77 @@
if (yscale) *yscale = cal.yscale;
if (ytrans) *ytrans = cal.ytrans;
if (xyswap) *xyswap = cal.xyswap;
+}
+
+/**
+ * Set the backlight
+ * @param on
+ *
+ * Set the backlight to the @p on state
+ */
+void
+ecore_fb_backlight_set(int on)
+{
+ Ecore_Fb_Ts_Backlight bl;
+
+ if (_ecore_fb_ts_fd < 0) return;
+ ioctl(_ecore_fb_ts_fd, TS_GET_BACKLIGHT, &bl);
+ bl.on = on;
+ ioctl(_ecore_fb_ts_fd, TS_SET_BACKLIGHT, &bl);
+}
+
+/**
+ * Get the backlight state
+ * @return The current backlight state
+ *
+ * Get the current backlight state
+ */
+int
+ecore_fb_backlight_get(void)
+{
+ Ecore_Fb_Ts_Backlight bl;
+
+ if (_ecore_fb_ts_fd < 0) return 1;
+ ioctl(_ecore_fb_ts_fd, TS_GET_BACKLIGHT, &bl);
+ return bl.on;
+}
+
+/**
+ * Set the backlight brightness
+ * @param br Brightness 0.0 to 1.0
+ *
+ * Set the backglith brightness to @p br, where 0 is darkest and 1.0 is
+ * the brightest.
+ */
+void
+ecore_fb_backlight_brightness_set(double br)
+{
+ Ecore_Fb_Ts_Backlight bl;
+ int val;
+
+ if (br < 0) br = 0;
+ if (br > 1) br = 1;
+ val = (int)(255.0 * br);
+ ioctl(_ecore_fb_ts_fd, TS_GET_BACKLIGHT, &bl);
+ bl.brightness = val;
+ ioctl(_ecore_fb_ts_fd, TS_SET_BACKLIGHT, &bl);
+}
+
+/**
+ * Get the backlight brightness
+ * @return The current backlight brigntess
+ *
+ * Get the current backlight brightness as per
+ * ecore_fb_backlight_brightness_set().
+ */
+double
+ecore_fb_backlight_brightness_get(void)
+{
+ Ecore_Fb_Ts_Backlight bl;
+
+ if (_ecore_fb_ts_fd < 0) return 1.0;
+ ioctl(_ecore_fb_ts_fd, TS_GET_BACKLIGHT, &bl);
+ return (double)bl.brightness / 255.0;
}
static void
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs