busybox's mdev: add script to populate /dev/bus/usb
PATCH 1/1 busybox's mdev: add script to populate /dev/bus/usb
* needed for libusb on kernel without CONFIG_USB_DEVICEFS
Signed-off-by Eric Bénard <[email protected]>
--- 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
recipes/busybox/busybox_1.13.2.bb +3 -1
@@ -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/ }
recipes/busybox/files/mdev.conf +1 -1
@@ -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
recipes/busybox/files/usb.sh new file +34 -0
@@ -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
Signature · 1 line
1.6.3.3
Quoted 4 lines · Eric Bénard
* needed for libusb on kernel without
CONFIG_USB_DEVICEFSSigned-off-by Eric Bénard<[email protected]>---
.../...
recipes/busybox/files/usb.sh
Quoted 2 lines
recipes/busybox/files/usb.sh new file +0
-0
.../...
Quoted 1 line
+ echo $dev $DEVNUM $bus $BUSNUM>>
/tmp/rem.txt
this line should not be here ;-)
If the principle of this patch is ok, I'll remove that and resubmit.
Eric