udev交叉编译

  1. 去http://www.us.kernel.org/pub/linux/utils/kernel/hotplug/  下载udev软件包:

        udev-142.tar.gz

scratchbox中编译,在外面编译加上--prefix运行时候会出错,会按照编译主机的路径去找配置文件等。。

../udev-142/configure  --host=arm-mv5sft-linux-gnueabi

make install

使用:

http://www.linuxsir.org/bbs/showthread.php?t=346914

stat_busy "Starting UDev Daemon"
/sbin/udevd --daemon
/sbin/udevadm trigger
...
stat_busy "Loading UDev uevents"
...
/sbin/udevadm settle &

先用udevadm monitor 查看信息

udevadm info  -a -p /devices/platform/ehci_marvell.70059/usb1/1-1/1-1.1/1-1.1:1.1/input/input6/ev
ent1

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/platform/ehci_marvell.70059/usb1/1-1/1-1.1/1-1.1:1.1/input/input6/event1':
    KERNEL=="event1"
    SUBSYSTEM=="input"
    DRIVER==""

  looking at parent device '/devices/platform/ehci_marvell.70059/usb1/1-1/1-1.1/1-1.1:1.1/input/input6':
    KERNELS=="input6"
    SUBSYSTEMS=="input"
    DRIVERS==""
    ATTRS{name}=="CHESEN USB Keyboard"
    ATTRS{phys}=="usb-ehci_marvell.70059-1.1/input1"
    ATTRS{uniq}==""
    ATTRS{modalias}=="input:b0003v0A81p0101e0110-e0,1,4,k71,72,73,74,80,8C,8E,8F,90,9B,9C,9E,9F,A3,A4,A5,A6,AB,AC,AD,D1,D9,ram4,lsfw"

  looking at parent device '/devices/platform/ehci_marvell.70059/usb1/1-1/1-1.1/1-1.1:1.1':
    KERNELS=="1-1.1:1.1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usbhid"
    ATTRS{bInterfaceNumber}=="01"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bNumEndpoints}=="01"
    ATTRS{bInterfaceClass}=="03"
    ATTRS{bInterfaceSubClass}=="00"
    ATTRS{bInterfaceProtocol}=="00"
    ATTRS{modalias}=="usb:v0A81p0101d0110dc00dsc00dp00ic03isc00ip00"
    ATTRS{supports_autosuspend}=="1"

  looking at parent device '/devices/platform/ehci_marvell.70059/usb1/1-1/1-1.1':
    KERNELS=="1-1.1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 2"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="a0"
    ATTRS{bMaxPower}=="100mA"
    ATTRS{urbnum}=="21"
    ATTRS{idVendor}=="0a81"
    ATTRS{idProduct}=="0101"
    ATTRS{bcdDevice}=="0110"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="8"
    ATTRS{speed}=="1.5"
    ATTRS{busnum}=="1"
    ATTRS{devnum}=="6"
    ATTRS{version}==" 1.10"
    ATTRS{maxchild}=="0"
    ATTRS{quirks}=="0x1"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="CHESEN"
    ATTRS{product}=="USB Keyboard"

  looking at parent device '/devices/platform/ehci_marvell.70059/usb1/1-1':
    KERNELS=="1-1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bMaxPower}=="  2mA"
    ATTRS{urbnum}=="99"
    ATTRS{idVendor}=="0424"
    ATTRS{idProduct}=="2514"
    ATTRS{bcdDevice}=="0000"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="02"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{speed}=="480"
    ATTRS{busnum}=="1"
    ATTRS{devnum}=="2"
    ATTRS{version}==" 2.00"
    ATTRS{maxchild}=="4"
    ATTRS{quirks}=="0x1"
    ATTRS{authorized}=="1"

  looking at parent device '/devices/platform/ehci_marvell.70059/usb1':
    KERNELS=="usb1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bMaxPower}=="  0mA"
    ATTRS{urbnum}=="26"
    ATTRS{idVendor}=="1d6b"
    ATTRS{idProduct}=="0002"
    ATTRS{bcdDevice}=="0206"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{speed}=="480"
    ATTRS{busnum}=="1"
    ATTRS{devnum}=="1"
    ATTRS{version}==" 2.00"
    ATTRS{maxchild}=="1"
    ATTRS{quirks}=="0x1"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="Linux 2.6.31.8 ehci_hcd"
    ATTRS{product}=="Marvell Orion EHCI"
    ATTRS{serial}=="ehci_marvell.70059"
    ATTRS{authorized_default}=="1"

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

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

UDEVADM(8)                                                   udevadm                                                  UDEVADM(8)

NAME
       udevadm - udev management tool

SYNOPSIS
       udevadm [--debug] [--version] [--help]

       udevadm info options

       udevadm trigger [options]

       udevadm settle [options]

       udevadm control command

       udevadm monitor [options]

       udevadm test [options] devpath

DESCRIPTION
       udevadm expects a command and command specific options. It controls the runtime behavior of udev, requests kernel events,
       manages the event queue, and provides simple debugging mechanisms.

OPTIONS
       --debug
           Print debug messages to stderr.

       --version
           Print version number.

       --help
           Print help text.

   udevadm info options
       Queries the udev database for device information stored in the udev database. It can also query the properties of a
       device from its sysfs representation to help creating udev rules that match this device.

       --query=type
           Query the database for specified type of device data. It needs the --path or --name to identify the specified device.
           Valid queries are: name, symlink, path, property, all.

       --path=devpath
           The devpath of the device to query.

       --name=file
           The name of the device node or a symlink to query

       --root
           The udev root directory: /dev. If used in conjunction with a name or symlink query, the query returns the absolute
           path including the root directory.

       --attribute-walk
           Print all sysfs properties of the specified device that can be used in udev rules to match the specified device. It
           prints all devices along the chain, up to the root of sysfs that can be used in udev rules.

       --device-id-of-file=file
           Print major/minor numbers of the underlying device, where the file lives on.

       --export-db
           Export the content of the udev database.

       --version
           Print version.

       --help
           Print help text.

   udevadm trigger [options]
       Request device events from the kernel. Usually used to replay events at system coldplug time.

       --verbose
           Print the list of devices which will be triggered.

       --dry-run
           Do not actually trigger the event.

       --type=type
           Trigger a specific type of devices. Valid types are: devices, subsystems, failed. The default value is devices.

       --action=action
           Type of event to be triggered. The default value is add.

       --subsystem-match=subsystem
           Trigger events for devices which belong to a matching subsystem. This option can be specified multiple times and
           supports shell style pattern matching.

       --subsystem-nomatch=subsystem
           Do not trigger events for devices which belong to a matching subsystem. This option can be specified multiple times
           and supports shell style pattern matching.

       --attr-match=attribute=value
           Trigger events for devices with a matching sysfs attribute. If a value is specified along with the attribute name,
           the content of the attribute is matched against the given value using shell style pattern matching. If no value is
           specified, the existence of the sysfs attribute is checked. This option can be specified multiple times.

       --attr-nomatch=attribute=value
           Do not trigger events for devices with a matching sysfs attribute. If a value is specified along with the attribute
           name, the content of the attribute is matched against the given value using shell style pattern matching. If no value
           is specified, the existence of the sysfs attribute is checked. This option can be specified multiple times.

       --property-match=property=value
           Trigger events for devices with a matching property value. This option can be specified multiple times and supports
           shell style pattern matching.

       --sysname-match=name
           Trigger events for devices with a matching sys device name. This option can be specified multiple times and supports
           shell style pattern matching.

   udevadm settle [options]
       Watches the udev event queue, and exits if all current events are handled.

       --timeout=seconds
           Maximum number of seconds to wait for the event queue to become empty. The default value is 180 seconds. A value of 0
           will check if the queue is empty and always return immediately.

       --seq-start=seqnum
           Wait only for events after the given sequence number.

       --seq-end=seqnum
           Wait only for events before the given sequence number.

       --exit-if-exists=file
           Stop waiting if file exists.

       --quiet
           Do not print any output, like the remaining queue entries when reaching the timeout.

       --help
           Print help text.

   udevadm control command
       Modify the internal state of the running udev daemon.

       --log-priority=value
           Set the internal log level of udevd. Valid values are the numerical syslog priorities or their textual
           representations: err, info and debug.

       --stop-exec-queue
           Signal udevd to stop executing new events. Incoming events will be queued.

       --start-exec-queue
           Signal udevd to enable the execution of events.

       --reload-rules
           Signal udevd to reload the rules files. The udev daemon detects changes automatically, this option is usually not
           needed. Reloading rules does not apply any changes to already existing devices.

       --property=KEY=value
           Set a global property for all events.

       --max-childs=value
           Set the maximum number of events, udevd will handle at the same time.

       --help
           Print help text.

   udevadm monitor [options]
       Listens to the kernel uevents and events sent out by a udev rule and prints the devpath of the event to the console. It
       can be used to analyze the event timing, by comparing the timestamps of the kernel uevent and the udev event.

       --kernel
           Print the kernel uevents.

       --udev
           Print the udev event after the rule processing.

       --property
           Also print the properties of the event.

       --help
           Print help text.

   udevadm test [options] devpath
       Simulate a udev event run for the given device, and print debug output.

       --action=string
           The action string.

       --subsystem=string
           The subsystem string.

       --help
           Print help text.

AUTHOR
       Written by Kay Sievers kay.sievers@vrfy.org.

SEE ALSO
       udev(7) udevd(8)

原文地址:https://www.cnblogs.com/cute/p/2099849.html