~ubuntu-branches/ubuntu/lucid/hal/lucid-proposed

« back to all changes in this revision

Viewing changes to hald/freebsd/hf-acpi.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-12-03 01:21:24 UTC
  • mto: (1.1.18 squeeze)
  • mto: This revision was merged to the branch mainline in revision 165.
  • Revision ID: james.westby@ubuntu.com-20091203012124-3573qknop973uvc2
Tags: upstream-0.5.14
ImportĀ upstreamĀ versionĀ 0.5.14

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
static const struct laptop_panel_type {
55
55
  char *access;
56
56
  char *name;
 
57
  char *get_sysctl;
57
58
  char *max_sysctl;
58
59
  int max_levels;
59
60
#define HF_ACPI_IBM_MAX_LEVELS          8
64
65
#define HF_ACPI_FUJITSU_MAX_LEVELS      8
65
66
  /* NOTE: Each new type must also be added to hf-devtree.c */
66
67
} laptop_panel_types[] = {
67
 
  { "ibm",              "IBM",          NULL,
 
68
  { "ibm",              "IBM",
 
69
    "dev.acpi_ibm.0.lcd_brightness",
 
70
    NULL,
68
71
    HF_ACPI_IBM_MAX_LEVELS },
69
 
  { "toshiba",          "Toshiba",      NULL,
 
72
  { "toshiba",          "Toshiba",
 
73
    "hw.acpi.toshiba.lcd_brightness",
 
74
    NULL,
70
75
    HF_ACPI_TOSHIBA_MAX_LEVELS },
71
 
  { "sony",             "Sony",         NULL,
 
76
  { "sony",             "Sony",
 
77
    "dev.acpi_sony.0.brightness",
 
78
    NULL,
72
79
    HF_ACPI_SONY_MAX_LEVELS },
73
 
  { "panasonic",        "Panasonic",    "hw.acpi.panasonic.lcd_brightness_max",
 
80
  { "panasonic",        "Panasonic",
 
81
    "hw.acpi.panasonic.lcd_brightness",
 
82
    "hw.acpi.panasonic.lcd_brightness_max",
74
83
    HF_ACPI_PANASONIC_MAX_LEVELS },
75
 
  { "asus",             "Asus",         NULL,
 
84
  { "asus",             "Asus",
 
85
    "hw.acpi.asus.lcd_brightness",
 
86
    NULL,
76
87
    HF_ACPI_ASUS_MAX_LEVELS },
77
 
  { "fujitsu",          "Fujitsu",      NULL,
 
88
  { "fujitsu",          "Fujitsu",
 
89
    "hw.acpi.fujitsu.lcd_brightness",
 
90
    NULL,
78
91
    HF_ACPI_FUJITSU_MAX_LEVELS }
79
92
};
80
93
 
105
118
  gboolean ispresent;
106
119
  union acpi_battery_ioctl_arg battif, battst, battinfo;
107
120
 
 
121
  if (! hf_has_sysctl("hw.acpi.battery.units"))
 
122
    return;
 
123
 
108
124
  battif.unit = battst.unit = battinfo.unit =
109
125
    hal_device_property_get_int(device, "freebsd.unit");
110
126
 
497
513
 
498
514
static HalDevice *
499
515
hf_acpi_laptop_panel_new (HalDevice *parent, int max_levels,
500
 
                          const char *max_sysctl, const char *access,
501
 
                          const char *name)
 
516
                          const char *get_sysctl, const char *max_sysctl,
 
517
                          const char *access, const char *name)
502
518
{
503
519
  HalDevice *device;
504
520
 
505
521
  g_return_val_if_fail(HAL_IS_DEVICE(parent), NULL);
506
522
 
 
523
  if (get_sysctl == NULL || ! hf_has_sysctl(get_sysctl))
 
524
    return NULL;
507
525
  device = hf_device_new(parent);
508
526
 
509
527
  hf_device_property_set_string_printf(device, "info.product", "Laptop Panel (%s)", name);
593
611
              HalDevice *panel_device;
594
612
 
595
613
              panel_device = hf_acpi_laptop_panel_new(parent,
596
 
                                                      laptop_panel_types[i].max_levels,
 
614
                                                      laptop_panel_types[i].max_levels,
 
615
                                                      laptop_panel_types[i].get_sysctl,
597
616
                                                      laptop_panel_types[i].max_sysctl,
598
617
                                                      laptop_panel_types[i].access,
599
618
                                                      laptop_panel_types[i].name);
600
 
              hf_device_preprobe_and_add(panel_device);
 
619
              if (panel_device)
 
620
                hf_device_preprobe_and_add(panel_device);
601
621
            }
602
622
        }
603
623
    }