~alpine/users

3 2

Detect AudioCD insertion & list tracks

Details
Message ID
<bc4f54788876e3e239be5ac4691a7848@ipik.org>
DKIM signature
missing
Download raw message
Hi,

I'm trying to skim down a Debian application onto Alpine, and struggle
to transform some basic features.
I need to execute a script when an AudioCD is inserted to basically
list available audio tracks.

On Debian this was simply achieved with a udev rule similar to this
exemple:
http://moodeaudio.org/forum/showthread.php?tid=1670

I'm wondering how I could do without udev on Alpine.
mdev does not seem to fully accomplish that, as sr0 event seems to only
kick-in at boot, not everytime a CD is inserted.
> sr0	root:cdrom 0660 @ln -sf $MDEV cdrom;/home/my_user/my_script.sh

Appreciate any help & suggestions.
BR
Marco Dickert <marco@misterunknown.de>
Details
Message ID
<20200113163716.GA3940@marco.themis.pinknet.de>
In-Reply-To
<bc4f54788876e3e239be5ac4691a7848@ipik.org> (view parent)
DKIM signature
missing
Download raw message
Hi,

On 2020-01-13 10:26:43, macmpi wrote:
> I'm wondering how I could do without udev on Alpine.
> mdev does not seem to fully accomplish that, as sr0 event seems to only
> kick-in at boot, not everytime a CD is inserted.

as far as I understand the documentation [1], this is not possible. I
fear you'd have to use udev for that. Also I can't imagine that the
busybox guys would implement that feature, as they want to keep their
implementations as minimal as possible.

[1] https://git.busybox.net/busybox/plain/docs/mdev.txt

-- 
Marco Dickert
marco@misterunknown.de
https://misterunknown.de
Details
Message ID
<EDC85CB3-D047-41BB-BA07-D261C7B26879@ipik.org>
In-Reply-To
<20200113163716.GA3940@marco.themis.pinknet.de> (view parent)
DKIM signature
missing
Download raw message
Thanks Marco for the feedback.
> as far as I understand the documentation, this is not possible.

However, after more digging, is seems mdev does support few kernel
hotplug env variables ($ACTION, …)
https://git.busybox.net/busybox/tree/util-linux/mdev.c#n126

Some Alpine scripts like /lib/mdev/usbdev use them for instance.

Unfortunately I do not manage to check/reveal env variables
values for the event I trigger in such explicit way:
https://quirk.ch/2010/01/how-to-set-up-mdev-rules-for-busybox
nor even use them...
Details
Message ID
<6C3EA2CC-0A81-412B-9B87-1B60C8A3B99A@ipik.org>
In-Reply-To
<EDC85CB3-D047-41BB-BA07-D261C7B26879@ipik.org> (view parent)
DKIM signature
missing
Download raw message
...some progress, but unexpected outcome.

I managed to log env variables across certain events (plug/unplug usb
disk, change CDs)
Usb disk events clearly show ACTION=bind or ACTION=unbind accordingly
(plus other variables).
However, while ejecting a Audio CD shows the following:
DEVNAME=sr0
ACTION=change
SHLVL=1
HOME=/
SEQNUM=1118
MAJOR=11
DISK_MEDIA_CHANGE=1
DEVPATH=/devices/platform/soc/20980000.usb/usb1/1-1/1-1.2/1-1.2:1.0/
host0/target0:0:0/0:0:0:0/block/sr0
SUBSYSTEM=block
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MINOR=0
PWD=/
DEVTYPE=disk

strangely enough, inserting a CD does NOT generate ANY event at all
(no SEQNUM increment, nothing).
I'm on (uname -a):
Linux 5.4.8-0-rpi #1-Alpine Tue Jan 7 13:32:22 UTC 2020 armv6l Linux

Shouldn't CD insertion generate a hotplug event like ejecting does,
and plug/unplug USB disk do too?
Possibly a Kernel issue?
Reply to thread Export thread (mbox)