如何分配/dev/fbX?
我想分配 /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 分配从引导过程更改主监视器。
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==""
感谢您对此的任何建议:-)
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: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==""
Thank you for any suggestions to this :-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建 udev 规则文件。 (对于 ubuntu,在
/etc/udev/rules.d/
中)自动监视规则目录的更改。
(或使用 udevadm control --reload-rules )。
Create a udev rule file. (in
/etc/udev/rules.d/
for ubuntu)The rules directory is monitored for changes automatically.
(or use
udevadm control --reload-rules
).