[oe] [PATCH] busybox's mdev: add script to populate /dev/bus/usb
Eric Bénard
eric at eukrea.com
Thu Sep 23 17:42:37 UTC 2010
* needed for libusb on kernel without CONFIG_USB_DEVICEFS
Signed-off-by: Eric Bénard <eric at eukrea.com>
---
recipes/busybox/busybox_1.13.2.bb | 4 +++-
recipes/busybox/files/mdev.conf | 2 +-
recipes/busybox/files/usb.sh | 34 ++++++++++++++++++++++++++++++++++
3 files changed, 38 insertions(+), 2 deletions(-)
create mode 100644 recipes/busybox/files/usb.sh
diff --git a/recipes/busybox/busybox_1.13.2.bb b/recipes/busybox/busybox_1.13.2.bb
index a3acceb..fce7504 100644
--- a/recipes/busybox/busybox_1.13.2.bb
+++ b/recipes/busybox/busybox_1.13.2.bb
@@ -1,5 +1,5 @@
require busybox.inc
-PR = "${INC_PR}.3"
+PR = "${INC_PR}.4"
SRC_URI = "\
http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
@@ -39,6 +39,7 @@ SRC_URI = "\
file://defconfig \
file://mdev \
file://mdev.conf \
+ file://usb.sh \
"
SRC_URI[tarball.md5sum] = "9e2a604d18bef219a5a6bf3acf78b9e1"
SRC_URI[tarball.sha256sum] = "927774408bd982dd246fb716bb2e646ab0708ce321b42c5e271dc98c1f5d1dc8"
@@ -56,5 +57,6 @@ do_install_append() {
install -d ${D}${sysconfdir}/init.d/
install -d ${D}${sysconfdir}/mdev
install -m 0755 ${WORKDIR}/find-touchscreen.sh ${D}${sysconfdir}/mdev/
+ install -m 0755 ${WORKDIR}/usb.sh ${D}${sysconfdir}/mdev/
install -m 0755 ${WORKDIR}/mdev ${D}${sysconfdir}/init.d/
}
diff --git a/recipes/busybox/files/mdev.conf b/recipes/busybox/files/mdev.conf
index 8f57b0a..2aa8f26 100644
--- a/recipes/busybox/files/mdev.conf
+++ b/recipes/busybox/files/mdev.conf
@@ -20,7 +20,7 @@ sda 0:6 0640
tty 0:5 0666
tty.* 0:0 0620
urandom 0:0 0666
-usbdev.* 0:0 0660
+usbdev.* 0:0 0660 */etc/mdev/usb.sh
vcs.* 0:5 0660
zero 0:0 0666
diff --git a/recipes/busybox/files/usb.sh b/recipes/busybox/files/usb.sh
new file mode 100644
index 0000000..cf776e7
--- /dev/null
+++ b/recipes/busybox/files/usb.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+case "$ACTION" in
+ add|"")
+ for uevent in /sys/class/usb_device/usbdev?.*/*/uevent; do
+ . $uevent
+ if [ ! -e /dev/bus/usb/$BUSNUM/$DEVNUM ]; then
+ mkdir -p /dev/bus/usb/$BUSNUM
+ mknod /dev/bus/usb/$BUSNUM/$DEVNUM c 189 $MINOR
+ fi
+ done
+ ;;
+ remove)
+ for device in /dev/bus/usb/*/*; do
+ REMOVED=1
+ dev=`basename $device`
+ bus=`basename $(dirname $device)`
+ for uevent in /sys/class/usb_device/usbdev?.*/*/uevent; do
+ . $uevent
+ echo $dev $DEVNUM $bus $BUSNUM >> /tmp/rem.txt
+ if [ $dev -eq $DEVNUM ] && [ $bus -eq $BUSNUM ]; then
+ REMOVED=0
+ break;
+ fi
+ done
+ if [ $REMOVED -eq 1 ]; then
+ rm /dev/bus/usb/$bus/$dev
+ if [ -z $(ls /dev/bus/usb/$bus/) ]; then
+ rmdir /dev/bus/usb/$bus/
+ fi
+ fi
+ done
+ ;;
+esac
--
1.6.3.3
More information about the Openembedded-devel
mailing list