r4302 - trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-bt/src

erin_yueh at sita.openmoko.org erin_yueh at sita.openmoko.org
Thu Apr 3 06:21:24 CEST 2008


Author: erin_yueh
Date: 2008-04-03 06:21:21 +0200 (Thu, 03 Apr 2008)
New Revision: 4302

Modified:
   trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-bt/src/openmoko-panel-bt.c
Log:
openmoko-panel-bt: update BT power_on and reset path name (Erin Yueh)


Modified: trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-bt/src/openmoko-panel-bt.c
===================================================================
--- trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-bt/src/openmoko-panel-bt.c	2008-04-02 21:14:52 UTC (rev 4301)
+++ trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-bt/src/openmoko-panel-bt.c	2008-04-03 04:21:21 UTC (rev 4302)
@@ -22,8 +22,8 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-#define BT_POWERON_FILENAME "/sys/class/i2c-dev/i2c-0/device/0-0008/gta01-pm-bt.0/power_on"
-#define BT_POWERON_FILENAME2 "/sys/class/i2c-dev/i2c-0/device/0-0008/neo1973-pm-bt.0/power_on"
+#define BT_POWERON_FILENAME "/sys/devices/platform/s3c2440-i2c/i2c-adapter/i2c-0/0-0073/neo1973-pm-bt.0/power_on"
+#define BT_RESET_FILENAME "/sys/devices/platform/s3c2440-i2c/i2c-adapter/i2c-0/0-0073/neo1973-pm-bt.0/reset"
 
 typedef struct {
   MokoPanelApplet *mokoapplet;
@@ -36,7 +36,6 @@
   FILE * f = fopen(BT_POWERON_FILENAME, "r+");
   int val;
 
-  if (f == NULL) f = fopen(BT_POWERON_FILENAME2, "r+");
   if (f == NULL) return -1;
 
   fscanf(f, "%i", &val);
@@ -49,7 +48,6 @@
 {
   FILE * f = fopen(BT_POWERON_FILENAME, "w");
 
-  if (f == NULL) f = fopen(BT_POWERON_FILENAME2, "w");
   if (f == NULL) return -1;
 
   fprintf(f, "%i\n", val);
@@ -59,6 +57,20 @@
   return val;
 }
 
+static int
+reset_bt_power(int val)
+{
+  FILE * f = fopen(BT_RESET_FILENAME, "w");
+
+  if (f == NULL) return -1;
+
+  fprintf(f, "%i\n", val);
+
+  fclose(f);
+
+  return val;
+}
+
 static void
 mb_panel_update(BtApplet *applet, int state)
 {
@@ -76,6 +88,7 @@
     NotifyNotification * nn;
 
     ret = set_bt_power(1);
+    ret = reset_bt_power(0);
     mb_panel_update(applet, 1);
     nn = notify_notification_new ("Bluetooth turned on", NULL, NULL, NULL);
     notify_notification_show (nn, NULL);





More information about the commitlog mailing list