文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>how to use udev-0.84

how to use udev-0.84

时间:2007-01-24  来源:junglegq

<style>!-- @page { size: 8.5in 11in; margin: 0.79in } P { margin-bottom: 0.08in } H1 { margin-bottom: 0.08in } H1.western { font-family: "AR PL New Sung", sans-serif; font-size: 16pt } H1.cjk { font-family: "文鼎PL新宋"; font-size: 16pt } H1.ctl { font-family: "Tahoma"; font-size: 16pt } --> </style>

How to use UDEV


Version: Linpus94

Date: 2007/1/5

Author: NeilGu


Table:

  1. Symptom

  2. Cause

  3. Theory

  4. Solution

  5. Result

  6. Others



Symptom:

For Linpus94, intel ipw3945 wireless card can't work correctly by just loading its kernel module.


Cause:

Because of the private license of the most kernel drivers for the wireless cards, most of them made a binary file named firmware, which should be used by some special applications when we want to use this card.

For ipw3945 wireless driver, there is an application called “ipw3945d” which invokes a firmware named “ipw3945.ucode”. So if we'll use this card, we have to run the app”ipw3945d”, besides loading kernel module.



Theory:

In Linpus94, we use udev-0.84.

Udev will get messages from kernel when app “/sbin/udevd -d” is running.

Udev gets configure files from directory “/etc/udev/*” including all rules and global configuration.

In rules directory, udev read each line of each file in lexical order. When it finds one rule that fully matches the keys of the current kernel events, it just does the assignment and never searches the following entries, even match.


How about the kernel event?

When kernel get some messages that some device has been found or added to the system, traditionally device driver will export some important information about the device, such as “class”, “vendor”, “device”, “size”, “serials” etc.

most of the hardware devices belongs to some classes, such as block, char, video, sound, etc. so one of the kernel's job is export these messages to special virtual filename named “sysfs”, which often mounted as “/sys”. We can get a lot messages from dir “/sys” exported by kernel modules. For example, ide harddisk can be found under dir “/sys/block/hda”.

Next, udev will get all these messages from sysfs. it search 2 diretory “/sys/block” and “/sys/class” for one file named”dev”. After that, for simplest use, udev can match some messages and assign a device file dynamically. Actually, “eth0”, “hda”, “fb0”, “fd0”... have been made in the manner.


Solution:

First, I don't wish to use some shell script to do this fixing. It's so ridiculous for distrobution of Linpus94.

Defaultly, kernel will inform some events to a special app with user space to deal with device configuration, which app is previously named “hotplug”. But from udev-0.84, UDEV has replaced “hotplug” as the default app. And when kernel inform to the udev, it can run some command that we ordered before.

So if we can make some rules for udev, maybe we can fix the ipw3945 problem.

Actually, when system boots, kernel loads all the necessary modules including “ipw3945.ko”. But unluckily, the kernel module “ipw3945.ko” doesn't export to sysfs any messages that udev needs. In other words, udev can't get any information about this wireless card. Nothing could be done by udev!!! I had thought that udev could run app “/sbin/ipw3945d” to load firmware when kernel informed.

After that, when I run the app “/sbin/ipw3945d” supplied by intel, all the messages appear from sysfs and device works. So there could be some tricks in the app that inform the kernel module to support sysfs.

Conclusion:

Unluckily, I have failed to use udev to invoke the app automatically. But at least, any one else who want to use udev can get some advice from this article. After all, udev is used to take place of devfs and hotplug in mainstream system.





相关阅读 更多 +
排行榜 更多 +
味子夫

味子夫

购物比价 下载
恩猫

恩猫

购物比价 下载
街头纷争

街头纷争

动作格斗 下载