r1864 - trunk/src/host/qemu-neo1973

andrew at sita.openmoko.org andrew at sita.openmoko.org
Sun Apr 29 00:14:48 CEST 2007


Author: andrew
Date: 2007-04-29 00:14:47 +0200 (Sun, 29 Apr 2007)
New Revision: 1864

Modified:
   trunk/src/host/qemu-neo1973/configure
   trunk/src/host/qemu-neo1973/usb-linux-gadget.c
Log:
Detect <linux/usb_gadgetfs.h> in configure.  It's not present in too many
distros to make it a hard dependency.


Modified: trunk/src/host/qemu-neo1973/configure
===================================================================
--- trunk/src/host/qemu-neo1973/configure	2007-04-27 20:22:22 UTC (rev 1863)
+++ trunk/src/host/qemu-neo1973/configure	2007-04-28 22:14:47 UTC (rev 1864)
@@ -96,6 +96,7 @@
 softmmu="yes"
 user="no"
 build_docs="no"
+gadgetfs="no"
 uname_release=""
 
 # OS specific
@@ -557,6 +558,18 @@
 bindir="$prefix/bin"
 fi
 
+##########################################
+# usb_gadgetfs headers
+
+cat > $TMPC << EOF
+#include <linux/usb_ch9.h>
+#include <linux/usb_gadgetfs.h>
+int main(void) { return 0; }
+EOF
+if $cc -o $TMPE $TMPC 2> /dev/null ; then
+  gadgetfs="yes"
+fi
+
 echo "Install prefix    $prefix"
 echo "BIOS directory    $datadir"
 echo "binary directory  $bindir"
@@ -766,6 +779,11 @@
 
 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
 
+if test "$gadgetfs" = "yes" ; then
+  echo "CONFIG_GADGETFS=yes" >> $config_mak
+  echo "#define CONFIG_GADGETFS 1" >> $config_h
+fi
+
 for target in $target_list; do
 target_dir="$target"
 config_mak=$target_dir/config.mak

Modified: trunk/src/host/qemu-neo1973/usb-linux-gadget.c
===================================================================
--- trunk/src/host/qemu-neo1973/usb-linux-gadget.c	2007-04-27 20:22:22 UTC (rev 1863)
+++ trunk/src/host/qemu-neo1973/usb-linux-gadget.c	2007-04-28 22:14:47 UTC (rev 1864)
@@ -19,7 +19,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  * MA 02111-1307 USA
  */
-#if defined(__linux__)
+#include "config-host.h"
+#if defined(CONFIG_GADGETFS)
 #include <linux/usb_ch9.h>
 #include <linux/usb_gadgetfs.h>
 #include <poll.h>
@@ -711,12 +712,13 @@
         return ret;
     atexit(gadget_done);
 
-    qemu_register_usb_port(&hci->port, hci, 0, gadget_attach);
+    qemu_register_usb_port(&hci->port, hci, USB_INDEX_HOST, gadget_attach);
 
     return ret;
 }
 
 #else
+#include "vl.h"
 
 int usb_gadget_init(void)
 {





More information about the commitlog mailing list