Skip to content

Commit

Permalink
Attempting to add support for newer MacBooks (7,1)
Browse files Browse the repository at this point in the history
  • Loading branch information
sole committed Dec 16, 2010
1 parent 7ec87dc commit b053412
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
11 changes: 11 additions & 0 deletions pommed/pommed.c
Expand Up @@ -354,6 +354,14 @@ struct machine_ops mb_mops[] = {
/* .evdev_identify = evdev_is_wellspring3, */
},

{ /* MacBook7,1 (Core2 Duo, April 2010) */
.type = MACHINE_MACBOOK_7,
.lcd_backlight_probe = mbp_sysfs_backlight_probe,
.lcd_backlight_step = sysfs_backlight_step,
.lcd_backlight_toggle = sysfs_backlight_toggle,
/* .evdev_identify = evdev_is_wellspring3, */
},

/* MacBook Air machines */

{ /* MacBookAir1,1 (January 2008) */
Expand Down Expand Up @@ -747,6 +755,9 @@ check_machine_dmi(void)
/* Core2 Duo MacBook (October 2009) */
else if (strcmp(buf, "MacBook6,1") == 0)
ret = MACHINE_MACBOOK_6;
/* Core2 Duo MacBook (April 2010) */
else if (strcmp(buf, "MacBook7,1") == 0)
ret = MACHINE_MACBOOK_7;
/* MacBook Air (January 2008) */
else if (strcmp(buf, "MacBookAir1,1") == 0)
ret = MACHINE_MACBOOKAIR_1;
Expand Down
1 change: 1 addition & 0 deletions pommed/pommed.h
Expand Up @@ -44,6 +44,7 @@ typedef enum
MACHINE_MACBOOK_4,
MACHINE_MACBOOK_5,
MACHINE_MACBOOK_6,
MACHINE_MACBOOK_7,

MACHINE_MACBOOKAIR_1,
MACHINE_MACBOOKAIR_2,
Expand Down
8 changes: 5 additions & 3 deletions pommed/sysfs_backlight.c
Expand Up @@ -113,7 +113,7 @@ sysfs_backlight_get(void)

if (bck_driver == SYSFS_DRIVER_NONE)
return 0;

logdebug("sole ACTUAL brightness opening file = %s\n", actual_brightness[bck_driver]);
fd = open(actual_brightness[bck_driver], O_RDONLY);
if (fd < 0)
{
Expand All @@ -132,7 +132,7 @@ sysfs_backlight_get(void)
return 0;
}
close(fd);

logdebug("sole Read backlight=%s\n", buffer);
return atoi(buffer);
}

Expand Down Expand Up @@ -188,6 +188,7 @@ sysfs_backlight_set(int value)
fprintf(fp, "%d", value);

fclose(fp);
logdebug("sole opened file = %s, wrote %d\n", brightness[bck_driver], value);
}

void
Expand Down Expand Up @@ -226,7 +227,7 @@ sysfs_backlight_step(int dir)

mbpdbus_send_lcd_backlight(newval, val, LCD_USER);

lcd_bck_info.level = newval;
lcd_bck_info.level = newval;
}


Expand Down Expand Up @@ -359,6 +360,7 @@ sysfs_backlight_probe(int driver)
bck_driver = driver;

lcd_bck_info.max = sysfs_backlight_get_max();
logdebug("sole the driver is %d, max=%d\n", driver, lcd_bck_info.max);

/* Now we can fix the config */
sysfs_backlight_fix_config();
Expand Down

0 comments on commit b053412

Please sign in to comment.