Message ID | c2db64123f07831c484ee19b69349d30be439ab4.1380892944.git.kibo@prevas.dk |
---|---|
State | Changes Requested |
Delegated to: | Esben Haabendal |
Headers | show |
Hi Kim What is the benefit of doing it this way, instead of just adding a pre-made symlink to the rootfs? /Esben Kim Bøndergaard <kibo@prevas.dk> writes: > --- > recipes/touch/files/mdev-event-helper.sh | 9 +++++++++ > recipes/touch/files/mdev.conf | 1 + > recipes/touch/touch.oe | 29 +++++++++++++++++++++++++++++ > 3 files changed, 39 insertions(+) > create mode 100644 recipes/touch/files/mdev-event-helper.sh > create mode 100644 recipes/touch/files/mdev.conf > create mode 100644 recipes/touch/touch.oe > > diff --git a/recipes/touch/files/mdev-event-helper.sh b/recipes/touch/files/mdev-event-helper.sh > new file mode 100644 > index 0000000..4b49b0c > --- /dev/null > +++ b/recipes/touch/files/mdev-event-helper.sh > @@ -0,0 +1,9 @@ > +#!/bin/sh > +[ -d /dev/input ] || mkdir /dev/input > + > +NAME=`cat /sys/class/$SUBSYSTEM/$MDEV/device/name` > + > + > +[ "$NAME" = "PLACEHOLDER_TOUCH_NAME" ] \ > + && ln -sf /dev/$MDEV /dev/input/touch0 > + > diff --git a/recipes/touch/files/mdev.conf b/recipes/touch/files/mdev.conf > new file mode 100644 > index 0000000..7ba1718 > --- /dev/null > +++ b/recipes/touch/files/mdev.conf > @@ -0,0 +1 @@ > +event[0-9] root:root 660 @/usr/bin/mdev-event-helper.sh > diff --git a/recipes/touch/touch.oe b/recipes/touch/touch.oe > new file mode 100644 > index 0000000..81257bc > --- /dev/null > +++ b/recipes/touch/touch.oe > @@ -0,0 +1,29 @@ > +DESCRIPTION = """ > +Purpose of the touch recipe is to ensure a touch device being > +deployed as /dev/eventX can always be reached using the name /dev/touch0 should that be /dev/input/touch0 ? > +""" > +LICENSE = "MIT" > + > +inherit mdev > + > +SRC_URI = """ > + file://mdev.conf > + file://mdev-event-helper.sh > +""" > + > +RECIPE_FLAGS += "touch-name" > + > +DEFAULT_USE_touch-name = "name of touch device" > + > +do_install () { > + install -d ${D}${bindir} > + install -m 0755 ${SRCDIR}/mdev-event-helper.sh ${D}${bindir}/ > +} > + > +do_install[postfuncs] += "do_install_touch_name_fixup" > +do_install_touch_name_fixup() { > + sed -i -e 's/PLACEHOLDER_TOUCH_NAME/${USE_touch-name}/g' \ > + ${D}${bindir}/mdev-event-helper.sh > +} > + > +
Hi Esben It is my experience that dev/eventX might change over boots (dependant on devices discovered and/or timings during boot) thus also resulting in /dev/eventX changing over time. So if your suggestion is to make e.g. ln -s /dev/event6 /dev/input/touch0 permanently it will eventually fail. Using the provided mdev-event-helper script you always get a soft link referring the right event device. Regarding your comment to the /dev/input/touch0: You are right it is a typo An important notice by the way: This is proven to work with busybox 1.19. I once tryed to upgrade busybox to 1.21 with the result that this recipe broke. Apparently mdev behaves differently in the newer busybox /Kim
Kim Bøndergaard Poulsen <Kim.BondergaardPoulsen@prevas.dk> writes: > Hi Esben > > It is my experience that dev/eventX might change over boots (dependant > on devices discovered and/or timings during boot) thus also resulting > in /dev/eventX changing over time. > So if your suggestion is to make e.g. ln -s /dev/event6 > /dev/input/touch0 permanently it will eventually fail. Ok. > Using the provided mdev-event-helper script you always get a soft link > referring the right event device. I probably misunderstood the meaning of the USE_touch-name flag (which by the way should be changed to USE_touch_name. Could you give an example of what values you would use for this flag? Actually, the whole recipe would probably be better named touch-setup, and not just touch (and the USE flag renamed accordingly). > Regarding your comment to the /dev/input/touch0: You are right it is a typo > > An important notice by the way: This is proven to work with busybox > 1.19. I once tryed to upgrade busybox to 1.21 with the result that > this recipe broke. Apparently mdev behaves differently in the newer > busybox Eek. Could you perhaps find some time fo fixup this recipe for busybox 1.21? I think that most OE-lite Linux BSP's have been upgraded to busybox 1.21... /Esben > > /Kim > ________________________________________ > From: Esben Haabendal [esben.haabendal@dev.prevas.dk] > Sent: Tuesday, October 15, 2013 12:25 PM > To: Kim Bøndergaard Poulsen > Cc: dev@oe-lite.org > Subject: Re: [PATCH 16/17] touch: New recipe. Input based on kernel events > > Hi Kim > > What is the benefit of doing it this way, instead of just adding a > pre-made symlink to the rootfs? > > /Esben > > Kim Bøndergaard <kibo@prevas.dk> writes: > >> --- >> recipes/touch/files/mdev-event-helper.sh | 9 +++++++++ >> recipes/touch/files/mdev.conf | 1 + >> recipes/touch/touch.oe | 29 +++++++++++++++++++++++++++++ >> 3 files changed, 39 insertions(+) >> create mode 100644 recipes/touch/files/mdev-event-helper.sh >> create mode 100644 recipes/touch/files/mdev.conf >> create mode 100644 recipes/touch/touch.oe >> >> diff --git a/recipes/touch/files/mdev-event-helper.sh b/recipes/touch/files/mdev-event-helper.sh >> new file mode 100644 >> index 0000000..4b49b0c >> --- /dev/null >> +++ b/recipes/touch/files/mdev-event-helper.sh >> @@ -0,0 +1,9 @@ >> +#!/bin/sh >> +[ -d /dev/input ] || mkdir /dev/input >> + >> +NAME=`cat /sys/class/$SUBSYSTEM/$MDEV/device/name` >> + >> + >> +[ "$NAME" = "PLACEHOLDER_TOUCH_NAME" ] \ >> + && ln -sf /dev/$MDEV /dev/input/touch0 >> + >> diff --git a/recipes/touch/files/mdev.conf b/recipes/touch/files/mdev.conf >> new file mode 100644 >> index 0000000..7ba1718 >> --- /dev/null >> +++ b/recipes/touch/files/mdev.conf >> @@ -0,0 +1 @@ >> +event[0-9] root:root 660 @/usr/bin/mdev-event-helper.sh >> diff --git a/recipes/touch/touch.oe b/recipes/touch/touch.oe >> new file mode 100644 >> index 0000000..81257bc >> --- /dev/null >> +++ b/recipes/touch/touch.oe >> @@ -0,0 +1,29 @@ >> +DESCRIPTION = """ >> +Purpose of the touch recipe is to ensure a touch device being >> +deployed as /dev/eventX can always be reached using the name /dev/touch0 > > should that be /dev/input/touch0 ? > >> +""" >> +LICENSE = "MIT" >> + >> +inherit mdev >> + >> +SRC_URI = """ >> + file://mdev.conf >> + file://mdev-event-helper.sh >> +""" >> + >> +RECIPE_FLAGS += "touch-name" >> + >> +DEFAULT_USE_touch-name = "name of touch device" >> + >> +do_install () { >> + install -d ${D}${bindir} >> + install -m 0755 ${SRCDIR}/mdev-event-helper.sh ${D}${bindir}/ >> +} >> + >> +do_install[postfuncs] += "do_install_touch_name_fixup" >> +do_install_touch_name_fixup() { >> + sed -i -e 's/PLACEHOLDER_TOUCH_NAME/${USE_touch-name}/g' \ >> + ${D}${bindir}/mdev-event-helper.sh >> +} >> + >> +
diff --git a/recipes/touch/files/mdev-event-helper.sh b/recipes/touch/files/mdev-event-helper.sh new file mode 100644 index 0000000..4b49b0c --- /dev/null +++ b/recipes/touch/files/mdev-event-helper.sh @@ -0,0 +1,9 @@ +#!/bin/sh +[ -d /dev/input ] || mkdir /dev/input + +NAME=`cat /sys/class/$SUBSYSTEM/$MDEV/device/name` + + +[ "$NAME" = "PLACEHOLDER_TOUCH_NAME" ] \ + && ln -sf /dev/$MDEV /dev/input/touch0 + diff --git a/recipes/touch/files/mdev.conf b/recipes/touch/files/mdev.conf new file mode 100644 index 0000000..7ba1718 --- /dev/null +++ b/recipes/touch/files/mdev.conf @@ -0,0 +1 @@ +event[0-9] root:root 660 @/usr/bin/mdev-event-helper.sh diff --git a/recipes/touch/touch.oe b/recipes/touch/touch.oe new file mode 100644 index 0000000..81257bc --- /dev/null +++ b/recipes/touch/touch.oe @@ -0,0 +1,29 @@ +DESCRIPTION = """ +Purpose of the touch recipe is to ensure a touch device being +deployed as /dev/eventX can always be reached using the name /dev/touch0 +""" +LICENSE = "MIT" + +inherit mdev + +SRC_URI = """ + file://mdev.conf + file://mdev-event-helper.sh +""" + +RECIPE_FLAGS += "touch-name" + +DEFAULT_USE_touch-name = "name of touch device" + +do_install () { + install -d ${D}${bindir} + install -m 0755 ${SRCDIR}/mdev-event-helper.sh ${D}${bindir}/ +} + +do_install[postfuncs] += "do_install_touch_name_fixup" +do_install_touch_name_fixup() { + sed -i -e 's/PLACEHOLDER_TOUCH_NAME/${USE_touch-name}/g' \ + ${D}${bindir}/mdev-event-helper.sh +} + +