免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 6023 | 回复: 3
打印 上一主题 下一主题

问一个acpi的问题? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-10-09 00:14 |只看该作者 |倒序浏览
10可用积分
我的笔记本装了debian的lenny,每次用笔记本的Fn+F7/F6(笔记本的调节屏幕亮度的快捷键,Fn+F7变亮,Fn+F6变暗)时,都会提示:
ACPI Error (psargs-035: [\_SB_.PCI0.LPCB.FJEX.GBLS] Namespace lookup failure, AE_NOT_FOUND
ACPI Error (psparse-0530): Method parse/execution failed [\_SB_.PCI0.GFX0.LCD_._BQC] (Node f743c860), AE_NOT_FOUND
我知道笔记本是通过acpi调节屏幕亮度的,我也安装了针对我的本本lifebook S6311的内核补丁,手动直接修改/sys/devices/platform/fujitsu-laptop目录下面的lcd_level的数值(0-7)就可以从最暗到最亮修改屏幕亮度,可是我还装了acpid和gnome-brightness-applet,然而在/etc/acpi/目录下面有许多像thinkpad-brightness-up.sh之类的脚本文件,还有索尼的,华硕的,等等,可是就是没有富士通的,因此我怀疑问题就出在这里,可能是acpi和fujitsu_laptop这个内核补丁冲突了。
最后还有一点就是gnome-brightness-applet对Fn+F7/F6好像有响应,可是响应就是直接从当前亮度直接跳到最大亮度,而不是渐进的,不管我按Fn+F6还是Fn+F7,而且不能降低亮度(用快捷键),但是系统对Fn+F8/F9(调节喇叭音量到最小/最大)的响应却是完美的,因此很迷惑,还有就是当从命令行模式切换到X模式的时候系统会自动降低屏幕亮度。
以上就是我的系统存在的问题,希望达人能给我指出问题处在哪里,该如何解决,小弟谢了先!!!
下面是从linux kernel driver database里面找到的信息:
General informations

FUJITSU_LAPTOP (CONFIG_FUJITSU_LAPTOP) is a Linux kernel configuration option of type 'tristate (i.e. modulizable)'.
Help text

This is a driver for laptops built by Fujitsu:

* P2xxx/P5xxx/S6xxx/S7xxx series Lifebooks * Possibly other Fujitsu laptop models * Tested with S6410 and S7020

It adds support for LCD brightness control and some hotkeys.

If you have a Fujitsu laptop, say Y or M here.
Other informations

    * Defined in: drivers/misc/Kconfig
    * Module built: fujitsu-laptop

Hardware
LKDDb

Raw data from LKDDb:

    * lkddb acpi "FUJ02B1" :: CONFIG_FUJITSU_LAPTOP :: drivers/misc/fujitsu-laptop.c
    * lkddb acpi "FUJ02E3" :: CONFIG_FUJITSU_LAPTOP :: drivers/misc/fujitsu-laptop.c
    * lkddb module fujitsu-laptop "Fujitsu Laptop Extras" :: CONFIG_FUJITSU_LAPTOP :: drivers/misc/Kconfig
    * lkddb platform "fujitsu-laptop" :: CONFIG_FUJITSU_LAPTOP :: drivers/misc/fujitsu-laptop.c
    * lkddb pnp "FUJ02B1" :: CONFIG_FUJITSU_LAPTOP :: drivers/misc/fujitsu-laptop.c
    * lkddb pnp "FUJ02E3" :: CONFIG_FUJITSU_LAPTOP :: drivers/misc/fujitsu-laptop.c
    * lkddb pnp "FUJ02bf" :: CONFIG_FUJITSU_LAPTOP :: drivers/misc/fujitsu-laptop.c

Sources

    * Linux Kernel, version 2.6.27-rc5
    * Linux Kernel Driver DataBase (LKDDb)
下面是fujitsu_laptop.c的源代码:
/*-*-linux-c-*-*/
   2
   3/*
   4  Copyright (C) 2007 Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
   5  Based on earlier work:
   6    Copyright (C) 2003 Shane Spencer <shane@bogomip.com>
   7    Adrian Yee <brewt-fujitsu@brewt.org>
   8
   9  Templated from msi-laptop.c which is copyright by its respective authors.
  10
  11  This program is free software; you can redistribute it and/or modify
  12  it under the terms of the GNU General Public License as published by
  13  the Free Software Foundation; either version 2 of the License, or
  14  (at your option) any later version.
  15
  16  This program is distributed in the hope that it will be useful, but
  17  WITHOUT ANY WARRANTY; without even the implied warranty of
  18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  19  General Public License for more details.
  20
  21  You should have received a copy of the GNU General Public License
  22  along with this program; if not, write to the Free Software
  23  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  24  02110-1301, USA.
  25 */
  26
  27/*
  28 * fujitsu-laptop.c - Fujitsu laptop support, providing access to additional
  29 * features made available on a range of Fujitsu laptops including the
  30 * P2xxx/P5xxx/S6xxx/S7xxx series.
  31 *
  32 * This driver exports a few files in /sys/devices/platform/fujitsu-laptop/;
  33 * others may be added at a later date.
  34 *
  35 *   lcd_level - Screen brightness: contains a single integer in the
  36 *   range 0..7. (rw)
  37 *
  38 * In addition to these platform device attributes the driver
  39 * registers itself in the Linux backlight control subsystem and is
  40 * available to userspace under /sys/class/backlight/fujitsu-laptop/.
  41 *
  42 * This driver has been tested on a Fujitsu Lifebook S7020.  It should
  43 * work on most P-series and S-series Lifebooks, but YMMV.
  44 */
  45
  46#include <linux/module.h>
  47#include <linux/kernel.h>
  48#include <linux/init.h>
  49#include <linux/acpi.h>
  50#include <linux/dmi.h>
  51#include <linux/backlight.h>
  52#include <linux/platform_device.h>
  53
  54#define FUJITSU_DRIVER_VERSION "0.3"
  55
  56#define FUJITSU_LCD_N_LEVELS 8
  57
  58#define ACPI_FUJITSU_CLASS              "fujitsu"
  59#define ACPI_FUJITSU_HID                "FUJ02B1"
  60#define ACPI_FUJITSU_DRIVER_NAME        "Fujitsu laptop FUJ02B1 ACPI extras driver"
  61#define ACPI_FUJITSU_DEVICE_NAME        "Fujitsu FUJ02B1"
  62
  63struct fujitsu_t {
  64        acpi_handle acpi_handle;
  65        struct backlight_device *bl_device;
  66        struct platform_device *pf_device;
  67
  68        unsigned long fuj02b1_state;
  69        unsigned int brightness_changed;
  70        unsigned int brightness_level;
  71};
  72
  73static struct fujitsu_t *fujitsu;
  74
  75/* Hardware access */
  76
  77static int set_lcd_level(int level)
  78{
  79        acpi_status status = AE_OK;
  80        union acpi_object arg0 = { ACPI_TYPE_INTEGER };
  81        struct acpi_object_list arg_list = { 1, &arg0 };
  82        acpi_handle handle = NULL;
  83
  84        if (level < 0 || level >= FUJITSU_LCD_N_LEVELS)
  85                return -EINVAL;
  86
  87        if (!fujitsu)
  88                return -EINVAL;
  89
  90        status = acpi_get_handle(fujitsu->acpi_handle, "SBLL", &handle);
  91        if (ACPI_FAILURE(status)) {
  92                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SBLL not present\n");
  93                return -ENODEV;
  94        }
  95
  96        arg0.integer.value = level;
  97
  98        status = acpi_evaluate_object(handle, NULL, &arg_list, NULL);
  99        if (ACPI_FAILURE(status))
100                return -ENODEV;
101
102        return 0;
103}
104
105static int get_lcd_level(void)
106{
107        unsigned long state = 0;
108        acpi_status status = AE_OK;
109
110        // Get the Brightness
111        status =
112            acpi_evaluate_integer(fujitsu->acpi_handle, "GBLL", NULL, &state);
113        if (status < 0)
114                return status;
115
116        fujitsu->fuj02b1_state = state;
117        fujitsu->brightness_level = state & 0x0fffffff;
118
119        if (state & 0x80000000)
120                fujitsu->brightness_changed = 1;
121        else
122                fujitsu->brightness_changed = 0;
123
124        return fujitsu->brightness_level;
125}
126
127/* Backlight device stuff */
128
129static int bl_get_brightness(struct backlight_device *b)
130{
131        return get_lcd_level();
132}
133
134static int bl_update_status(struct backlight_device *b)
135{
136        return set_lcd_level(b->props.brightness);
137}
138
139static struct backlight_ops fujitsubl_ops = {
140        .get_brightness = bl_get_brightness,
141        .update_status = bl_update_status,
142};
143
144/* Platform device */
145
146static ssize_t show_lcd_level(struct device *dev,
147                              struct device_attribute *attr, char *buf)
148{
149
150        int ret;
151
152        ret = get_lcd_level();
153        if (ret < 0)
154                return ret;
155
156        return sprintf(buf, "%i\n", ret);
157}
158
159static ssize_t store_lcd_level(struct device *dev,
160                               struct device_attribute *attr, const char *buf,
161                               size_t count)
162{
163
164        int level, ret;
165
166        if (sscanf(buf, "%i", &level) != 1
167            || (level < 0 || level >= FUJITSU_LCD_N_LEVELS))
168                return -EINVAL;
169
170        ret = set_lcd_level(level);
171        if (ret < 0)
172                return ret;
173
174        return count;
175}
176
177static DEVICE_ATTR(lcd_level, 0644, show_lcd_level, store_lcd_level);
178
179static struct attribute *fujitsupf_attributes[] = {
180        &dev_attr_lcd_level.attr,
181        NULL
182};
183
184static struct attribute_group fujitsupf_attribute_group = {
185        .attrs = fujitsupf_attributes
186};
187
188static struct platform_driver fujitsupf_driver = {
189        .driver = {
190                   .name = "fujitsu-laptop",
191                   .owner = THIS_MODULE,
192                   }
193};
194
195/* ACPI device */
196
197static int acpi_fujitsu_add(struct acpi_device *device)
198{
199        int result = 0;
200        int state = 0;
201
202        ACPI_FUNCTION_TRACE("acpi_fujitsu_add";
203
204        if (!device)
205                return -EINVAL;
206
207        fujitsu->acpi_handle = device->handle;
208        sprintf(acpi_device_name(device), "%s", ACPI_FUJITSU_DEVICE_NAME);
209        sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS);
210        acpi_driver_data(device) = fujitsu;
211
212        result = acpi_bus_get_power(fujitsu->acpi_handle, &state);
213        if (result) {
214                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
215                                  "Error reading power state\n");
216                goto end;
217        }
218
219        printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
220               acpi_device_name(device), acpi_device_bid(device),
221               !device->power.state ? "on" : "off";
222
223      end:
224
225        return result;
226}
227
228static int acpi_fujitsu_remove(struct acpi_device *device, int type)
229{
230        ACPI_FUNCTION_TRACE("acpi_fujitsu_remove";
231
232        if (!device || !acpi_driver_data(device))
233                return -EINVAL;
234        fujitsu->acpi_handle = NULL;
235
236        return 0;
237}
238
239static const struct acpi_device_id fujitsu_device_ids[] = {
240        {ACPI_FUJITSU_HID, 0},
241        {"", 0},
242};
243
244static struct acpi_driver acpi_fujitsu_driver = {
245        .name = ACPI_FUJITSU_DRIVER_NAME,
246        .class = ACPI_FUJITSU_CLASS,
247        .ids = fujitsu_device_ids,
248        .ops = {
249                .add = acpi_fujitsu_add,
250                .remove = acpi_fujitsu_remove,
251                },
252};
253
254/* Initialization */
255
256static int __init fujitsu_init(void)
257{
258        int ret, result;
259
260        if (acpi_disabled)
261                return -ENODEV;
262
263        fujitsu = kmalloc(sizeof(struct fujitsu_t), GFP_KERNEL);
264        if (!fujitsu)
265                return -ENOMEM;
266        memset(fujitsu, 0, sizeof(struct fujitsu_t));
267
268        result = acpi_bus_register_driver(&acpi_fujitsu_driver);
269        if (result < 0) {
270                ret = -ENODEV;
271                goto fail_acpi;
272        }
273
274        /* Register backlight stuff */
275
276        fujitsu->bl_device =
277            backlight_device_register("fujitsu-laptop", NULL, NULL,
278                                      &fujitsubl_ops);
279        if (IS_ERR(fujitsu->bl_device))
280                return PTR_ERR(fujitsu->bl_device);
281
282        fujitsu->bl_device->props.max_brightness = FUJITSU_LCD_N_LEVELS - 1;
283        ret = platform_driver_register(&fujitsupf_driver);
284        if (ret)
285                goto fail_backlight;
286
287        /* Register platform stuff */
288
289        fujitsu->pf_device = platform_device_alloc("fujitsu-laptop", -1);
290        if (!fujitsu->pf_device) {
291                ret = -ENOMEM;
292                goto fail_platform_driver;
293        }
294
295        ret = platform_device_add(fujitsu->pf_device);
296        if (ret)
297                goto fail_platform_device1;
298
299        ret =
300            sysfs_create_group(&fujitsu->pf_device->dev.kobj,
301                               &fujitsupf_attribute_group);
302        if (ret)
303                goto fail_platform_device2;
304
305        printk(KERN_INFO "fujitsu-laptop: driver " FUJITSU_DRIVER_VERSION
306               " successfully loaded.\n";
307
308        return 0;
309
310      fail_platform_device2:
311
312        platform_device_del(fujitsu->pf_device);
313
314      fail_platform_device1:
315
316        platform_device_put(fujitsu->pf_device);
317
318      fail_platform_driver:
319
320        platform_driver_unregister(&fujitsupf_driver);
321
322      fail_backlight:
323
324        backlight_device_unregister(fujitsu->bl_device);
325
326      fail_acpi:
327
328        kfree(fujitsu);
329
330        return ret;
331}
332
333static void __exit fujitsu_cleanup(void)
334{
335        sysfs_remove_group(&fujitsu->pf_device->dev.kobj,
336                           &fujitsupf_attribute_group);
337        platform_device_unregister(fujitsu->pf_device);
338        platform_driver_unregister(&fujitsupf_driver);
339        backlight_device_unregister(fujitsu->bl_device);
340
341        acpi_bus_unregister_driver(&acpi_fujitsu_driver);
342
343        kfree(fujitsu);
344
345        printk(KERN_INFO "fujitsu-laptop: driver unloaded.\n";
346}
347
348module_init(fujitsu_init);
349module_exit(fujitsu_cleanup);
350
351MODULE_AUTHOR("Jonathan Woithe";
352MODULE_DESCRIPTION("Fujitsu laptop extras support";
353MODULE_VERSION(FUJITSU_DRIVER_VERSION);
354MODULE_LICENSE("GPL";
355
356static struct pnp_device_id pnp_ids[] = {
357        { .id = "FUJ02bf" },
358        { .id = "" }
359};
360MODULE_DEVICE_TABLE(pnp, pnp_ids);
361

论坛徽章:
3
金牛座
日期:2014-06-14 22:04:062015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:49:45
2 [报告]
发表于 2008-10-09 09:35 |只看该作者
比较专业,等待牛人解惑!

论坛徽章:
0
3 [报告]
发表于 2008-10-13 13:22 |只看该作者
77static int set_lcd_level(int level)
  78{
  79        acpi_status status = AE_OK;
  80        union acpi_object arg0 = { ACPI_TYPE_INTEGER };
  81        struct acpi_object_list arg_list = { 1, &arg0 };
  82        acpi_handle handle = NULL;
  83
  84        if (level < 0 || level >= FUJITSU_LCD_N_LEVELS)
  85                return -EINVAL;
  86
  87        if (!fujitsu)
  88                return -EINVAL;
  89
  90        status = acpi_get_handle(fujitsu->acpi_handle, "SBLL", &handle);
  91        if (ACPI_FAILURE(status)) {
  92                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SBLL not present\n");
  93                return -ENODEV;
  94        }
  95
  96        arg0.integer.value = level;
  97
  98        status = acpi_evaluate_object(handle, NULL, &arg_list, NULL);
  99        if (ACPI_FAILURE(status))
100                return -ENODEV;
101
102        return 0;
103}
我觉得这函数里面调的acpi_evaluate_object可能有问题,set的时候参数给的有点奇怪
LZ好象没把它的代码贴出来哦

另外LZ也可以把调声音的那驱动找出来,跟这个对比一下,就可以找到哪的问题了撒~
两种调节所做的事情都差不多,肯定只是最后调用的那个底层的API不同而已,一个调声音一个调亮度~

我也不太懂,抛砖引玉了~~

[ 本帖最后由 cloudice 于 2008-10-13 13:28 编辑 ]

论坛徽章:
0
4 [报告]
发表于 2008-10-14 10:33 |只看该作者
BIOS

bios里面的ACPI是否在安装Debian之前打开了

一点实际经验,不一定是这个问题
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP