Skip to contentSkip to conversation

[5344] Implement a HCI passthrough to host.

Qemu-devel Andrzej Zaborowski 3 participants 9 messages Sep 28, 2008 – Sep 30, 2008 Kbuild

lore
Share & tools
lore
#0 lore raw

Revision: 5344

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5344
Author:   balrog
Date:     2008-09-28 23:49:55 +0000 (Sun, 28 Sep 2008)

Log Message:
-----------
Implement a HCI passthrough to host.

This allows using a host's physical HCI as one of the HCIs attached to the virtual machine. This brings various limitations because not all commands/events are passed through by Linux kernel, some are interpreted by the host's kernel for a speed gain.

Modified Paths:
--------------
trunk/Makefile
trunk/Makefile.target
trunk/configure

Added Paths:
-----------
trunk/bt-host.c

Modified: trunk/Makefile
===================================================================

Makefile +4 -1
@@ -81,7 +81,7 @@
 OBJS+=usb.o usb-hub.o usb-linux.o usb-hid.o usb-msd.o usb-wacom.o
 OBJS+=usb-serial.o usb-net.o
 OBJS+=sd.o ssi-sd.o
-OBJS+=bt.o
+OBJS+=bt.o bt-host.o
 
 ifdef CONFIG_BRLAPI
 OBJS+= baum.o
@@ -166,6 +166,9 @@
 curses.o: curses.c keymaps.c curses_keys.h
 	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
+bt-host.o: bt-host.c
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(CONFIG_BLUEZ_CFLAGS) -c -o $@ $<
+
 audio/sdlaudio.o: audio/sdlaudio.c
 	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $<
 

Modified: trunk/Makefile.target
===================================================================

Makefile.target +4 -0
@@ -524,6 +524,10 @@
 LIBS += $(CONFIG_VNC_TLS_LIBS)
 endif
 
+ifdef CONFIG_BLUEZ
+LIBS += $(CONFIG_BLUEZ_LIBS)
+endif
+
 # SCSI layer
 OBJS+= lsi53c895a.o esp.o
 

Added: trunk/bt-host.c
===================================================================

bt-host.c +198 -0

198 lines not on this page · raw message

Modified: trunk/configure
===================================================================

configure +20 -0
@@ -110,6 +110,7 @@
 aio="yes"
 nptl="yes"
 mixemu="no"
+bluez="yes"
 signalfd="no"
 eventfd="no"
 
@@ -293,6 +294,8 @@
   ;;
   --disable-brlapi) brlapi="no"
   ;;
+  --disable-bluez) bluez="no"
+  ;;
   --enable-profiler) profiler="yes"
   ;;
   --enable-cocoa)
@@ -429,6 +432,7 @@
 echo "  --disable-brlapi         disable BrlAPI"
 echo "  --disable-vnc-tls        disable TLS encryption for VNC server"
 echo "  --disable-curses         disable curses output"
+echo "  --disable-bluez          disable bluez stack connectivity"
 echo "  --disable-nptl           disable usermode NPTL support"
 echo "  --enable-system          enable all system emulation targets"
 echo "  --disable-system         disable all system emulation targets"
@@ -891,6 +895,16 @@
 fi # test "$curses"
 
 ##########################################
+# bluez support probe
+if test "$bluez" = "yes" ; then
+  `pkg-config bluez` || bluez="no"
+fi
+if test "$bluez" = "yes" ; then
+  bluez_cflags=`pkg-config --cflags bluez`
+  bluez_libs=`pkg-config --libs bluez`
+fi
+
+##########################################
 # AIO probe
 if test "$aio" = "yes" ; then
   aio=no
@@ -1254,6 +1268,12 @@
   echo "#define CONFIG_BRLAPI 1" >> $config_h
   echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
 fi
+if test "$bluez" = "yes" ; then
+  echo "CONFIG_BLUEZ=yes" >> $config_mak
+  echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
+  echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
+  echo "#define CONFIG_BLUEZ 1" >> $config_h
+fi
 if test "$aio" = "yes" ; then
   echo "#define CONFIG_AIO 1" >> $config_h
   echo "CONFIG_AIO=yes" >> $config_mak
#2 lore raw
Quoted 10 lines · Blue Swirl
Quoted 6 lines · Andrzej Zaborowski

Revision: 5344

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5344

Author: balrog
Date: 2008-09-28 23:49:55 +0000 (Sun, 28 Sep 2008)

Quoted 8 lines
Quoted 5 lines

+# bluez support probe
+if test "$bluez" = "yes" ; then
+ pkg-config bluez || bluez="no"
+fi

I think probing should be done more like curses or AIO probes.

Mainly because this breaks cross-compilation. See VNC TLS detection for how to detect something with pkg-config without breaking cross compilation.

Regards,

Anthony Liguori

#3 lore raw
In reply to Andrzej Zaborowski
Quoted 5 lines · Andrzej Zaborowski

Revision: 5344

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5344
Author:   balrog
Date:     2008-09-28 23:49:55 +0000 (Sun, 28 Sep 2008)
Quoted 9 lines

Log Message:
-----------
Implement a HCI passthrough to host.

This allows using a host's physical HCI as one of the HCIs attached to the virtual machine. This brings various limitations because not all commands/events are passed through by Linux kernel, some are interpreted by the host's kernel for a speed gain.

This broke the Windows build. The whole file should probably be build conditionally on CONFIG_BLUEZ.

Regards,

Anthony Liguori

#4 lore raw

2008/9/29 Anthony Liguori <[email protected]>:

Quoted 11 lines
Quoted 10 lines · Andrzej Zaborowski

Revision: 5344

         http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5344
Author:   balrog
Date:     2008-09-28 23:49:55 +0000 (Sun, 28 Sep 2008)

Log Message:
-----------
Implement a HCI passthrough to host.

Quoted 8 lines
Quoted 5 lines

This allows using a host's physical HCI as one of the HCIs attached to the virtual machine. This brings various limitations because not all commands/events are passed through by Linux kernel, some are interpreted by the host's kernel for a speed gain.

This broke the Windows build. The whole file should probably be build conditionally on CONFIG_BLUEZ.

Is that because of uio.h? writev() seems to be posix. Does win32 have it under a different name?

Added a stronger check for bluez, hopefully will cross-compile better now.

Cheers

#5 lore raw
Quoted 19 lines · andrzej zaborowski

2008/9/29 Anthony Liguori <[email protected]>:

Quoted 17 lines
Quoted 15 lines · Andrzej Zaborowski

Revision: 5344

         http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5344
Author:   balrog
Date:     2008-09-28 23:49:55 +0000 (Sun, 28 Sep 2008)

Log Message:
-----------
Implement a HCI passthrough to host.

This allows using a host's physical HCI as one of the HCIs attached to the virtual machine. This brings various limitations because not all commands/events are passed through by Linux kernel, some are interpreted by the host's kernel for a speed gain.

Quoted 7 lines
Quoted 3 lines

This broke the Windows build. The whole file should probably be build conditionally on CONFIG_BLUEZ.

Is that because of uio.h? writev() seems to be posix. Does win32 have it under a different name?

Yeah, there is no uio in win32. win32 isn't posix fwiw so a lot is missing.

Quoted 2 lines

Added a stronger check for bluez, hopefully will cross-compile better now.

I think the best solution is to not compile in the entire file if CONFIG_BLUEZ isn't set. Then we don't have to worry about dealing with things like uio.

Regards,

Anthony Liguori

Quoted 4 lines

Cheers

#6 lore raw
In reply to andrzej zaborowski
Quoted 19 lines · andrzej zaborowski

2008/9/29 Anthony Liguori <[email protected]>:

Quoted 17 lines
Quoted 15 lines · Andrzej Zaborowski

Revision: 5344

         http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5344
Author:   balrog
Date:     2008-09-28 23:49:55 +0000 (Sun, 28 Sep 2008)

Log Message:
-----------
Implement a HCI passthrough to host.

This allows using a host's physical HCI as one of the HCIs attached to the virtual machine. This brings various limitations because not all commands/events are passed through by Linux kernel, some are interpreted by the host's kernel for a speed gain.

Quoted 8 lines
Quoted 2 lines

This broke the Windows build. The whole file should probably be build conditionally on CONFIG_BLUEZ.

Is that because of uio.h? writev() seems to be posix. Does win32
have it under a different name?

Added a stronger check for bluez, hopefully will cross-compile better now.

You are still relying that the host pkg-config exists and gives information that is valid for cross-compiling.

#7 lore raw

2008/9/30 Blue Swirl <[email protected]>:

Quoted 24 lines · andrzej zaborowski
Quoted 23 lines

2008/9/29 Anthony Liguori <[email protected]>:

Quoted 19 lines
Quoted 6 lines · Andrzej Zaborowski

Revision: 5344

         http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5344
Author:   balrog
Date:     2008-09-28 23:49:55 +0000 (Sun, 28 Sep 2008)
Quoted 9 lines

Log Message:
-----------
Implement a HCI passthrough to host.

This allows using a host's physical HCI as one of the HCIs attached to the virtual machine. This brings various limitations because not all commands/events are passed through by Linux kernel, some are interpreted by the host's kernel for a speed gain.

This broke the Windows build. The whole file should probably be build conditionally on CONFIG_BLUEZ.

Quoted 7 lines
Quoted 4 lines

Is that because of uio.h? writev() seems to be posix. Does win32
have it under a different name?

Added a stronger check for bluez, hopefully will cross-compile better now.

You are still relying that the host pkg-config exists and gives information that is valid for cross-compiling.

Not really -- the information will be (likely) wrong for cross-compiling and configure will disable bluez, which is what we want -- unless the user sets PKG_CONFIG_PATH correctly.

Cheers

#8 lore raw
In reply to Blue Swirl
Quoted 27 lines · Blue Swirl
Quoted 25 lines · andrzej zaborowski

2008/9/29 Anthony Liguori <[email protected]>:

Quoted 20 lines
Quoted 6 lines · Andrzej Zaborowski

Revision: 5344

         http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5344
Author:   balrog
Date:     2008-09-28 23:49:55 +0000 (Sun, 28 Sep 2008)
Quoted 9 lines

Log Message:
-----------
Implement a HCI passthrough to host.

This allows using a host's physical HCI as one of the HCIs attached to the virtual machine. This brings various limitations because not all commands/events are passed through by Linux kernel, some are interpreted by the host's kernel for a speed gain.

This broke the Windows build. The whole file should probably be build conditionally on CONFIG_BLUEZ.

Quoted 9 lines
Quoted 5 lines

Is that because of uio.h? writev() seems to be posix. Does win32
have it under a different name?

Added a stronger check for bluez, hopefully will cross-compile better now.

You are still relying that the host pkg-config exists and gives information that is valid for cross-compiling.

When cross compiling, you should set you PKG_CONFIG_PATH variable so that the appropriate set of pkg-config configs are found.

Regards,

Anthony Liguori