开发者

How to assign /dev/fbX?

开发者 https://www.devze.com 2023-01-21 17:07 出处:网络
I would like to assign /dev/fbX device like below. /dev/fb0 for USB-LCD device. /dev/fb1 for Main Display device.

I would like to assign /dev/fbX device like below.

/dev/fb0 for USB-LCD device.

/dev/fb1 for Main Display device.

I try that.

ver.1:created /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"

result.

ls /dev shown a /dev/fb0 only.

ver.2:created /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"

result.

ls /dev shown /dev/fb0 and /dev/fb1, But /dev/fb0 is 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'

and udevadm info -a -n /dev/fb0 shown as same as VESA VGA.

I think my created rules are not correct. Please suggest me how can I valid udev rules.

This environment is Debian Lenny on VMware.

Aim is testing for changing main monitor from boot process by udev assign.

VESA VGA <-- switch by udev assign --> USB-LCD.

This is default that nothing add to /etc/udev/rules.d .

when I boot linux,/dev/fb0 is Main Display and /dev/fb1 is USB-LCD.

And this is dev info.

-/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:v000015A开发者_运维问答Dd00000770sv000015ADsd00000770bc0Csc03i20"
    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==""

Thank you for any suggestions to this :-)


Create a udev rule file. (in /etc/udev/rules.d/ for ubuntu)

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

The rules directory is monitored for changes automatically.
(or use udevadm control --reload-rules).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号