Skip to contentSkip to conversation

two patches

PATCH Yury G. Kudryashov 3 participants 11 messages Apr 16, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

Hi!

Review the attached patches, please.

From 5cc42c6f87f690fdf66e29de2a816dab49a119f4 Mon Sep 17 00:00:00 2001
From: Yury G. Kudryashov <[email protected]>
Date: Fri, 16 Apr 2010 00:21:02 +0400
Subject: [PATCH 1/2] Include linux/types.h

---
 extras/hid2hci/hid2hci.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
extras/hid2hci/hid2hci.c +1 -0
index 0d0a022..839c4fb 100644
@@ -28,6 +28,7 @@
 #include <string.h>
 #include <getopt.h>
 #include <sys/ioctl.h>
+#include <linux/types.h>
 #include <linux/hiddev.h>
 #include <usb.h>
 
Signature · 1 line
1.7.0.5

From f9881e554deafad1301d00e4539a02fe63078c00 Mon Sep 17 00:00:00 2001
From: Yury G. Kudryashov <[email protected]>
Date: Fri, 16 Apr 2010 09:38:32 +0400
Subject: [PATCH 2/2] Add --with-firmware-path configure option

---
 Makefile.am                |    3 ++-
 configure.ac               |   22 ++++++++++++++++++++++
 extras/firmware/firmware.c |   10 ++++++----
 3 files changed, 30 insertions(+), 5 deletions(-)
Makefile.am +2 -1
index 68a68d9..f094746 100644
@@ -156,7 +156,7 @@ EXTRA_DIST += \
 	udev/udevd.xml
 
 %.7 %.8 : %.xml
-	$(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
+	$(XSLTPROC) -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
 
 # ------------------------------------------------------------------------------
 # udev tests
@@ -194,6 +194,7 @@ dist_udevrules_DATA += \
 # ------------------------------------------------------------------------------
 extras_firmware_firmware_SOURCES = extras/firmware/firmware.c
 extras_firmware_firmware_LDADD = libudev/libudev-private.la
+extras_firmware_firmware_CPPFLAGS = $(AM_CPPFLAGS) -DFIRMWARE_PATH="$(FIRMWARE_PATH)"
 dist_udevrules_DATA += extras/firmware/50-firmware.rules
 libexec_PROGRAMS = extras/firmware/firmware
 
configure.ac +22 -0
index 492fa02..5defd5c 100644
@@ -82,6 +82,27 @@ if test "x$enable_extras" = xyes; then
 		fi])
 	AC_SUBST(PCI_DATABASE)
 
+	AC_ARG_WITH(firmware-path,
+		AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
+		   [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]),
+		[],
+		[with_firmware_path="/lib/fimware/updates:/lib/fimware"]
+		)
+	[
+	OLD_IFS=$IFS
+	IFS=:
+	for i in $with_firmware_path
+	do
+		if [ "x${FIRMWARE_PATH}" == "x" ]; then
+			FIRMWARE_PATH="\\\"${i}/\\\""
+		else
+			FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\""
+		fi
+	done
+	IFS=$OLD_IFS
+	]
+	AC_SUBST([FIRMWARE_PATH], [$FIRMWARE_PATH])
+
 	AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found]))
 	AC_SUBST([INCLUDE_PREFIX], [$(echo '#include <linux/input.h>' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')])
 fi
@@ -144,6 +165,7 @@ AC_MSG_RESULT([
 
 	usb.ids:		${USB_DATABASE}
 	pci.ids:		${PCI_DATABASE}
+	firmware path:		${FIRMWARE_PATH}
 
 	xsltproc:		${XSLTPROC}
 	gperf:			${GPERF}
extras/firmware/firmware.c +6 -4
index 92f0918..76071db 100644
@@ -79,10 +79,7 @@ int main(int argc, char **argv)
 		{ "help", no_argument, NULL, 'h' },
 		{}
 	};
-	static const char *searchpath[] = {
-		"/lib/firmware/updates/",
-		"/lib/firmware/"
-	};
+	static const char *searchpath[] = { FIRMWARE_PATH };
 	char fwencpath[UTIL_PATH_SIZE];
 	char misspath[UTIL_PATH_SIZE];
 	char loadpath[UTIL_PATH_SIZE];
@@ -97,6 +94,11 @@ int main(int argc, char **argv)
 	unsigned int i;
 	int rc = 0;
 
+	for (i = 0; i < ARRAY_SIZE(searchpath); i++) {
+		printf("Path %s\n", searchpath[i]);
+	}
+	return 0;
+
 	udev_log_init("firmware");
 
 	for (;;) {
Signature · 1 line
1.7.0.5
#1 lore raw
Quoted 8 lines · Yury G. Kudryashov

Hi!

Review the attached patches, please.

From 5cc42c6f87f690fdf66e29de2a816dab49a119f4 Mon Sep 17 00:00:00 2001
From: Yury G. Kudryashov <[email protected]>
Date: Fri, 16 Apr 2010 00:21:02 +0400
Subject: [PATCH 1/2] Include linux/types.h

1. Prefix the subject with "hid2hci: " so it's clear from the shortlog what this affects.

2. Please include some rational in the commit message. What prototype or datatype is missing that requires including <linux/types.h>?

Quoted 26 lines
---
 extras/hid2hci/hid2hci.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
extras/hid2hci/hid2hci.c +1 -0
index 0d0a022..839c4fb 100644
@@ -28,6 +28,7 @@
 #include <string.h>
 #include <getopt.h>
 #include <sys/ioctl.h>
+#include <linux/types.h>
 #include <linux/hiddev.h>
 #include <usb.h>
 
Signature · 8 lines
1.7.0.5



From f9881e554deafad1301d00e4539a02fe63078c00 Mon Sep 17 00:00:00 2001
From: Yury G. Kudryashov <[email protected]>
Date: Fri, 16 Apr 2010 09:38:32 +0400
Subject: [PATCH 2/2] Add --with-firmware-path configure option

Again, please include some rational in the commit message. What problem is this solving?

Quoted 12 lines
---
 Makefile.am                |    3 ++-
 configure.ac               |   22 ++++++++++++++++++++++
 extras/firmware/firmware.c |   10 ++++++----
 3 files changed, 30 insertions(+), 5 deletions(-)
Makefile.am +0 -0
index 68a68d9..f094746 100644

Makefile.am EXTRA_DIST += \ · line 159

Quoted 5 lines
Makefile.am +1 -1
@@ -156,7 +156,7 @@ EXTRA_DIST += \
 	udev/udevd.xml
 
 %.7 %.8 : %.xml
-	$(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
+	$(XSLTPROC) -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<

This is an unrelated change. Please remove it from this patch.

Quoted 28 lines
Makefile.am +1 -0
 # ------------------------------------------------------------------------------
 # udev tests
@@ -194,6 +194,7 @@ dist_udevrules_DATA += \
 # ------------------------------------------------------------------------------
 extras_firmware_firmware_SOURCES = extras/firmware/firmware.c
 extras_firmware_firmware_LDADD = libudev/libudev-private.la
+extras_firmware_firmware_CPPFLAGS = $(AM_CPPFLAGS) -DFIRMWARE_PATH="$(FIRMWARE_PATH)"
 dist_udevrules_DATA += extras/firmware/50-firmware.rules
 libexec_PROGRAMS = extras/firmware/firmware
 
configure.ac +9 -0
index 492fa02..5defd5c 100644
@@ -82,6 +82,27 @@ if test "x$enable_extras" = xyes; then
 		fi])
 	AC_SUBST(PCI_DATABASE)
 
+	AC_ARG_WITH(firmware-path,
+		AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
+		   [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]),
+		[],
+		[with_firmware_path="/lib/fimware/updates:/lib/fimware"]
+		)
+	[
+	OLD_IFS=$IFS
+	IFS=:

configure.ac if test "x$enable_extras" = xyes; then · line 103

Quoted 10 lines
configure.ac +10 -0
+	for i in $with_firmware_path
+	do
+		if [ "x${FIRMWARE_PATH}" = "x" ]; then
+			FIRMWARE_PATH="\\\"${i}/\\\""
+		else
+			FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\""
+		fi
+	done
+	IFS=$OLD_IFS
+	]

I'm not sure what wrapping this whole section in [] quoting does. It looks like a good handling of the option, though.

Quoted 30 lines
configure.ac +3 -0
+	AC_SUBST([FIRMWARE_PATH], [$FIRMWARE_PATH])
+
 	AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found]))
 	AC_SUBST([INCLUDE_PREFIX], [$(echo '#include <linux/input.h>' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')])
 fi
@@ -144,6 +165,7 @@ AC_MSG_RESULT([
 
 	usb.ids:		${USB_DATABASE}
 	pci.ids:		${PCI_DATABASE}
+	firmware path:		${FIRMWARE_PATH}
 
 	xsltproc:		${XSLTPROC}
 	gperf:			${GPERF}
extras/firmware/firmware.c +1 -4
index 92f0918..76071db 100644
@@ -79,10 +79,7 @@ int main(int argc, char **argv)
 		{ "help", no_argument, NULL, 'h' },
 		{}
 	};
-	static const char *searchpath[] = {
-		"/lib/firmware/updates/",
-		"/lib/firmware/"
-	};
+	static const char *searchpath[] = { FIRMWARE_PATH };
 	char fwencpath[UTIL_PATH_SIZE];
 	char misspath[UTIL_PATH_SIZE];
 	char loadpath[UTIL_PATH_SIZE];

extras/firmware/firmware.c int main(int argc, char **argv) · line 101

Quoted 8 lines
extras/firmware/firmware.c +5 -0
@@ -97,6 +94,11 @@ int main(int argc, char **argv)
 	unsigned int i;
 	int rc = 0;
 
+	for (i = 0; i < ARRAY_SIZE(searchpath); i++) {
+		printf("Path %s\n", searchpath[i]);
+	}
+	return 0;
+

I'm pretty sure the program stops doing anything useful with this hunk. :)

Quoted 5 lines
extras/firmware/firmware.c +0 -0
 	udev_log_init("firmware");
 
 	for (;;) {
Signature · 1 line
1.7.0.5

Besides those small issues, both patches seem pretty good to me.

--
Dan

#2 lore raw
In reply to Yury G. Kudryashov
Quoted 10 lines · Dan Nicholson

configure.ac if test "x$enable_extras" = xyes; then · line 87

Quoted 9 lines · Yury G. Kudryashov
configure.ac +3 -0
@@ -82,6 +82,27 @@ if test "x$enable_extras" = xyes; then
               fi])
       AC_SUBST(PCI_DATABASE)
 
+     AC_ARG_WITH(firmware-path,
+             AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
+                [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]),

Not sure if we need a list of directories here. Wouldn't the prefix /lib/firmware be sufficient, the same way we handle all the other configurable directories?

Kay

#3 lore raw
In reply to Yury G. Kudryashov
Quoted 8 lines · Kay Sievers
Quoted 7 lines · Dan Nicholson
Quoted 6 lines · Yury G. Kudryashov
configure.ac +0 -0
@@ -82,6 +82,27 @@ if test "x$enable_extras" = xyes; then
               fi])
       AC_SUBST(PCI_DATABASE)
 
Quoted 7 lines
Quoted 3 lines

configure.ac if test "x$enable_extras" = xyes; then · line 87

Quoted 3 lines
configure.ac +3 -0
+     AC_ARG_WITH(firmware-path,
+             AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
+                [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]),

Not sure if we need a list of directories here. Wouldn't the prefix /lib/firmware be sufficient, the same way we handle all the other configurable directories?

This is just maintaining the current default in firmware.c. The code already deals with an array of directories, so you might as well let people build in any crazy path they want.

--
Dan

#4 lore raw
In reply to Yury G. Kudryashov
Quoted 12 lines · Dan Nicholson
Quoted 10 lines
Makefile.am +0 -1
@@ -156,7 +156,7 @@ EXTRA_DIST += \
 udev/udevd.xml
 
 %.7 %.8 : %.xml
-	$(XSLTPROC) -o $@ -nonet

http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
$<

(quoted diff) +1 -0
+	$(XSLTPROC) -o $@

http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
$<

This is an unrelated change. Please remove it from this patch.

Oops. Sorry. I should've reread the patch before sending.

Quoted 8 lines
Quoted 8 lines
configure.ac +8 -0
+	[
+	OLD_IFS=$IFS
+	IFS=:
+	for i in $with_firmware_path
+	do
+		if [ "x${FIRMWARE_PATH}" = "x" ]; then
+			FIRMWARE_PATH="\\\"${i}/\\\""
+		else
Quoted 8 lines

configure.ac if test "x$enable_extras" = xyes; then · line 103

Quoted 5 lines
configure.ac +5 -0
+			FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\""
+		fi
+	done
+	IFS=$OLD_IFS
+	]

I'm not sure what wrapping this whole section in [] quoting does. It looks like a good handling of the option, though.

It escapes "if [ ... ]".

#5 lore raw
In reply to Yury G. Kudryashov
Quoted 29 lines · Yury G. Kudryashov
Quoted 12 lines · Dan Nicholson
Quoted 10 lines
(quoted diff) +0 -0
@@ -156,7 +156,7 @@ EXTRA_DIST += \

 udev/udevd.xml

 %.7 %.8 : %.xml
-    $(XSLTPROC) -o $@ -nonet
http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
$<
+    $(XSLTPROC) -o $@
http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
$<

This is an unrelated change. Please remove it from this patch.

Oops. Sorry. I should've reread the patch before sending.

Quoted 14 lines
Quoted 13 lines

+    [
+    OLD_IFS=$IFS
+    IFS=:
+    for i in $with_firmware_path
+    do
+            if [ "x${FIRMWARE_PATH}" = "x" ]; then
+                    FIRMWARE_PATH="\\\"${i}/\\\""
+            else
+                    FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\""
+            fi
+    done
+    IFS=$OLD_IFS
+    ]

Quoted 3 lines
Quoted 2 lines

I'm not sure what wrapping this whole section in [] quoting does. It looks like a good handling of the option, though.

It escapes "if [ ... ]".

Ah. You can also use 'test "x$FIRMWARE_PATH" = x' to avoid that. Also, I should mention that you should use '=' instead of '=' since the former is portable across shells.

--
Dan

#6 lore raw
In reply to Yury G. Kudryashov
Quoted 10 lines · Dan Nicholson
Quoted 8 lines · Yury G. Kudryashov

Hi!

Review the attached patches, please.

From 5cc42c6f87f690fdf66e29de2a816dab49a119f4 Mon Sep 17 00:00:00 2001
From: Yury G. Kudryashov <[email protected]>
Date: Fri, 16 Apr 2010 00:21:02 +0400
Subject: [PATCH 1/2] Include linux/types.h

Quoted 6 lines

1. Prefix the subject with "hid2hci: " so it's clear from the shortlog what
this affects.

2. Please include some rational in the commit message. What prototype or datatype is missing that requires including <linux/types.h>?

Done.

Quoted 7 lines
Quoted 4 lines

From f9881e554deafad1301d00e4539a02fe63078c00 Mon Sep 17 00:00:00 2001
From: Yury G. Kudryashov <[email protected]>
Date: Fri, 16 Apr 2010 09:38:32 +0400
Subject: [PATCH 2/2] Add --with-firmware-path configure option

Again, please include some rational in the commit message. What problem is this solving?

Done.

Quoted 11 lines

Review int main(int argc, char **argv) · line 101

Quoted 9 lines
(quoted diff) +5 -0
@@ -97,6 +94,11 @@ int main(int argc, char **argv)
 unsigned int i;
 int rc = 0;
 
+	for (i = 0; i < ARRAY_SIZE(searchpath); i++) {
+		printf("Path %s\n", searchpath[i]);
+	}
+	return 0;
+

I'm pretty sure the program stops doing anything useful with this hunk. :)

I really should stop posting patches after midnight. I hope that the attached version is better.

From 6d2d2d4d2c665539c140bbf471c8d1e30baf508b Mon Sep 17 00:00:00 2001
From: Yury G. Kudryashov <[email protected]>
Date: Fri, 16 Apr 2010 00:21:02 +0400
Subject: [PATCH 1/2] hid2hci: include linux/types.h for __u32

__u32 in linux/hiddev.h is undefined on my laptop (linux-headers-2.6.28.5). Probably, this is a bug in kernel headers or in my distro but this would not hurt.

---
 extras/hid2hci/hid2hci.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
extras/hid2hci/hid2hci.c +1 -0
index 0d0a022..839c4fb 100644
@@ -28,6 +28,7 @@
 #include <string.h>
 #include <getopt.h>
 #include <sys/ioctl.h>
+#include <linux/types.h>
 #include <linux/hiddev.h>
 #include <usb.h>
 
Signature · 1 line
1.7.0.5

From c810304553d585bc71ffd5633c3cd9241fd2ce15 Mon Sep 17 00:00:00 2001
From: Yury G. Kudryashov <[email protected]>
Date: Fri, 16 Apr 2010 09:38:32 +0400
Subject: [PATCH 2/2] Add --with-firmware-path configure option

In NixOS we need to use non-standard firmware path: we have no /lib.

---
 configure.ac               |   21 +++++++++++++++++++++
 extras/firmware/firmware.c |    5 +----
 2 files changed, 22 insertions(+), 4 deletions(-)
configure.ac +21 -0
index 492fa02..cce70d1 100644
@@ -82,6 +82,26 @@ if test "x$enable_extras" = xyes; then
 		fi])
 	AC_SUBST(PCI_DATABASE)
 
+	AC_ARG_WITH(firmware-path,
+		AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
+		   [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]),
+		[],
+		[with_firmware_path="/lib/fimware/updates:/lib/fimware"]
+		)
+	OLD_IFS=$IFS
+	IFS=:
+	for i in $with_firmware_path
+	do
+		if test "x${FIRMWARE_PATH}" = "x"
+		then
+			FIRMWARE_PATH="\\\"${i}/\\\""
+		else
+			FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\""
+		fi
+	done
+	IFS=$OLD_IFS
+	AC_SUBST([FIRMWARE_PATH], [$FIRMWARE_PATH])
+
 	AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found]))
 	AC_SUBST([INCLUDE_PREFIX], [$(echo '#include <linux/input.h>' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')])
 fi
@@ -144,6 +164,7 @@ AC_MSG_RESULT([
 
 	usb.ids:		${USB_DATABASE}
 	pci.ids:		${PCI_DATABASE}
+	firmware path:		${FIRMWARE_PATH}
 
 	xsltproc:		${XSLTPROC}
 	gperf:			${GPERF}
extras/firmware/firmware.c +1 -4
index 92f0918..76593ba 100644
@@ -79,10 +79,7 @@ int main(int argc, char **argv)
 		{ "help", no_argument, NULL, 'h' },
 		{}
 	};
-	static const char *searchpath[] = {
-		"/lib/firmware/updates/",
-		"/lib/firmware/"
-	};
+	static const char *searchpath[] = { FIRMWARE_PATH };
 	char fwencpath[UTIL_PATH_SIZE];
 	char misspath[UTIL_PATH_SIZE];
 	char loadpath[UTIL_PATH_SIZE];
Signature · 1 line
1.7.0.5
#8 lore raw
In reply to Yury G. Kudryashov
Quoted 2 lines · Yury G. Kudryashov

I really should stop posting patches after midnight. I hope that the attached version is better.

I should also stop posting "fixed" versions of patches without re-compiling. First patch is OK, new version of the second patch is attached.

From 499a8e76e856b1cec3f045407eeb52a5c3d85a18 Mon Sep 17 00:00:00 2001
From: Yury G. Kudryashov <[email protected]>
Date: Fri, 16 Apr 2010 09:38:32 +0400
Subject: [PATCH 2/2] Add --with-firmware-path configure option

In NixOS we need to use non-standard firmware path: we have no /lib.

---
 Makefile.am                |    1 +
 configure.ac               |   21 +++++++++++++++++++++
 extras/firmware/firmware.c |    5 +----
 3 files changed, 23 insertions(+), 4 deletions(-)
Makefile.am +1 -0
index 68a68d9..3b628a4 100644
@@ -194,6 +194,7 @@ dist_udevrules_DATA += \
 # ------------------------------------------------------------------------------
 extras_firmware_firmware_SOURCES = extras/firmware/firmware.c
 extras_firmware_firmware_LDADD = libudev/libudev-private.la
+extras_firmware_firmware_CPPFLAGS = $(AM_CPPFLAGS) -DFIRMWARE_PATH="$(FIRMWARE_PATH)"
 dist_udevrules_DATA += extras/firmware/50-firmware.rules
 libexec_PROGRAMS = extras/firmware/firmware
 
configure.ac +21 -0
index 492fa02..cce70d1 100644
@@ -82,6 +82,26 @@ if test "x$enable_extras" = xyes; then
 		fi])
 	AC_SUBST(PCI_DATABASE)
 
+	AC_ARG_WITH(firmware-path,
+		AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
+		   [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]),
+		[],
+		[with_firmware_path="/lib/fimware/updates:/lib/fimware"]
+		)
+	OLD_IFS=$IFS
+	IFS=:
+	for i in $with_firmware_path
+	do
+		if test "x${FIRMWARE_PATH}" = "x"
+		then
+			FIRMWARE_PATH="\\\"${i}/\\\""
+		else
+			FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\""
+		fi
+	done
+	IFS=$OLD_IFS
+	AC_SUBST([FIRMWARE_PATH], [$FIRMWARE_PATH])
+
 	AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found]))
 	AC_SUBST([INCLUDE_PREFIX], [$(echo '#include <linux/input.h>' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')])
 fi
@@ -144,6 +164,7 @@ AC_MSG_RESULT([
 
 	usb.ids:		${USB_DATABASE}
 	pci.ids:		${PCI_DATABASE}
+	firmware path:		${FIRMWARE_PATH}
 
 	xsltproc:		${XSLTPROC}
 	gperf:			${GPERF}
extras/firmware/firmware.c +1 -4
index 92f0918..76593ba 100644
@@ -79,10 +79,7 @@ int main(int argc, char **argv)
 		{ "help", no_argument, NULL, 'h' },
 		{}
 	};
-	static const char *searchpath[] = {
-		"/lib/firmware/updates/",
-		"/lib/firmware/"
-	};
+	static const char *searchpath[] = { FIRMWARE_PATH };
 	char fwencpath[UTIL_PATH_SIZE];
 	char misspath[UTIL_PATH_SIZE];
 	char loadpath[UTIL_PATH_SIZE];
Signature · 1 line
1.7.0.5
#9 lore raw
In reply to Yury G. Kudryashov
Quoted 41 lines · Yury G. Kudryashov
Quoted 10 lines · Dan Nicholson
Quoted 8 lines · Yury G. Kudryashov

Hi!

Review the attached patches, please.

From 5cc42c6f87f690fdf66e29de2a816dab49a119f4 Mon Sep 17 00:00:00 2001
From: Yury G. Kudryashov <[email protected]>
Date: Fri, 16 Apr 2010 00:21:02 +0400
Subject: [PATCH 1/2] Include linux/types.h

Quoted 6 lines

1. Prefix the subject with "hid2hci: " so it's clear from the shortlog what
this affects.

2. Please include some rational in the commit message. What prototype or datatype is missing that requires including <linux/types.h>?

Done.

Quoted 7 lines
Quoted 4 lines

From f9881e554deafad1301d00e4539a02fe63078c00 Mon Sep 17 00:00:00 2001
From: Yury G. Kudryashov <[email protected]>
Date: Fri, 16 Apr 2010 09:38:32 +0400
Subject: [PATCH 2/2] Add --with-firmware-path configure option

Again, please include some rational in the commit message. What problem is this solving?

Done.

Quoted 11 lines

extras/firmware/firmware.c int main(int argc, char **argv) · line 101

Quoted 9 lines
extras/firmware/firmware.c +5 -0
@@ -97,6 +94,11 @@ int main(int argc, char **argv)
 unsigned int i;
 int rc = 0;
 
+	for (i = 0; i < ARRAY_SIZE(searchpath); i++) {
+		printf("Path %s\n", searchpath[i]);
+	}
+	return 0;
+

I'm pretty sure the program stops doing anything useful with this hunk. :)

I really should stop posting patches after midnight. I hope that the attached version is better.

Quoted 7 lines

From 6d2d2d4d2c665539c140bbf471c8d1e30baf508b Mon Sep 17 00:00:00 2001
From: Yury G. Kudryashov <[email protected]>
Date: Fri, 16 Apr 2010 00:21:02 +0400
Subject: [PATCH 1/2] hid2hci: include linux/types.h for __u32

__u32 in linux/hiddev.h is undefined on my laptop (linux-headers-2.6.28.5). Probably, this is a bug in kernel headers or in my distro but this would not hurt.

Looks good. I see you resent the other patch.

--
Dan

#10 lore raw
In reply to Yury G. Kudryashov
Quoted 88 lines · Yury G. Kudryashov
Quoted 2 lines · Yury G. Kudryashov

I really should stop posting patches after midnight. I hope that the attached version is better.

I should also stop posting "fixed" versions of patches without re-compiling. First patch is OK, new version of the second patch is attached.

From 499a8e76e856b1cec3f045407eeb52a5c3d85a18 Mon Sep 17 00:00:00 2001
From: Yury G. Kudryashov <[email protected]>
Date: Fri, 16 Apr 2010 09:38:32 +0400
Subject: [PATCH 2/2] Add --with-firmware-path configure option

In NixOS we need to use non-standard firmware path: we have no /lib.

---
 Makefile.am                |    1 +
 configure.ac               |   21 +++++++++++++++++++++
 extras/firmware/firmware.c |    5 +----
 3 files changed, 23 insertions(+), 4 deletions(-)
Makefile.am +1 -0
index 68a68d9..3b628a4 100644
@@ -194,6 +194,7 @@ dist_udevrules_DATA += \
 # ------------------------------------------------------------------------------
 extras_firmware_firmware_SOURCES = extras/firmware/firmware.c
 extras_firmware_firmware_LDADD = libudev/libudev-private.la
+extras_firmware_firmware_CPPFLAGS = $(AM_CPPFLAGS) -DFIRMWARE_PATH="$(FIRMWARE_PATH)"
 dist_udevrules_DATA += extras/firmware/50-firmware.rules
 libexec_PROGRAMS = extras/firmware/firmware
 
configure.ac +21 -0
index 492fa02..cce70d1 100644
@@ -82,6 +82,26 @@ if test "x$enable_extras" = xyes; then
 		fi])
 	AC_SUBST(PCI_DATABASE)
 
+	AC_ARG_WITH(firmware-path,
+		AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
+		   [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]),
+		[],
+		[with_firmware_path="/lib/fimware/updates:/lib/fimware"]
+		)
+	OLD_IFS=$IFS
+	IFS=:
+	for i in $with_firmware_path
+	do
+		if test "x${FIRMWARE_PATH}" = "x"
+		then
+			FIRMWARE_PATH="\\\"${i}/\\\""
+		else
+			FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\""
+		fi
+	done
+	IFS=$OLD_IFS
+	AC_SUBST([FIRMWARE_PATH], [$FIRMWARE_PATH])
+
 	AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found]))
 	AC_SUBST([INCLUDE_PREFIX], [$(echo '#include <linux/input.h>' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')])
 fi
@@ -144,6 +164,7 @@ AC_MSG_RESULT([
 
 	usb.ids:		${USB_DATABASE}
 	pci.ids:		${PCI_DATABASE}
+	firmware path:		${FIRMWARE_PATH}
 
 	xsltproc:		${XSLTPROC}
 	gperf:			${GPERF}
extras/firmware/firmware.c +1 -4
index 92f0918..76593ba 100644
@@ -79,10 +79,7 @@ int main(int argc, char **argv)
 		{ "help", no_argument, NULL, 'h' },
 		{}
 	};
-	static const char *searchpath[] = {
-		"/lib/firmware/updates/",
-		"/lib/firmware/"
-	};
+	static const char *searchpath[] = { FIRMWARE_PATH };
 	char fwencpath[UTIL_PATH_SIZE];
 	char misspath[UTIL_PATH_SIZE];
 	char loadpath[UTIL_PATH_SIZE];
Signature · 1 line
1.7.0.5

Looks good on inspection, although I didn't test it.

--
Dan