All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] busybox's mdev: add script to populate /dev/bus/usb
@ 2010-09-23 17:42 Eric Bénard
  2010-09-23 17:45 ` Eric Bénard
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Bénard @ 2010-09-23 17:42 UTC (permalink / raw)
  To: openembedded-devel

* needed for libusb on kernel without CONFIG_USB_DEVICEFS

Signed-off-by: Eric Bénard <eric@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




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] busybox's mdev: add script to populate /dev/bus/usb
  2010-09-23 17:42 [PATCH] busybox's mdev: add script to populate /dev/bus/usb Eric Bénard
@ 2010-09-23 17:45 ` Eric Bénard
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Bénard @ 2010-09-23 17:45 UTC (permalink / raw)
  To: openembedded-devel

Le 23/09/2010 19:42, Eric Bénard a écrit :
> * needed for libusb on kernel without CONFIG_USB_DEVICEFS
>
> Signed-off-by: Eric Bénard<eric@eukrea.com>
> ---
.../...
> --- /dev/null
> +++ b/recipes/busybox/files/usb.sh
.../...
> +        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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-23 17:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-23 17:42 [PATCH] busybox's mdev: add script to populate /dev/bus/usb Eric Bénard
2010-09-23 17:45 ` Eric Bénard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.