mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 13:16:41 +00:00
update to udev-145, various cleanup
This commit is contained in:
parent
b31aea3ae2
commit
7bfa86e795
@ -4,20 +4,23 @@
|
|||||||
|
|
||||||
$SCRIPTS/build toolchain
|
$SCRIPTS/build toolchain
|
||||||
|
|
||||||
#UTILS="firmware dvb_device_name ata_id scsi_id edd_id path_id usb_id volume_id"
|
|
||||||
#for i in $UTILS; do
|
|
||||||
# EXTRAS="$EXTRAS extras/$i"
|
|
||||||
#done
|
|
||||||
|
|
||||||
cd $PKG_BUILD
|
cd $PKG_BUILD
|
||||||
./configure --host=$TARGET_NAME \
|
./configure --host=$TARGET_NAME \
|
||||||
--build=$HOST_NAME \
|
--build=$HOST_NAME \
|
||||||
--prefix=/usr \
|
--prefix=/usr \
|
||||||
--sysconfdir=/etc \
|
--sysconfdir=/etc \
|
||||||
|
--sbindir=/sbin \
|
||||||
|
--libexecdir=/lib/udev \
|
||||||
--localstatedir=/var \
|
--localstatedir=/var \
|
||||||
|
--disable-silent-rules \
|
||||||
--disable-static \
|
--disable-static \
|
||||||
--enable-shared \
|
--enable-shared \
|
||||||
|
--disable-gtk-doc \
|
||||||
|
--disable-debug \
|
||||||
|
--enable-logging \
|
||||||
|
--disable-extras \
|
||||||
|
--disable-introspection \
|
||||||
|
--with-gnu-ld \
|
||||||
|
|
||||||
make
|
make
|
||||||
|
|
||||||
@ -25,4 +28,3 @@ $STRIP udev/udevd
|
|||||||
$STRIP udev/udevadm
|
$STRIP udev/udevadm
|
||||||
|
|
||||||
make DESTDIR=$SYSROOT_PREFIX install
|
make DESTDIR=$SYSROOT_PREFIX install
|
||||||
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
# do not edit this file, it will be overwritten on update
|
|
||||||
|
|
||||||
# sysfs is populated after the event is sent
|
|
||||||
ACTION=="add", KERNEL=="[0-9]*:[0-9]*", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt"
|
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
ACTION=="add", SUBSYSTEM=="firmware", ENV{FIRMWARE}=="*", RUN+="/sbin/firmware_helper"
|
|
@ -1,86 +0,0 @@
|
|||||||
# CPU devices, group under /dev/cpu
|
|
||||||
KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid"
|
|
||||||
KERNEL=="msr[0-9]*", NAME="cpu/%n/msr"
|
|
||||||
KERNEL=="microcode", NAME="cpu/microcode"
|
|
||||||
|
|
||||||
# Device mapper targets
|
|
||||||
KERNEL=="device-mapper", NAME="mapper/control"
|
|
||||||
|
|
||||||
# IEEE1394 devices, group under their own directories
|
|
||||||
KERNEL=="dv1394-[0-9]*", NAME="dv1394/%n"
|
|
||||||
KERNEL=="video1394-[0-9]*", NAME="video1394/%n"
|
|
||||||
|
|
||||||
# Infiniband devices
|
|
||||||
KERNEL=="umad[0-9]*", NAME="infiniband/%k"
|
|
||||||
KERNEL=="issm[0-9]*", NAME="infiniband/%k"
|
|
||||||
KERNEL=="uverbs[0-9]*", NAME="infiniband/%k"
|
|
||||||
KERNEL=="ucm[0-9]*", NAME="infiniband/%k"
|
|
||||||
KERNEL=="rdma_cm", NAME="infiniband/%k"
|
|
||||||
|
|
||||||
# Input devices, group under /dev/input
|
|
||||||
KERNEL=="event[0-9]*", NAME="input/%k"
|
|
||||||
KERNEL=="mice", NAME="input/%k"
|
|
||||||
KERNEL=="mouse[0-9]*", NAME="input/%k"
|
|
||||||
KERNEL=="js[0-9]*", NAME="input/%k"
|
|
||||||
KERNEL=="ts[0-9]*", NAME="input/%k"
|
|
||||||
KERNEL=="uinput", NAME="input/%k"
|
|
||||||
|
|
||||||
# ISDN devices, group under /dev/capi
|
|
||||||
KERNEL=="capi", NAME="capi20"
|
|
||||||
KERNEL=="capi[0-9]*", NAME="capi/%n"
|
|
||||||
|
|
||||||
# Packet CD devices, group under /dev/pktcdvd
|
|
||||||
KERNEL=="pktcdvd", NAME="pktcdvd/control"
|
|
||||||
KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k"
|
|
||||||
|
|
||||||
# USB devices (usbfs replacement), group under /dev/bus/usb
|
|
||||||
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \
|
|
||||||
NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}"
|
|
||||||
|
|
||||||
# Legacy usb_device class equivalent to above
|
|
||||||
SUBSYSTEM!="usb_device", GOTO="usb_device_end"
|
|
||||||
IMPORT{program}="usb_device_name --export %k"
|
|
||||||
ENV{USB_BUS}=="?*", ENV{USB_DEV}=="?*", \
|
|
||||||
NAME="bus/usb/$env{USB_BUS}/$env{USB_DEV}"
|
|
||||||
LABEL="usb_device_end"
|
|
||||||
|
|
||||||
# Other USB devices, commonly grouped under /dev/usb
|
|
||||||
KERNEL=="auer[0-9]*", NAME="usb/%k"
|
|
||||||
KERNEL=="cpad[0-9]*", NAME="usb/%k"
|
|
||||||
KERNEL=="dabusb[0-9]*", NAME="usb/%k"
|
|
||||||
KERNEL=="hiddev[0-9]*", NAME="usb/%k"
|
|
||||||
KERNEL=="legousbtower[0-9]*", NAME="usb/%k"
|
|
||||||
SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k"
|
|
||||||
|
|
||||||
# Video devices, group dvb devices under /dev/dvb
|
|
||||||
SUBSYSTEM!="dvb", GOTO="dvb_end"
|
|
||||||
IMPORT{program}="dvb_device_name --export %k"
|
|
||||||
ENV{DVB_ADAPTER}=="?*", ENV{DVB_DEV}=="?*", \
|
|
||||||
NAME="dvb/adapter$env{DVB_ADAPTER}/$env{DVB_NAME}", \
|
|
||||||
RUN+="/bin/sh -c 'echo > /var/dvbcard'"
|
|
||||||
LABEL="dvb_end"
|
|
||||||
|
|
||||||
# Video devices, group cards under /dev/dri
|
|
||||||
KERNEL=="card[0-9]*", NAME="dri/%k"
|
|
||||||
|
|
||||||
# Zaptel devices, group under /dev/zap
|
|
||||||
KERNEL=="zapctl", NAME="zap/ctl"
|
|
||||||
KERNEL=="zaptimer", NAME="zap/timer"
|
|
||||||
KERNEL=="zapchannel", NAME="zap/channel"
|
|
||||||
KERNEL=="zappseudo", NAME="zap/pseudo"
|
|
||||||
KERNEL=="zap[0-9]*", NAME="zap/%n"
|
|
||||||
|
|
||||||
# SCSI CD-ROM devices use /dev/scdN now
|
|
||||||
SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n"
|
|
||||||
|
|
||||||
# Link to CD-ROM devices (/dev/cdrom and /dev/dvd)
|
|
||||||
KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]*", \
|
|
||||||
IMPORT{program}="cdrom_id --export $tempnode", \
|
|
||||||
SYMLINK="cdrom dvd cdroms/%k"
|
|
||||||
|
|
||||||
# Raw block devices need to be /dev/raw/*
|
|
||||||
SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k"
|
|
||||||
|
|
||||||
# Other devices
|
|
||||||
KERNEL=="hw_random", NAME="hwrng"
|
|
||||||
KERNEL=="tun", NAME="net/%k"
|
|
@ -1 +0,0 @@
|
|||||||
KERNEL=="lirc[0-9]*", SYMLINK="lirc"
|
|
@ -1,34 +0,0 @@
|
|||||||
# do not edit this file, it will be overwritten on update
|
|
||||||
|
|
||||||
ACTION!="add|change", GOTO="persistent_input_end"
|
|
||||||
SUBSYSTEM!="input", GOTO="persistent_input_end"
|
|
||||||
KERNEL=="input[0-9]*", GOTO="persistent_input_end"
|
|
||||||
|
|
||||||
# usb devices
|
|
||||||
SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export"
|
|
||||||
SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd"
|
|
||||||
SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse"
|
|
||||||
|
|
||||||
# other devices
|
|
||||||
DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr"
|
|
||||||
DRIVERS=="atkbd", ENV{ID_CLASS}="kbd"
|
|
||||||
DRIVERS=="psmouse", ENV{ID_CLASS}="mouse"
|
|
||||||
ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir"
|
|
||||||
ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", ATTRS{modalias}!="input:*-*k*14A,*r*", ENV{ID_CLASS}="joystick"
|
|
||||||
|
|
||||||
ENV{ID_SERIAL}=="Logitech_USB_Receiver", ENV{ID_CLASS}=="", ENV{ID_CLASS}="remote"
|
|
||||||
|
|
||||||
# fill empty serial number
|
|
||||||
ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial"
|
|
||||||
|
|
||||||
# by-id links
|
|
||||||
KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}"
|
|
||||||
KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}"
|
|
||||||
|
|
||||||
# by-path
|
|
||||||
IMPORT{program}="path_id %p"
|
|
||||||
ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}"
|
|
||||||
ENV{ID_PATH}=="?*", KERNEL=="event*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}"
|
|
||||||
|
|
||||||
LABEL="persistent_input_end"
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
|||||||
# do not edit this file, it will be overwritten on update
|
|
||||||
|
|
||||||
ACTION!="add", GOTO="persistent_storage_edd_end"
|
|
||||||
|
|
||||||
# BIOS Enhanced Disk Device
|
|
||||||
ENV{DEVTYPE}=="disk", IMPORT{program}="edd_id --export $tempnode"
|
|
||||||
ENV{DEVTYPE}=="disk", ENV{ID_EDD}=="?*", SYMLINK+="storage/by-id/edd-$env{ID_EDD}"
|
|
||||||
ENV{DEVTYPE}=="partition", ENV{ID_EDD}=="?*", SYMLINK+="storage/by-id/edd-$env{ID_EDD}-part%n"
|
|
||||||
|
|
||||||
LABEL="persistent_storage_edd_end"
|
|
@ -1,65 +0,0 @@
|
|||||||
# do not edit this file, it will be overwritten on update
|
|
||||||
|
|
||||||
# persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path}
|
|
||||||
# scheme based on "Linux persistent device names", 2004, Hannes Reinecke <hare@suse.de>
|
|
||||||
|
|
||||||
# forward scsi device event to corresponding block device
|
|
||||||
ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change"
|
|
||||||
|
|
||||||
ACTION!="add|change", GOTO="persistent_storage_end"
|
|
||||||
SUBSYSTEM!="block", GOTO="persistent_storage_end"
|
|
||||||
|
|
||||||
# skip rules for inappropriate block devices
|
|
||||||
KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end"
|
|
||||||
|
|
||||||
# never access non-cdrom removable ide devices, the drivers are causing event loops on open()
|
|
||||||
KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end"
|
|
||||||
KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end"
|
|
||||||
|
|
||||||
# ignore partitions that span the entire disk
|
|
||||||
TEST=="whole_disk", GOTO="persistent_storage_end"
|
|
||||||
|
|
||||||
# /sys/class/block will export this
|
|
||||||
ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk"
|
|
||||||
ENV{DEVTYPE}!="?*", ATTR{start}=="?*", ENV{DEVTYPE}="partition"
|
|
||||||
|
|
||||||
# for partitions import parent information
|
|
||||||
ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"
|
|
||||||
|
|
||||||
# by-id (hardware serial number)
|
|
||||||
KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode"
|
|
||||||
KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}"
|
|
||||||
KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n"
|
|
||||||
|
|
||||||
KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394"
|
|
||||||
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p"
|
|
||||||
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi"
|
|
||||||
KERNEL=="cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss"
|
|
||||||
KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
|
|
||||||
KERNEL=="sd*[0-9]|cciss*p[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
|
|
||||||
|
|
||||||
# libata compat (links like hd*)
|
|
||||||
KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}"
|
|
||||||
KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n"
|
|
||||||
|
|
||||||
KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}"
|
|
||||||
KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n"
|
|
||||||
|
|
||||||
# by-path (shortest physical path)
|
|
||||||
ENV{DEVTYPE}=="disk", IMPORT{program}="path_id %p"
|
|
||||||
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}"
|
|
||||||
ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
|
|
||||||
|
|
||||||
# skip unpartitioned removable media devices from drivers which do not send "change" events
|
|
||||||
ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end"
|
|
||||||
# skip optical drives without media
|
|
||||||
ENV{DEVTYPE}=="disk", KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT}!="?*", GOTO="persistent_storage_end"
|
|
||||||
|
|
||||||
# import filesystem metadata
|
|
||||||
IMPORT{program}="vol_id --export $tempnode"
|
|
||||||
|
|
||||||
# by-label/by-uuid links (filesystem metadata)
|
|
||||||
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
|
|
||||||
ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
|
|
||||||
|
|
||||||
LABEL="persistent_storage_end"
|
|
@ -1,66 +0,0 @@
|
|||||||
# Manage drivers that match kernel-supplied alias
|
|
||||||
ACTION=="add", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}"
|
|
||||||
ACTION=="remove", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe -r $env{MODALIAS}"
|
|
||||||
|
|
||||||
ACTION!="add", GOTO="modprobe_end"
|
|
||||||
|
|
||||||
# Load IDE class modules based on the media type
|
|
||||||
SUBSYSTEM!="ide", GOTO="ide_end"
|
|
||||||
IMPORT{program}="ide_media --export $devpath"
|
|
||||||
ENV{IDE_MEDIA}=="cdrom", RUN+="/sbin/modprobe -Qba ide-cd"
|
|
||||||
ENV{IDE_MEDIA}=="disk", RUN+="/sbin/modprobe -Qba ide-disk"
|
|
||||||
ENV{IDE_MEDIA}=="floppy", RUN+="/sbin/modprobe -Qba ide-floppy"
|
|
||||||
ENV{IDE_MEDIA}=="tape", RUN+="/sbin/modprobe -Qba ide-tape"
|
|
||||||
LABEL="ide_end"
|
|
||||||
|
|
||||||
# Load i2o class modules unequivocably until we know more about them
|
|
||||||
SUBSYSTEM=="i2o", RUN+="/sbin/modprobe -Qba i2o-block"
|
|
||||||
|
|
||||||
# Load MMC class modules unequivocably until we know more about them
|
|
||||||
SUBSYSTEM=="mmc", RUN+="/sbin/modprobe -Qba mmc-block"
|
|
||||||
|
|
||||||
# Load SCSI class modules based on the device class
|
|
||||||
SUBSYSTEM!="scsi", GOTO="scsi_end"
|
|
||||||
ATTR{type}=="0|7|14", RUN+="/sbin/modprobe -Qba sd_mod"
|
|
||||||
ATTR{type}=="1", ATTRS{vendor}=="Onstream", ATTRS{model}!="ADR*", \
|
|
||||||
RUN+="/sbin/modprobe -Qba osst"
|
|
||||||
ATTR{type}=="1", ATTRS{vendor}=="Onstream", ATTRS{model}=="ADR*", \
|
|
||||||
RUN+="/sbin/modprobe -Qba st"
|
|
||||||
ATTR{type}=="1", ATTRS{vendor}=="Onstream", ATTRS{model}=="ADR*", \
|
|
||||||
RUN+="/sbin/modprobe -Qba st"
|
|
||||||
ATTR{type}=="[345]", RUN+="/sbin/modprobe -Qba sr_mod"
|
|
||||||
ATTR{type}=="8", RUN+="/sbin/modprobe -Qba ch"
|
|
||||||
RUN+="/sbin/modprobe -Qba sg"
|
|
||||||
LABEL="scsi_end"
|
|
||||||
|
|
||||||
# Load VIO modules based on the device type
|
|
||||||
# (modules that lack modalias support)
|
|
||||||
SUBSYSTEM!="vio", GOTO="vio_end"
|
|
||||||
IMPORT{program}="vio_type --export $devpath"
|
|
||||||
ENV{VIO_TYPE}=="serial", RUN+="/sbin/modprobe -Qba hvc_console"
|
|
||||||
ENV{VIO_TYPE}=="serial-server", RUN+="/sbin/modprobe -Qba hvcs"
|
|
||||||
ENV{VIO_TYPE}=="network", RUN+="/sbin/modprobe -Qba ibmveth"
|
|
||||||
ENV{VIO_TYPE}=="vscsi", RUN+="/sbin/modprobe -Qba ibmvscsic"
|
|
||||||
ENV{VIO_TYPE}=="vlan", RUN+="/sbin/modprobe -Qba iseries_veth"
|
|
||||||
ENV{VIO_TYPE}=="viodasd", RUN+="/sbin/modprobe -Qba viodasd"
|
|
||||||
ENV{VIO_TYPE}=="viocd", RUN+="/sbin/modprobe -Qba viocd"
|
|
||||||
ENV{VIO_TYPE}=="vnet", RUN+="/sbin/modprobe -Qba sunvnet"
|
|
||||||
ENV{VIO_TYPE}=="vdisk", RUN+="/sbin/modprobe -Qba sunvdc"
|
|
||||||
LABEL="vio_end"
|
|
||||||
|
|
||||||
# Hack to load ti flashmedia subsystem drivers
|
|
||||||
SUBSYSTEM!="tifm", GOTO="tifm_end"
|
|
||||||
ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe -Qba tifm_sd"
|
|
||||||
ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe -Qba tifm_ms"
|
|
||||||
LABEL="tifm_end"
|
|
||||||
|
|
||||||
# Not sure how to tell if it's MS or MSPro yet...
|
|
||||||
SUBSYSTEM!="memstick", GOTO="memstick_end"
|
|
||||||
RUN+="/sbin/modprobe -Qba ms_block"
|
|
||||||
RUN+="/sbin/modprobe -Qba mspro_block"
|
|
||||||
LABEL="memstick_end"
|
|
||||||
|
|
||||||
# Load drivers that match kernel-supplied alias
|
|
||||||
ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe -Q $env{MODALIAS}"
|
|
||||||
|
|
||||||
LABEL="modprobe_end"
|
|
@ -1,8 +0,0 @@
|
|||||||
# do not edit this file, it will be overwritten on update
|
|
||||||
|
|
||||||
# run a command on remove events
|
|
||||||
ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}"
|
|
||||||
|
|
||||||
# event to be catched by udevmonitor
|
|
||||||
RUN+="socket:@/org/kernel/udev/monitor"
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
udev_root="/dev"
|
|
||||||
udev_rules="/etc/udev/rules.d"
|
|
||||||
udev_log="err"
|
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
. /etc/sysconfig
|
. /etc/sysconfig
|
||||||
|
|
||||||
if test -f /usr/sbin/udevd; then
|
if test -f /sbin/udevd; then
|
||||||
|
|
||||||
progress "starting Udev"
|
progress "starting Udev"
|
||||||
|
|
||||||
|
@ -5,31 +5,40 @@
|
|||||||
PKG_DIR=`find $PACKAGES -type d -name $1`
|
PKG_DIR=`find $PACKAGES -type d -name $1`
|
||||||
|
|
||||||
mkdir -p $INSTALL/sbin
|
mkdir -p $INSTALL/sbin
|
||||||
cp $PKG_BUILD/$1/udevadm $INSTALL/sbin
|
cp $PKG_BUILD/$1/udevadm $INSTALL/sbin
|
||||||
|
cp $PKG_BUILD/$1/udevd $INSTALL/sbin
|
||||||
mkdir -p $INSTALL/usr/bin
|
|
||||||
ln -sf /sbin/udevadm $INSTALL/usr/bin/udevinfo
|
|
||||||
|
|
||||||
mkdir -p $INSTALL/usr/sbin
|
|
||||||
cp $PKG_BUILD/$1/udevd $INSTALL/usr/sbin
|
|
||||||
#cp $PKG_BUILD/extras/firmware_helper/firmware_helper $INSTALL/sbin
|
|
||||||
|
|
||||||
mkdir -p $INSTALL/usr/lib/udev
|
|
||||||
for i in ata_id cdrom_id edd_id path_id scsi_id usb_id; do
|
|
||||||
cp $PKG_BUILD/extras/$i/$i $INSTALL/usr/lib/udev
|
|
||||||
done
|
|
||||||
cp $PKG_BUILD/extras/volume_id/vol_id $INSTALL/usr/lib/udev
|
|
||||||
|
|
||||||
#mkdir -p $INSTALL/usr/lib/udev
|
|
||||||
#for i in ata_id cdrom_id dvb_device_name edd_id ide_media path_id scsi_id usb_device_name usb_id; do
|
|
||||||
# cp $PKG_BUILD/extras/$i/$i $INSTALL/usr/lib/udev
|
|
||||||
#done
|
|
||||||
#cp $PKG_BUILD/extras/volume_id/vol_id $INSTALL/usr/lib/udev
|
|
||||||
|
|
||||||
mkdir -p $INSTALL/usr/lib
|
mkdir -p $INSTALL/usr/lib
|
||||||
cp -PR $PKG_BUILD/extras/volume_id/lib/.libs/libvolume_id.so* $INSTALL/usr/lib
|
cp -PR $PKG_BUILD/libudev/.libs/libudev.so* $INSTALL/usr/lib
|
||||||
cp -PR $PKG_BUILD/udev/lib/.libs/libudev.so* $INSTALL/usr/lib
|
|
||||||
|
mkdir -p $INSTALL/lib/udev
|
||||||
|
cp $PKG_BUILD/extras/floppy/create_floppy_devices $INSTALL/usr/lib/udev
|
||||||
|
cp $PKG_BUILD/extras/firmware/firmware.sh $INSTALL/usr/lib/udev
|
||||||
|
cp $PKG_BUILD/extras/rule_generator/rule_generator.functions $INSTALL/lib/udev
|
||||||
|
cp $PKG_BUILD/extras/rule_generator/write_cd_rules $INSTALL/lib/udev
|
||||||
|
cp $PKG_BUILD/extras/rule_generator/write_net_rules $INSTALL/lib/udev
|
||||||
|
chmod +x $INSTALL/lib/udev/write_*_rules
|
||||||
|
for i in ata_id cdrom_id collect edd_id fstab_import path_id scsi_id usb_id v4l_id; do
|
||||||
|
cp $PKG_BUILD/extras/$i/$i $INSTALL/lib/udev
|
||||||
|
done
|
||||||
|
|
||||||
|
mkdir -p $INSTALL/lib/udev/rules.d
|
||||||
|
cp $PKG_BUILD/extras/cdrom_id/*.rules $INSTALL/lib/udev/rules.d
|
||||||
|
cp $PKG_BUILD/extras/edd_id/*.rules $INSTALL/lib/udev/rules.d
|
||||||
|
cp $PKG_BUILD/extras/firmware/*.rules $INSTALL/lib/udev/rules.d
|
||||||
|
cp $PKG_BUILD/extras/fstab_import/*.rules $INSTALL/lib/udev/rules.d
|
||||||
|
cp $PKG_BUILD/extras/rule_generator/*.rules $INSTALL/lib/udev/rules.d
|
||||||
|
cp $PKG_BUILD/extras/v4l_id/*.rules $INSTALL/lib/udev/rules.d
|
||||||
|
cp $PKG_BUILD/rules/rules.d/50-udev-default.rules $INSTALL/lib/udev/rules.d
|
||||||
|
cp $PKG_BUILD/rules/rules.d/60-persistent-alsa.rules $INSTALL/lib/udev/rules.d
|
||||||
|
cp $PKG_BUILD/rules/rules.d/60-persistent-input.rules $INSTALL/lib/udev/rules.d
|
||||||
|
cp $PKG_BUILD/rules/rules.d/60-persistent-serial.rules $INSTALL/lib/udev/rules.d
|
||||||
|
cp $PKG_BUILD/rules/rules.d/60-persistent-storage-tape.rules $INSTALL/lib/udev/rules.d
|
||||||
|
cp $PKG_BUILD/rules/rules.d/60-persistent-storage.rules $INSTALL/lib/udev/rules.d
|
||||||
|
cp $PKG_BUILD/rules/rules.d/80-drivers.rules $INSTALL/lib/udev/rules.d
|
||||||
|
cp $PKG_BUILD/rules/rules.d/95-udev-late.rules $INSTALL/lib/udev/rules.d
|
||||||
|
|
||||||
|
mkdir -p $INSTALL/etc/udev
|
||||||
|
cp $PKG_BUILD/udev.conf $INSTALL/etc/udev
|
||||||
|
|
||||||
mkdir -p $INSTALL/etc/udev/rules.d
|
mkdir -p $INSTALL/etc/udev/rules.d
|
||||||
cp $PKG_DIR/config/udev.conf $INSTALL/etc/udev
|
|
||||||
cp $PKG_DIR/config/rules.d/* $INSTALL/etc/udev/rules.d
|
|
||||||
|
@ -1,215 +0,0 @@
|
|||||||
diff -ruNp udev-103~/extras/dvb_device_name/Makefile udev-103/extras/dvb_device_name/Makefile
|
|
||||||
--- udev-103~/extras/dvb_device_name/Makefile 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ udev-103/extras/dvb_device_name/Makefile 2006-11-02 12:56:39.000000000 +0000
|
|
||||||
@@ -0,0 +1,67 @@
|
|
||||||
+# Copyright © 2005 Canonical Ltd.
|
|
||||||
+# Author: Scott James Remnant <scott@ubuntu.com>
|
|
||||||
+#
|
|
||||||
+# Released under the GNU General Public License, version 2.
|
|
||||||
+
|
|
||||||
+PROG = dvb_device_name
|
|
||||||
+OBJ =
|
|
||||||
+HEADERS =
|
|
||||||
+GEN_HEADERS =
|
|
||||||
+MAN_PAGES =
|
|
||||||
+
|
|
||||||
+prefix =
|
|
||||||
+etcdir = ${prefix}/etc
|
|
||||||
+sbindir = ${prefix}/sbin
|
|
||||||
+usrbindir = ${prefix}/usr/bin
|
|
||||||
+usrsbindir = ${prefix}/usr/sbin
|
|
||||||
+libudevdir = ${prefix}/lib/udev
|
|
||||||
+mandir = ${prefix}/usr/share/man
|
|
||||||
+configdir = ${etcdir}/udev/
|
|
||||||
+
|
|
||||||
+INSTALL = /usr/bin/install -c
|
|
||||||
+INSTALL_PROGRAM = ${INSTALL}
|
|
||||||
+INSTALL_DATA = ${INSTALL} -m 644
|
|
||||||
+INSTALL_SCRIPT = ${INSTALL_PROGRAM}
|
|
||||||
+
|
|
||||||
+all: $(PROG) $(MAN_PAGES)
|
|
||||||
+.PHONY: all
|
|
||||||
+.DEFAULT: all
|
|
||||||
+
|
|
||||||
+%.o: %.c $(GEN_HEADERS)
|
|
||||||
+ $(E) " CC " $@
|
|
||||||
+ $(Q) $(CC) -c $(CFLAGS) $< -o $@
|
|
||||||
+
|
|
||||||
+$(PROG): %: $(HEADERS) %.o $(OBJS)
|
|
||||||
+ $(E) " LD " $@
|
|
||||||
+ $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS)
|
|
||||||
+
|
|
||||||
+# man pages
|
|
||||||
+%.8: %.xml
|
|
||||||
+ $(E) " XMLTO " $@
|
|
||||||
+ $(Q) xmlto man $?
|
|
||||||
+.PRECIOUS: %.8
|
|
||||||
+
|
|
||||||
+clean:
|
|
||||||
+ $(E) " CLEAN "
|
|
||||||
+ $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS)
|
|
||||||
+.PHONY: clean
|
|
||||||
+
|
|
||||||
+install-bin: all
|
|
||||||
+ $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG)
|
|
||||||
+.PHONY: install-bin
|
|
||||||
+
|
|
||||||
+uninstall-bin:
|
|
||||||
+ - rm $(DESTDIR)$(libudevdir)/$(PROG)
|
|
||||||
+.PHONY: uninstall-bin
|
|
||||||
+
|
|
||||||
+install-man:
|
|
||||||
+ $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8
|
|
||||||
+.PHONY: uninstall-man
|
|
||||||
+
|
|
||||||
+uninstall-man:
|
|
||||||
+ -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8
|
|
||||||
+.PHONY: uninstall-man
|
|
||||||
+
|
|
||||||
+install-config:
|
|
||||||
+ @echo "no config file to install"
|
|
||||||
+.PHONY: install-config
|
|
||||||
diff -ruNp udev-103~/extras/dvb_device_name/dvb_device_name.8 udev-103/extras/dvb_device_name/dvb_device_name.8
|
|
||||||
--- udev-103~/extras/dvb_device_name/dvb_device_name.8 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ udev-103/extras/dvb_device_name/dvb_device_name.8 2006-11-02 12:56:39.000000000 +0000
|
|
||||||
@@ -0,0 +1,28 @@
|
|
||||||
+.TH DVB_DEVICE_NAME 8 "November 2005" "" "Linux Administrator's Manual"
|
|
||||||
+.SH NAME
|
|
||||||
+dvb_device_name \- udev callout to split kernel name for dvb devices
|
|
||||||
+.SH SYNOPSIS
|
|
||||||
+.BI dvb_device_name
|
|
||||||
+[\fI--export\fP] \fIdevicename\fP
|
|
||||||
+.SH DESCRIPTION
|
|
||||||
+.B dvb_device_name
|
|
||||||
+is normally called from a udev rule to split the kernel-assigned name for a
|
|
||||||
+device in the dvb_device subsystem into bus and device numbers. Udev can use
|
|
||||||
+this information to construct a name under /dev/dvb for the real device
|
|
||||||
+node.
|
|
||||||
+.SH USAGE
|
|
||||||
+.B dvb_device_name
|
|
||||||
+splits the kernel-assigned name specified on the command-line and prints the
|
|
||||||
+information chosen by the options.
|
|
||||||
+.SH OPTIONS
|
|
||||||
+The following command-line switches are supported to specify what
|
|
||||||
+dvb_device_name should print:
|
|
||||||
+.TP
|
|
||||||
+.BI --export
|
|
||||||
+print bus and device numbers as DVB_ADAPTER and DVB_DEV environment variables,
|
|
||||||
+for use with an IMPORT{program} rule.
|
|
||||||
+.RE
|
|
||||||
+.SH SEE ALSO
|
|
||||||
+.BR udev (8)
|
|
||||||
+.SH AUTHORS
|
|
||||||
+Scott James Remnant <scott@ubuntu.com>
|
|
||||||
diff -ruNp udev-103~/extras/dvb_device_name/dvb_device_name.c udev-103/extras/dvb_device_name/dvb_device_name.c
|
|
||||||
--- udev-103~/extras/dvb_device_name/dvb_device_name.c 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ udev-103/extras/dvb_device_name/dvb_device_name.c 2006-11-02 12:56:39.000000000 +0000
|
|
||||||
@@ -0,0 +1,108 @@
|
|
||||||
+/*
|
|
||||||
+ * dvb_device_name - splits kernel name for dvb_device subsystem
|
|
||||||
+ *
|
|
||||||
+ * Copyright © 2006 Canonical Ltd.
|
|
||||||
+ * Author: Scott James Remnant <scott@ubuntu.com>
|
|
||||||
+ *
|
|
||||||
+ * This program is free software; you can redistribute it and/or modify it
|
|
||||||
+ * under the terms of the GNU General Public License as published by the
|
|
||||||
+ * Free Software Foundation version 2 of the License.
|
|
||||||
+ *
|
|
||||||
+ * This program is distributed in the hope that it will be useful, but
|
|
||||||
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
+ * General Public License for more details.
|
|
||||||
+ *
|
|
||||||
+ * You should have received a copy of the GNU General Public License along
|
|
||||||
+ * with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
+ *
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#include <stdio.h>
|
|
||||||
+#include <stdlib.h>
|
|
||||||
+#include <string.h>
|
|
||||||
+#include <ctype.h>
|
|
||||||
+
|
|
||||||
+#include "../../udev.h"
|
|
||||||
+
|
|
||||||
+#ifdef USE_LOG
|
|
||||||
+void log_message(int priority, const char *format, ...)
|
|
||||||
+{
|
|
||||||
+ va_list args;
|
|
||||||
+ static int udev_log = -1;
|
|
||||||
+
|
|
||||||
+ if (udev_log == -1) {
|
|
||||||
+ const char *value;
|
|
||||||
+
|
|
||||||
+ value = getenv("UDEV_LOG");
|
|
||||||
+ if (value)
|
|
||||||
+ udev_log = log_priority(value);
|
|
||||||
+ else
|
|
||||||
+ udev_log = LOG_ERR;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (priority > udev_log)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ va_start(args, format);
|
|
||||||
+ vsyslog(priority, format, args);
|
|
||||||
+ va_end(args);
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+int main(int argc, char *argv[])
|
|
||||||
+{
|
|
||||||
+ const char *name = NULL, *ptr;
|
|
||||||
+ int export = 0, ret = 0;
|
|
||||||
+ int i, bus, dev;
|
|
||||||
+
|
|
||||||
+ logging_init("dvb_device_name");
|
|
||||||
+
|
|
||||||
+ for (i = 1; i < argc; i++) {
|
|
||||||
+ if (strcmp (argv[i], "--export") == 0) {
|
|
||||||
+ export = 1;
|
|
||||||
+ } else {
|
|
||||||
+ name = argv[i];
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!name) {
|
|
||||||
+ err("no device name specified");
|
|
||||||
+ ret = 1;
|
|
||||||
+ goto exit;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (strncmp(name, "dvb", 3) != 0) {
|
|
||||||
+ info("device not dvb_device");
|
|
||||||
+ ret = 1;
|
|
||||||
+ goto exit;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ ptr = strchr(name, '.');
|
|
||||||
+ if (!ptr) {
|
|
||||||
+ err("device name contains no device");
|
|
||||||
+ ret = 1;
|
|
||||||
+ goto exit;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ name += 3;
|
|
||||||
+ bus = atoi(name);
|
|
||||||
+
|
|
||||||
+ name = strdup(ptr + 1);
|
|
||||||
+ while (*ptr && !isdigit(*ptr))
|
|
||||||
+ ptr++;
|
|
||||||
+ dev = atoi(ptr);
|
|
||||||
+
|
|
||||||
+ if (export) {
|
|
||||||
+ printf("DVB_ADAPTER=%d\n", bus);
|
|
||||||
+ printf("DVB_NAME=%s\n", name);
|
|
||||||
+ printf("DVB_DEV=%d\n", dev);
|
|
||||||
+ } else {
|
|
||||||
+ printf("adapter%d %s\n", bus, name);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+exit:
|
|
||||||
+ logging_close();
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
@ -1,245 +0,0 @@
|
|||||||
diff -ruNp udev-117~/extras/firmware_helper/Makefile udev-117/extras/firmware_helper/Makefile
|
|
||||||
--- udev-117~/extras/firmware_helper/Makefile 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ udev-117/extras/firmware_helper/Makefile 2007-12-14 14:21:31.000000000 +0000
|
|
||||||
@@ -0,0 +1,68 @@
|
|
||||||
+# Copyright © 2005 Canonical Ltd.
|
|
||||||
+# Author: Scott James Remnant <scott@ubuntu.com>
|
|
||||||
+#
|
|
||||||
+# Released under the GNU General Public License, version 2.
|
|
||||||
+
|
|
||||||
+PROG = firmware_helper
|
|
||||||
+OBJ =
|
|
||||||
+HEADERS =
|
|
||||||
+GEN_HEADERS =
|
|
||||||
+MAN_PAGES =
|
|
||||||
+
|
|
||||||
+prefix =
|
|
||||||
+etcdir = ${prefix}/etc
|
|
||||||
+sbindir = ${prefix}/sbin
|
|
||||||
+usrbindir = ${prefix}/usr/bin
|
|
||||||
+usrsbindir = ${prefix}/usr/sbin
|
|
||||||
+libudevdir = ${prefix}/lib/udev
|
|
||||||
+mandir = ${prefix}/usr/share/man
|
|
||||||
+configdir = ${etcdir}/udev/
|
|
||||||
+
|
|
||||||
+INSTALL = install -c
|
|
||||||
+INSTALL_PROGRAM = ${INSTALL}
|
|
||||||
+INSTALL_DATA = ${INSTALL} -m 644
|
|
||||||
+INSTALL_SCRIPT = ${INSTALL}
|
|
||||||
+
|
|
||||||
+all: $(PROG) $(MAN_PAGES)
|
|
||||||
+.PHONY: all
|
|
||||||
+.DEFAULT: all
|
|
||||||
+
|
|
||||||
+%.o: %.c $(GEN_HEADERS)
|
|
||||||
+ $(E) " CC " $@
|
|
||||||
+ $(Q) $(CC) -c $(CFLAGS) $< -o $@
|
|
||||||
+
|
|
||||||
+$(PROG): %: $(HEADERS) %.o $(OBJS)
|
|
||||||
+ $(E) " LD " $@
|
|
||||||
+ $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS)
|
|
||||||
+
|
|
||||||
+# man pages
|
|
||||||
+%.8: %.xml
|
|
||||||
+ $(E) " XMLTO " $@
|
|
||||||
+ $(Q) xmlto man $?
|
|
||||||
+.PRECIOUS: %.8
|
|
||||||
+
|
|
||||||
+clean:
|
|
||||||
+ $(E) " CLEAN "
|
|
||||||
+ $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS)
|
|
||||||
+.PHONY: clean
|
|
||||||
+
|
|
||||||
+install-bin: all
|
|
||||||
+ $(INSTALL_SCRIPT) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG)
|
|
||||||
+.PHONY: install-bin
|
|
||||||
+
|
|
||||||
+uninstall-bin:
|
|
||||||
+ - rm $(DESTDIR)$(libudevdir)/$(PROG)
|
|
||||||
+.PHONY: uninstall-bin
|
|
||||||
+
|
|
||||||
+install-man:
|
|
||||||
+ @echo "Please create a man page for this tool."
|
|
||||||
+.PHONY: install-man
|
|
||||||
+
|
|
||||||
+uninstall-man:
|
|
||||||
+ @echo "Please create a man page for this tool."
|
|
||||||
+.PHONY: uninstall-man
|
|
||||||
+
|
|
||||||
+install-config:
|
|
||||||
+ @echo "no config file to install"
|
|
||||||
+.PHONY: install-config
|
|
||||||
+
|
|
||||||
diff -ruNp udev-117~/extras/firmware_helper/firmware_helper.c udev-117/extras/firmware_helper/firmware_helper.c
|
|
||||||
--- udev-117~/extras/firmware_helper/firmware_helper.c 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ udev-117/extras/firmware_helper/firmware_helper.c 2007-12-14 14:21:31.000000000 +0000
|
|
||||||
@@ -0,0 +1,169 @@
|
|
||||||
+/*
|
|
||||||
+ * A simple firmware helper program.
|
|
||||||
+ *
|
|
||||||
+ * Copyright 2005 Red Hat, Inc.
|
|
||||||
+ *
|
|
||||||
+ * This program is free software; you can redistribute it and/or modify it
|
|
||||||
+ * under the terms of the GNU General Public License as published by the
|
|
||||||
+ * Free Software Foundation version 2 of the License.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#include <errno.h>
|
|
||||||
+#include <fcntl.h>
|
|
||||||
+#include <stdio.h>
|
|
||||||
+#include <stdlib.h>
|
|
||||||
+#include <string.h>
|
|
||||||
+#include <syslog.h>
|
|
||||||
+#include <unistd.h>
|
|
||||||
+#include <sys/stat.h>
|
|
||||||
+#include <sys/utsname.h>
|
|
||||||
+
|
|
||||||
+#include "../../udev.h"
|
|
||||||
+
|
|
||||||
+#define PATH_SIZE 256
|
|
||||||
+
|
|
||||||
+#ifdef USE_LOG
|
|
||||||
+void log_message(int priority, const char *format, ...)
|
|
||||||
+{
|
|
||||||
+ va_list args;
|
|
||||||
+ static int udev_log = -1;
|
|
||||||
+
|
|
||||||
+ if (udev_log == -1) {
|
|
||||||
+ const char *value;
|
|
||||||
+
|
|
||||||
+ value = getenv("UDEV_LOG");
|
|
||||||
+ if (value)
|
|
||||||
+ udev_log = log_priority(value);
|
|
||||||
+ else
|
|
||||||
+ udev_log = LOG_ERR;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (priority > udev_log)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ va_start(args, format);
|
|
||||||
+ vsyslog(priority, format, args);
|
|
||||||
+ va_end(args);
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+/* Set the 'loading' attribute for a firmware device.
|
|
||||||
+ * 1 == currently loading
|
|
||||||
+ * 0 == done loading
|
|
||||||
+ * -1 == error
|
|
||||||
+ */
|
|
||||||
+static int set_loading(const char *device, int value) {
|
|
||||||
+ char loading_path[PATH_SIZE];
|
|
||||||
+ int rc;
|
|
||||||
+ FILE *f;
|
|
||||||
+
|
|
||||||
+ snprintf(loading_path, sizeof(loading_path), "/sys/%s/loading", device);
|
|
||||||
+ loading_path[sizeof(loading_path)-1] = '\0';
|
|
||||||
+ f = fopen(loading_path, "w");
|
|
||||||
+ if (!f)
|
|
||||||
+ return -1;
|
|
||||||
+ rc = fprintf(f, "%d", value);
|
|
||||||
+ fclose(f);
|
|
||||||
+ if (rc < 0)
|
|
||||||
+ return rc;
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int main(int argc, char **argv) {
|
|
||||||
+ char *devpath, *firmware, *action, *driver;
|
|
||||||
+ char fw_path[PATH_SIZE];
|
|
||||||
+ char data_path[PATH_SIZE];
|
|
||||||
+ struct utsname utsbuf;
|
|
||||||
+ int fw_fd;
|
|
||||||
+ char *fw_buffer;
|
|
||||||
+ size_t fw_buffer_size;
|
|
||||||
+ size_t count;
|
|
||||||
+ int i, loaded = 0;
|
|
||||||
+ int rc = 0;
|
|
||||||
+
|
|
||||||
+ logging_init("firmware_helper");
|
|
||||||
+
|
|
||||||
+ driver = getenv("PHYSDEVDRIVER");
|
|
||||||
+ if (!driver)
|
|
||||||
+ driver = "(unknown)";
|
|
||||||
+ devpath = getenv("DEVPATH");
|
|
||||||
+ firmware = getenv("FIRMWARE");
|
|
||||||
+ action = getenv("ACTION");
|
|
||||||
+ if (!devpath || !firmware || !action || strcmp(action,"add") != 0) {
|
|
||||||
+ err("missing devpath, action or firmware");
|
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (uname(&utsbuf)) {
|
|
||||||
+ err("unable to get kernel version");
|
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ dbg("try to load firmware '%s' for '%s'", firmware, devpath);
|
|
||||||
+ set_loading(devpath, 1);
|
|
||||||
+
|
|
||||||
+ for (i = 0; i < 2; i++) {
|
|
||||||
+ switch (i) {
|
|
||||||
+ case 0: /* /lib/firmware/$VERSION/$FIRMWARE */
|
|
||||||
+ snprintf(fw_path, sizeof(fw_path),
|
|
||||||
+ "/lib/firmware/%s/%s", utsbuf.release,
|
|
||||||
+ firmware);
|
|
||||||
+ break;
|
|
||||||
+ case 1: /* /lib/firmware/$FIRMWARE */
|
|
||||||
+ snprintf(fw_path, sizeof(fw_path),
|
|
||||||
+ "/lib/firmware/%s", firmware);
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ fw_path[sizeof(fw_path)-1] = '\0';
|
|
||||||
+
|
|
||||||
+ dbg("looking for firmware at '%s'", fw_path);
|
|
||||||
+ if (file_map(fw_path, &fw_buffer, &fw_buffer_size) != 0 || fw_buffer_size == 0) {
|
|
||||||
+ fw_buffer = NULL;
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ dbg("firmware found");
|
|
||||||
+ snprintf(data_path, sizeof(data_path), "/sys/%s/data", devpath);
|
|
||||||
+ data_path[sizeof(data_path)-1] = '\0';
|
|
||||||
+ fw_fd = open(data_path, O_RDWR);
|
|
||||||
+ if (fw_fd < 0) {
|
|
||||||
+ rc = errno;
|
|
||||||
+ goto out_err;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ count = 0;
|
|
||||||
+ while (count < fw_buffer_size) {
|
|
||||||
+ ssize_t c;
|
|
||||||
+
|
|
||||||
+ c = write(fw_fd, fw_buffer+count, fw_buffer_size-count);
|
|
||||||
+ if (c <= 0) {
|
|
||||||
+ rc = errno;
|
|
||||||
+ close(fw_fd);
|
|
||||||
+ goto out_err;
|
|
||||||
+ }
|
|
||||||
+ count += c;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ close(fw_fd);
|
|
||||||
+ file_unmap(fw_buffer, fw_buffer_size);
|
|
||||||
+ loaded = 1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!loaded)
|
|
||||||
+ goto out_err;
|
|
||||||
+
|
|
||||||
+ set_loading(devpath, 0);
|
|
||||||
+ info("loaded '%s' for device '%s'", fw_path, devpath);
|
|
||||||
+
|
|
||||||
+ logging_close();
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+out_err:
|
|
||||||
+ if (fw_buffer)
|
|
||||||
+ file_unmap(fw_buffer, fw_buffer_size);
|
|
||||||
+ set_loading(devpath, -1);
|
|
||||||
+
|
|
||||||
+ err("error loading '%s' for device '%s' with driver '%s'", fw_path, devpath, driver);
|
|
||||||
+ logging_close();
|
|
||||||
+ return rc;
|
|
||||||
+}
|
|
@ -1,267 +0,0 @@
|
|||||||
diff -ruNp udev-103~/extras/ide_media/Makefile udev-103/extras/ide_media/Makefile
|
|
||||||
--- udev-103~/extras/ide_media/Makefile 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ udev-103/extras/ide_media/Makefile 2006-11-02 12:57:27.000000000 +0000
|
|
||||||
@@ -0,0 +1,67 @@
|
|
||||||
+# Copyright © 2005 Canonical Ltd.
|
|
||||||
+# Author: Scott James Remnant <scott@ubuntu.com>
|
|
||||||
+#
|
|
||||||
+# Released under the GNU General Public License, version 2.
|
|
||||||
+
|
|
||||||
+PROG = ide_media
|
|
||||||
+OBJ =
|
|
||||||
+HEADERS =
|
|
||||||
+GEN_HEADERS =
|
|
||||||
+MAN_PAGES =
|
|
||||||
+
|
|
||||||
+prefix =
|
|
||||||
+etcdir = ${prefix}/etc
|
|
||||||
+sbindir = ${prefix}/sbin
|
|
||||||
+usrbindir = ${prefix}/usr/bin
|
|
||||||
+usrsbindir = ${prefix}/usr/sbin
|
|
||||||
+libudevdir = ${prefix}/lib/udev
|
|
||||||
+mandir = ${prefix}/usr/share/man
|
|
||||||
+configdir = ${etcdir}/udev/
|
|
||||||
+
|
|
||||||
+INSTALL = /usr/bin/install -c
|
|
||||||
+INSTALL_PROGRAM = ${INSTALL}
|
|
||||||
+INSTALL_DATA = ${INSTALL} -m 644
|
|
||||||
+INSTALL_SCRIPT = ${INSTALL_PROGRAM}
|
|
||||||
+
|
|
||||||
+all: $(PROG) $(MAN_PAGES)
|
|
||||||
+.PHONY: all
|
|
||||||
+.DEFAULT: all
|
|
||||||
+
|
|
||||||
+%.o: %.c $(GEN_HEADERS)
|
|
||||||
+ $(E) " CC " $@
|
|
||||||
+ $(Q) $(CC) -c $(CFLAGS) $< -o $@
|
|
||||||
+
|
|
||||||
+$(PROG): %: $(HEADERS) %.o $(OBJS)
|
|
||||||
+ $(E) " LD " $@
|
|
||||||
+ $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS)
|
|
||||||
+
|
|
||||||
+# man pages
|
|
||||||
+%.8: %.xml
|
|
||||||
+ $(E) " XMLTO " $@
|
|
||||||
+ $(Q) xmlto man $?
|
|
||||||
+.PRECIOUS: %.8
|
|
||||||
+
|
|
||||||
+clean:
|
|
||||||
+ $(E) " CLEAN "
|
|
||||||
+ $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS)
|
|
||||||
+.PHONY: clean
|
|
||||||
+
|
|
||||||
+install-bin: all
|
|
||||||
+ $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG)
|
|
||||||
+.PHONY: install-bin
|
|
||||||
+
|
|
||||||
+uninstall-bin:
|
|
||||||
+ - rm $(DESTDIR)$(libudevdir)/$(PROG)
|
|
||||||
+.PHONY: uninstall-bin
|
|
||||||
+
|
|
||||||
+install-man:
|
|
||||||
+ $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8
|
|
||||||
+.PHONY: uninstall-man
|
|
||||||
+
|
|
||||||
+uninstall-man:
|
|
||||||
+ -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8
|
|
||||||
+.PHONY: uninstall-man
|
|
||||||
+
|
|
||||||
+install-config:
|
|
||||||
+ @echo "no config file to install"
|
|
||||||
+.PHONY: install-config
|
|
||||||
diff -ruNp udev-103~/extras/ide_media/ide_media.8 udev-103/extras/ide_media/ide_media.8
|
|
||||||
--- udev-103~/extras/ide_media/ide_media.8 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ udev-103/extras/ide_media/ide_media.8 2006-11-02 12:57:27.000000000 +0000
|
|
||||||
@@ -0,0 +1,29 @@
|
|
||||||
+.TH IDE_MEDIA 8 "November 2005" "" "Linux Administrator's Manual"
|
|
||||||
+.SH NAME
|
|
||||||
+ide_media \- udev callout to identify media of IDE device
|
|
||||||
+.SH SYNOPSIS
|
|
||||||
+.BI ide_media
|
|
||||||
+[\fI--export\fP] \fIdevpath\fP
|
|
||||||
+.SH DESCRIPTION
|
|
||||||
+.B ide_media
|
|
||||||
+is normally called from a udev rule to identify the media type of an IDE
|
|
||||||
+device. Udev can use this information to assign appropriate permissions to
|
|
||||||
+the device or load an appropriate module.
|
|
||||||
+.SH USAGE
|
|
||||||
+.B ide_media
|
|
||||||
+takes a path under /sys, if not given it uses the value of the
|
|
||||||
+.I DEVPATH
|
|
||||||
+environment variable instead. It then prints the information chosen by the
|
|
||||||
+options.
|
|
||||||
+.SH OPTIONS
|
|
||||||
+The following command-line switches are supported to specify what
|
|
||||||
+ide_media should print:
|
|
||||||
+.TP
|
|
||||||
+.BI --export
|
|
||||||
+print media type as IDE_MEDIA environment variable for use with an
|
|
||||||
+IMPORT{program} rule.
|
|
||||||
+.RE
|
|
||||||
+.SH SEE ALSO
|
|
||||||
+.BR udev (8)
|
|
||||||
+.SH AUTHORS
|
|
||||||
+Scott James Remnant <scott@ubuntu.com>
|
|
||||||
diff -ruNp udev-103~/extras/ide_media/ide_media.c udev-103/extras/ide_media/ide_media.c
|
|
||||||
--- udev-103~/extras/ide_media/ide_media.c 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ udev-103/extras/ide_media/ide_media.c 2006-11-02 12:57:27.000000000 +0000
|
|
||||||
@@ -0,0 +1,159 @@
|
|
||||||
+/*
|
|
||||||
+ * ide_media - identify media type of an IDE device
|
|
||||||
+ *
|
|
||||||
+ * Copyright © 2006 Canonical Ltd.
|
|
||||||
+ * Author: Scott James Remnant <scott@ubuntu.com>
|
|
||||||
+ *
|
|
||||||
+ * This program is free software; you can redistribute it and/or modify it
|
|
||||||
+ * under the terms of the GNU General Public License as published by the
|
|
||||||
+ * Free Software Foundation version 2 of the License.
|
|
||||||
+ *
|
|
||||||
+ * This program is distributed in the hope that it will be useful, but
|
|
||||||
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
+ * General Public License for more details.
|
|
||||||
+ *
|
|
||||||
+ * You should have received a copy of the GNU General Public License along
|
|
||||||
+ * with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
+ *
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#include <sys/types.h>
|
|
||||||
+#include <sys/stat.h>
|
|
||||||
+
|
|
||||||
+#include <stdio.h>
|
|
||||||
+#include <stdlib.h>
|
|
||||||
+#include <string.h>
|
|
||||||
+#include <unistd.h>
|
|
||||||
+#include <errno.h>
|
|
||||||
+#include <fcntl.h>
|
|
||||||
+
|
|
||||||
+#include "../../udev.h"
|
|
||||||
+
|
|
||||||
+#ifdef USE_LOG
|
|
||||||
+void log_message(int priority, const char *format, ...)
|
|
||||||
+{
|
|
||||||
+ va_list args;
|
|
||||||
+ static int udev_log = -1;
|
|
||||||
+
|
|
||||||
+ if (udev_log == -1) {
|
|
||||||
+ const char *value;
|
|
||||||
+
|
|
||||||
+ value = getenv("UDEV_LOG");
|
|
||||||
+ if (value)
|
|
||||||
+ udev_log = log_priority(value);
|
|
||||||
+ else
|
|
||||||
+ udev_log = LOG_ERR;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (priority > udev_log)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ va_start(args, format);
|
|
||||||
+ vsyslog(priority, format, args);
|
|
||||||
+ va_end(args);
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+int main(int argc, char *argv[])
|
|
||||||
+{
|
|
||||||
+ struct stat buf;
|
|
||||||
+ const char *devpath = NULL, *name, *ptr;
|
|
||||||
+ char filename[PATH_SIZE], media[256];
|
|
||||||
+ int ret = 0, export = 0;
|
|
||||||
+ int host, drive, dev;
|
|
||||||
+ int i, fd, len;
|
|
||||||
+
|
|
||||||
+ logging_init("ide_media");
|
|
||||||
+
|
|
||||||
+ for (i = 1; i < argc; i++) {
|
|
||||||
+ if (strcmp(argv[i], "--export") == 0) {
|
|
||||||
+ export = 1;
|
|
||||||
+ } else {
|
|
||||||
+ devpath = argv[i];
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!devpath) {
|
|
||||||
+ devpath = getenv("DEVPATH");
|
|
||||||
+ if (!devpath) {
|
|
||||||
+ err("no devpath specified and DEVPATH not set");
|
|
||||||
+ ret = 1;
|
|
||||||
+ goto exit;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ name = strstr(devpath, "/ide");
|
|
||||||
+ if (name)
|
|
||||||
+ name = strchr(name + 1, '/');
|
|
||||||
+ if (!name) {
|
|
||||||
+ info("devpath is not ide device");
|
|
||||||
+ ret = 1;
|
|
||||||
+ goto exit;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ ptr = strchr(name, '.');
|
|
||||||
+ if (!ptr) {
|
|
||||||
+ err("device name contains no drive");
|
|
||||||
+ ret = 1;
|
|
||||||
+ goto exit;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ name += 1;
|
|
||||||
+ host = atoi(name);
|
|
||||||
+ drive = atoi(ptr + 1);
|
|
||||||
+
|
|
||||||
+ /* evil, evil, evil */
|
|
||||||
+ dev = drive + host * 2;
|
|
||||||
+ if (dev >= 26) {
|
|
||||||
+ err("ide device %d out of range", dev);
|
|
||||||
+ ret = 1;
|
|
||||||
+ goto exit;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ snprintf(filename, sizeof(filename), "/proc/ide/ide%d/hd%c/media",
|
|
||||||
+ host, dev + 'a');
|
|
||||||
+ filename[sizeof(filename)-1] = '\0';
|
|
||||||
+
|
|
||||||
+ /* hang around for /proc to catch up */
|
|
||||||
+ for (i = 100; i; i--) {
|
|
||||||
+ if (stat(filename, &buf) == 0)
|
|
||||||
+ break;
|
|
||||||
+
|
|
||||||
+ usleep(30000);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ fd = open(filename, O_RDONLY);
|
|
||||||
+ if (!fd) {
|
|
||||||
+ err("unable to open '%s'", filename);
|
|
||||||
+ ret = 1;
|
|
||||||
+ goto exit;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ len = read(fd, media, sizeof(media));
|
|
||||||
+ if (len <= 0) {
|
|
||||||
+ err("unable to read from '%s'", filename);
|
|
||||||
+ ret = 1;
|
|
||||||
+ goto close;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ media[len] = '\0';
|
|
||||||
+ if (media[len-1] == '\n')
|
|
||||||
+ media[len-1] = '\0';
|
|
||||||
+
|
|
||||||
+ if (export) {
|
|
||||||
+ printf("IDE_HOST=%d\n", host);
|
|
||||||
+ printf("IDE_DRIVE=%d\n", drive);
|
|
||||||
+ printf("IDE_DEVICE=hd%x\n", dev);
|
|
||||||
+ printf("IDE_MEDIA=%s\n", media);
|
|
||||||
+ } else {
|
|
||||||
+ printf("%s\n", media);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+close:
|
|
||||||
+ close(fd);
|
|
||||||
+exit:
|
|
||||||
+ logging_close();
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
@ -1,209 +0,0 @@
|
|||||||
diff -ruNp udev-103~/extras/usb_device_name/Makefile udev-103/extras/usb_device_name/Makefile
|
|
||||||
--- udev-103~/extras/usb_device_name/Makefile 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ udev-103/extras/usb_device_name/Makefile 2006-11-02 12:57:53.000000000 +0000
|
|
||||||
@@ -0,0 +1,67 @@
|
|
||||||
+# Copyright © 2005 Canonical Ltd.
|
|
||||||
+# Author: Scott James Remnant <scott@ubuntu.com>
|
|
||||||
+#
|
|
||||||
+# Released under the GNU General Public License, version 2.
|
|
||||||
+
|
|
||||||
+PROG = usb_device_name
|
|
||||||
+OBJ =
|
|
||||||
+HEADERS =
|
|
||||||
+GEN_HEADERS =
|
|
||||||
+MAN_PAGES =
|
|
||||||
+
|
|
||||||
+prefix =
|
|
||||||
+etcdir = ${prefix}/etc
|
|
||||||
+sbindir = ${prefix}/sbin
|
|
||||||
+usrbindir = ${prefix}/usr/bin
|
|
||||||
+usrsbindir = ${prefix}/usr/sbin
|
|
||||||
+libudevdir = ${prefix}/lib/udev
|
|
||||||
+mandir = ${prefix}/usr/share/man
|
|
||||||
+configdir = ${etcdir}/udev/
|
|
||||||
+
|
|
||||||
+INSTALL = /usr/bin/install -c
|
|
||||||
+INSTALL_PROGRAM = ${INSTALL}
|
|
||||||
+INSTALL_DATA = ${INSTALL} -m 644
|
|
||||||
+INSTALL_SCRIPT = ${INSTALL_PROGRAM}
|
|
||||||
+
|
|
||||||
+all: $(PROG) $(MAN_PAGES)
|
|
||||||
+.PHONY: all
|
|
||||||
+.DEFAULT: all
|
|
||||||
+
|
|
||||||
+%.o: %.c $(GEN_HEADERS)
|
|
||||||
+ $(E) " CC " $@
|
|
||||||
+ $(Q) $(CC) -c $(CFLAGS) $< -o $@
|
|
||||||
+
|
|
||||||
+$(PROG): %: $(HEADERS) %.o $(OBJS)
|
|
||||||
+ $(E) " LD " $@
|
|
||||||
+ $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS)
|
|
||||||
+
|
|
||||||
+# man pages
|
|
||||||
+%.8: %.xml
|
|
||||||
+ $(E) " XMLTO " $@
|
|
||||||
+ $(Q) xmlto man $?
|
|
||||||
+.PRECIOUS: %.8
|
|
||||||
+
|
|
||||||
+clean:
|
|
||||||
+ $(E) " CLEAN "
|
|
||||||
+ $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS)
|
|
||||||
+.PHONY: clean
|
|
||||||
+
|
|
||||||
+install-bin: all
|
|
||||||
+ $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG)
|
|
||||||
+.PHONY: install-bin
|
|
||||||
+
|
|
||||||
+uninstall-bin:
|
|
||||||
+ - rm $(DESTDIR)$(libudevdir)/$(PROG)
|
|
||||||
+.PHONY: uninstall-bin
|
|
||||||
+
|
|
||||||
+install-man:
|
|
||||||
+ $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8
|
|
||||||
+.PHONY: uninstall-man
|
|
||||||
+
|
|
||||||
+uninstall-man:
|
|
||||||
+ -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8
|
|
||||||
+.PHONY: uninstall-man
|
|
||||||
+
|
|
||||||
+install-config:
|
|
||||||
+ @echo "no config file to install"
|
|
||||||
+.PHONY: install-config
|
|
||||||
diff -ruNp udev-103~/extras/usb_device_name/usb_device_name.8 udev-103/extras/usb_device_name/usb_device_name.8
|
|
||||||
--- udev-103~/extras/usb_device_name/usb_device_name.8 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ udev-103/extras/usb_device_name/usb_device_name.8 2006-11-02 12:57:53.000000000 +0000
|
|
||||||
@@ -0,0 +1,28 @@
|
|
||||||
+.TH USB_DEVICE_NAME 8 "November 2005" "" "Linux Administrator's Manual"
|
|
||||||
+.SH NAME
|
|
||||||
+usb_device_name \- udev callout to split kernel name for usb devices
|
|
||||||
+.SH SYNOPSIS
|
|
||||||
+.BI usb_device_name
|
|
||||||
+[\fI--export\fP] \fIdevicename\fP
|
|
||||||
+.SH DESCRIPTION
|
|
||||||
+.B usb_device_name
|
|
||||||
+is normally called from a udev rule to split the kernel-assigned name for a
|
|
||||||
+device in the usb_device subsystem into bus and device numbers. Udev can use
|
|
||||||
+this information to construct a name under /dev/bus/usb for the real device
|
|
||||||
+node.
|
|
||||||
+.SH USAGE
|
|
||||||
+.B usb_device_name
|
|
||||||
+splits the kernel-assigned name specified on the command-line and prints the
|
|
||||||
+information chosen by the options.
|
|
||||||
+.SH OPTIONS
|
|
||||||
+The following command-line switches are supported to specify what
|
|
||||||
+usb_device_name should print:
|
|
||||||
+.TP
|
|
||||||
+.BI --export
|
|
||||||
+print bus and device numbers as USB_BUS and USB_DEV environment variables,
|
|
||||||
+for use with an IMPORT{program} rule.
|
|
||||||
+.RE
|
|
||||||
+.SH SEE ALSO
|
|
||||||
+.BR udev (8)
|
|
||||||
+.SH AUTHORS
|
|
||||||
+Scott James Remnant <scott@ubuntu.com>
|
|
||||||
diff -ruNp udev-103~/extras/usb_device_name/usb_device_name.c udev-103/extras/usb_device_name/usb_device_name.c
|
|
||||||
--- udev-103~/extras/usb_device_name/usb_device_name.c 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ udev-103/extras/usb_device_name/usb_device_name.c 2006-11-02 12:57:53.000000000 +0000
|
|
||||||
@@ -0,0 +1,102 @@
|
|
||||||
+/*
|
|
||||||
+ * usb_device_name - splits kernel name for usb_device subsystem
|
|
||||||
+ *
|
|
||||||
+ * Copyright © 2006 Canonical Ltd.
|
|
||||||
+ * Author: Scott James Remnant <scott@ubuntu.com>
|
|
||||||
+ *
|
|
||||||
+ * This program is free software; you can redistribute it and/or modify it
|
|
||||||
+ * under the terms of the GNU General Public License as published by the
|
|
||||||
+ * Free Software Foundation version 2 of the License.
|
|
||||||
+ *
|
|
||||||
+ * This program is distributed in the hope that it will be useful, but
|
|
||||||
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
+ * General Public License for more details.
|
|
||||||
+ *
|
|
||||||
+ * You should have received a copy of the GNU General Public License along
|
|
||||||
+ * with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
+ *
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#include <stdio.h>
|
|
||||||
+#include <stdlib.h>
|
|
||||||
+#include <string.h>
|
|
||||||
+
|
|
||||||
+#include "../../udev.h"
|
|
||||||
+
|
|
||||||
+#ifdef USE_LOG
|
|
||||||
+void log_message(int priority, const char *format, ...)
|
|
||||||
+{
|
|
||||||
+ va_list args;
|
|
||||||
+ static int udev_log = -1;
|
|
||||||
+
|
|
||||||
+ if (udev_log == -1) {
|
|
||||||
+ const char *value;
|
|
||||||
+
|
|
||||||
+ value = getenv("UDEV_LOG");
|
|
||||||
+ if (value)
|
|
||||||
+ udev_log = log_priority(value);
|
|
||||||
+ else
|
|
||||||
+ udev_log = LOG_ERR;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (priority > udev_log)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ va_start(args, format);
|
|
||||||
+ vsyslog(priority, format, args);
|
|
||||||
+ va_end(args);
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+int main(int argc, char *argv[])
|
|
||||||
+{
|
|
||||||
+ const char *name = NULL, *ptr;
|
|
||||||
+ int export = 0, ret = 0;
|
|
||||||
+ int i, bus, dev;
|
|
||||||
+
|
|
||||||
+ logging_init("usb_device_name");
|
|
||||||
+
|
|
||||||
+ for (i = 1; i < argc; i++) {
|
|
||||||
+ if (strcmp(argv[i], "--export") == 0) {
|
|
||||||
+ export = 1;
|
|
||||||
+ } else {
|
|
||||||
+ name = argv[i];
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!name) {
|
|
||||||
+ err("no device name specified");
|
|
||||||
+ ret = 1;
|
|
||||||
+ goto exit;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (strncmp(name, "usbdev", 6) != 0) {
|
|
||||||
+ info("device not usb_device");
|
|
||||||
+ ret = 1;
|
|
||||||
+ goto exit;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ ptr = strchr(name, '.');
|
|
||||||
+ if (!ptr) {
|
|
||||||
+ err("device name contains no device");
|
|
||||||
+ ret = 1;
|
|
||||||
+ goto exit;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ name += 6;
|
|
||||||
+ bus = atoi(name);
|
|
||||||
+ dev = atoi(ptr + 1);
|
|
||||||
+
|
|
||||||
+ if (export) {
|
|
||||||
+ printf("USB_BUS=%03d\n", bus);
|
|
||||||
+ printf("USB_DEV=%03d\n", dev);
|
|
||||||
+ } else {
|
|
||||||
+ printf("%03d.%03d\n", bus, dev);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+exit:
|
|
||||||
+ logging_close();
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
@ -1 +1 @@
|
|||||||
http://www.eu.kernel.org/pub/linux/utils/kernel/hotplug/udev-136.tar.bz2
|
http://www.eu.kernel.org/pub/linux/utils/kernel/hotplug/udev-145.tar.bz2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user