Skip to content

Commit

Permalink
contrib: add example rules script
Browse files Browse the repository at this point in the history
  • Loading branch information
Ella-0 committed Jul 12, 2024
1 parent 3026c4e commit 4f12d0a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@

PREFIX = /usr/local
LIBDIR = ${PREFIX}/lib
LIBEXECDIR = ${PREFIX}/libexec
INCLUDEDIR = ${PREFIX}/include
PKGCONFIGDIR = ${LIBDIR}/pkgconfig
XCFLAGS = ${CPPFLAGS} ${CFLAGS} -std=c99 -fPIC -D_XOPEN_SOURCE=700 \
-Wall -Wextra -Wpedantic -Wmissing-prototypes -Wstrict-prototypes \
-Wno-unused-parameter
-Wno-unused-parameter \
-DRULES_HELPER_PATH=\"${LIBEXECDIR}/libudev-zero-rules-helper\"
XLDFLAGS = ${LDFLAGS} -shared -Wl,-soname,libudev.so.1
XARFLAGS = -rc
AR = ar
Expand Down
15 changes: 15 additions & 0 deletions contrib/libudev-zero-rules-helper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh -e

if [ "$SUBSYSTEM" = "sound" ]
then
if printf '%s' "$SYSNAME" | grep '^card' > /dev/null
then
printf 'SOUND_INITIALIZED=1\n'
fi

if printf '%s' "$SYSNAME" | grep '^pcmC.*D2c$' > /dev/null \
&& grep '^AppleJ' "$SYSPATH/device/id" 2>/dev/null
then
printf 'ACP_IGNORE=1\n'
fi
fi
2 changes: 1 addition & 1 deletion udev_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
#endif

#ifndef RULES_HELPER_PATH
#define RULES_HELPER_PATH "/sbin/libudev-zero-rules-helper"
#error "RULES_HELPER_PATH not specified"
#endif

#ifndef UEVENT_NUM_ENVP
Expand Down

0 comments on commit 4f12d0a

Please sign in to comment.