如何分配/ dev / fbX?

时间:2010-10-20 13:29:14

标签: linux framebuffer udev

我想像下面这样分配/ dev / fbX设备 / dev / fb0用于USB-LCD设备。
/ dev / fb1用于主显示设备。
我试试。
ver.1:创建/etc/udev/rules.d/91-udev-fb.rules

KERNEL=="fb0", ATTR{name}=="VESA VGA", ACTION=="add", NAME="fd1"
KERNEL=="fb1", ATTR{name}=="I-O DATA USB-RG", ACTION=="add", NAME="fd0"

结果。
ls / dev仅显示/ dev / fb0。

ver.2:创建/etc/udev/rules.d/91-udev-fb.rules

KERNEL=="fb0", ATTR{name}=="VESA VGA", ACTION=="add", NAME=="fd1"
KERNEL=="fb1", ATTR{name}=="I-O DATA USB-RG", ACTION=="add", NAME=="fd0"

结果。
ls / dev显示/ dev / fb0和/ dev / fb1,但/ dev / fb0是VESA VGA。 udevadm test / dev / fb0

parse_file: reading '/etc/udev/rules.d/50-udev.rules' as rules file
parse_file: reading '/etc/udev/rules.d/51-android.rules' as rules file
parse_file: reading '/etc/udev/rules.d/60-persistent-input.rules' as rules file
parse_file: reading '/etc/udev/rules.d/60-persistent-storage-tape.rules' as rules file
parse_file: reading '/etc/udev/rules.d/60-persistent-storage.rules' as rules file
parse_file: reading '/etc/udev/rules.d/60-persistent-v4l.rules' as rules file
parse_file: reading '/dev/.udev/rules.d/61-dev-root-link.rules' as rules file
parse_file: reading '/lib/udev/rules.d/64-xorg-xkb.rules' as rules file
parse_file: reading '/etc/udev/rules.d/70-persistent-cd.rules' as rules file
parse_file: reading '/etc/udev/rules.d/75-cd-aliases-generator.rules' as rules file
parse_file: reading '/etc/udev/rules.d/75-persistent-net-generator.rules' as rules file
parse_file: reading '/etc/udev/rules.d/80-drivers.rules' as rules file
parse_file: reading '/lib/udev/rules.d/85-hwclock.rules' as rules file
parse_file: reading '/etc/udev/rules.d/90-hal.rules' as rules file
parse_file: reading '/etc/udev/rules.d/91-permissions.rules' as rules file
parse_file: reading '/etc/udev/rules.d/91-udev-fb.rules' as rules file
parse_file: reading '/etc/udev/rules.d/95-late.rules' as rules file
parse_file: reading '/etc/udev/rules.d/z60_xserver-xorg-input-wacom.rules' as rules file
unable to open device '/dev/fb0'

和udevadm info -a -n / dev / fb0显示与VESA VGA相同。

我认为我创建的规则不正确。请建议我如何有效的udev规则 这个环境是VMware上的Debian Lenny 目标是通过udev assign测试是否从启动过程中更改主监视器 VESA VGA< - 由udev分配 - > USB-LCD。

默认情况下,没有任何内容添加到/etc/udev/rules.d 当我启动linux时,/ dev / fb0是主显示器,/ dev / fb1是USB-LCD 这是开发信息。

-/dev/fb0
  looking at device '/class/graphics/fb0':
    KERNEL=="fb0"
    SUBSYSTEM=="graphics"
    DRIVER==""
    ATTR{bits_per_pixel}=="8"
    ATTR{blank}==""
    ATTR{console}==""
    ATTR{cursor}==""
    ATTR{mode}==""
    ATTR{modes}=="U:800x600p-75"
    ATTR{pan}=="0,0"
    ATTR{virtual_size}=="800,600"
    ATTR{name}=="VESA VGA"
    ATTR{stride}=="800"
    ATTR{rotate}=="0"
    ATTR{state}=="0"

  looking at parent device '/devices/platform/vesafb.0':
    KERNELS=="vesafb.0"
    SUBSYSTEMS=="platform"
    DRIVERS=="vesafb"
    ATTRS{modalias}=="platform:vesafb"

  looking at parent device '/devices/platform':
    KERNELS=="platform"
    SUBSYSTEMS==""
    DRIVERS==""


-/dev/fb1  
 looking at device '/class/graphics/fb1':
    KERNEL=="fb1"
    SUBSYSTEM=="graphics"
    DRIVER==""
    ATTR{bits_per_pixel}=="16"
    ATTR{blank}==""
    ATTR{console}==""
    ATTR{cursor}==""
    ATTR{mode}==""
    ATTR{modes}=="U:1280x1024p-60"
    ATTR{pan}=="0,0"
    ATTR{virtual_size}=="1280,1024"
    ATTR{name}=="I-O DATA USB-RG"
    ATTR{stride}=="2560"
    ATTR{rotate}=="0"
    ATTR{state}=="0"

  looking at parent device '/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb2/2-1':
    KERNELS=="2-1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="c0"
    ATTRS{bMaxPower}=="500mA"
    ATTRS{urbnum}=="143"
    ATTRS{idVendor}=="17e9"
    ATTRS{idProduct}=="0151"
    ATTRS{bcdDevice}=="0101"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{speed}=="480"
    ATTRS{busnum}=="2"
    ATTRS{devnum}=="2"
    ATTRS{version}==" 2.00"
    ATTRS{maxchild}=="0"
    ATTRS{quirks}=="0x0"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="DisplayLink"
    ATTRS{product}=="I-O DATA USB-RGB_D"
    ATTRS{serial}=="122937"

  looking at parent device '/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb2':
    KERNELS=="usb2"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bMaxPower}=="  0mA"
    ATTRS{urbnum}=="49"
    ATTRS{idVendor}=="1d6b"
    ATTRS{idProduct}=="0002"
    ATTRS{bcdDevice}=="0206"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{speed}=="480"
    ATTRS{busnum}=="2"
    ATTRS{devnum}=="1"
    ATTRS{version}==" 2.00"
    ATTRS{maxchild}=="6"
    ATTRS{quirks}=="0x0"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="Linux 2.6.26-2-686 ehci_hcd"
    ATTRS{product}=="EHCI Host Controller"
    ATTRS{serial}=="0000:02:03.0"
    ATTRS{authorized_default}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:11.0/0000:02:03.0':
    KERNELS=="0000:02:03.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="ehci_hcd"
    ATTRS{vendor}=="0x15ad"
    ATTRS{device}=="0x0770"
    ATTRS{subsystem_vendor}=="0x15ad"
    ATTRS{subsystem_device}=="0x0770"
    ATTRS{class}=="0x0c0320"
    ATTRS{irq}=="17"
    ATTRS{local_cpus}=="ff"
    ATTRS{local_cpulist}=="0-7"
    ATTRS{modalias}=="pci:v000015ADd00000770sv000015ADsd00000770bc0Csc03i20"
    ATTRS{enable}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}==""

  looking at parent device '/devices/pci0000:00/0000:00:11.0':
    KERNELS=="0000:00:11.0"
    SUBSYSTEMS=="pci"
    DRIVERS==""
    ATTRS{vendor}=="0x15ad"
    ATTRS{device}=="0x0790"
    ATTRS{subsystem_vendor}=="0x0000"
    ATTRS{subsystem_device}=="0x0000"
    ATTRS{class}=="0x060401"
    ATTRS{irq}=="0"
    ATTRS{local_cpus}=="ff"
    ATTRS{local_cpulist}=="0-7"
    ATTRS{modalias}=="pci:v000015ADd00000790sv00000000sd00000000bc06sc04i01"
    ATTRS{enable}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}=="1"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

感谢您对此提出的任何建议: - )

1 个答案:

答案 0 :(得分:2)

创建udev规则文件。 (在/etc/udev/rules.d/中为ubuntu)

  

KERNEL ==“fb0”,ATTR {name} ==“VESA VGA”,ACTION ==“add”,NAME =“fd1”
  KERNEL ==“fb1”,ATTR {name} ==“I-O DATA USB-RG”,ACTION ==“add”,NAME =“fd0”

自动监控规则目录的变化 (或使用udevadm control --reload-rules)。