linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* USB/VMWare question
@ 2004-11-16  4:40 Lindsay Haisley
  2004-11-19 16:44 ` Lindsay Haisley
  0 siblings, 1 reply; 2+ messages in thread
From: Lindsay Haisley @ 2004-11-16  4:40 UTC (permalink / raw)
  To: linux-hotplug

This may be a VMware issue, and may be something that can be corrected by
configuration, or it may be an issue that needs addressing in Linux
hotplugging.  It's an issue that could cause a lot more trouble than it's
causing me, for instance if a USB printer were involved rather than simply a
USB storage device.

I'm using Gentoo Linux w. kernel-2.6.9, udev 043, plus VMware workstation
4.5.2 build-8488.  I have VMware configured to automatically connect new USB
devices to the virtual machine when it has the focus.

If the usb-storage module is _not_ installed and I connect a USB storage
device to the system, the VMware guest OS (Windows 98SE) correctly detects
and mounts the device; however, the host OS simultaneously installs the
usb-storage kernel module.  This doesn't appear to interfere with normal
operation in the guest OS, which can access the USB storage device normally. 
If the USB storage device is unplugged and then re-plugged, however, the
presence of this module in the kernel causes VMware to complain that the
device is already in use in the host OS and can't be used in the guest
system, and the device doesn't work.

I can get around this each time by unplugging the USB storage device,
rmmod'ing usb-storage in the host OS, giving the guest OS focus again, and
then re-inserting the storage device.  This is an obvious PITA.  Is there
some way to provide conditional module insertion to the hotplugging system? 
I need to be able to use the USB drive in both Linux and the guest Windows
OS, so the usb-storage module is necessary.  I would just like some way for
the host OS to know that VMware is running and not insert the usb-storage
module in this case.

-- 
Lindsay Haisley       | "Fighting against human |     PGP public key
FMP Computer Services |    creativity is like   |      available at
512-259-1190          |    trying to eradicate  | <http://pubkeys.fmp.com>
http://www.fmp.com    |        dandelions"      |
                      |      (Pamela Jones)     |


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: USB/VMWare question
  2004-11-16  4:40 USB/VMWare question Lindsay Haisley
@ 2004-11-19 16:44 ` Lindsay Haisley
  0 siblings, 0 replies; 2+ messages in thread
From: Lindsay Haisley @ 2004-11-19 16:44 UTC (permalink / raw)
  To: linux-hotplug

Thus spake Richard Troth on Tue, Nov 16, 2004 at 10:43:24AM CST
> I get similar pain with SuSE 9.1 (2.6.4 kernel).
> If you happen to hear of a fix,  and it doesn't get posted,
> please let me know!

Here's my fix.  I'll post it to the hotplug-devel list, too.

I make no recommendation that this patch be included in, or even considered
for future hotplug releases.  It's a specific fix for a specific problem
involving a piece of commercial software (VMware).  Because the developoment
of hotplug and udev is very active, and it looks as if hotplug functionality
may be folded into udev at some point, this fix may have a rather limited
lifespan, however the principle will probably be applicable as long as
module loading is implemented in user space.

This fix is specifically for VMware Workstation.  Other solutions may be
available for VMware server products which come with API tools for
communication between guest and host OSes.  It relies on the simple fact
that the vmmon kernel module is only in use when an instance of VMware
Workstation is running, and lsmod shows a usage count greater than 0. The
patch causes the load_modules function to grep the file
/etc/hotplug/vmblacklist (you have to create this) and if a module listed
therein is requested as the result of a hotplug event, it examines the usage
count on the loaded vmmon module. If no vmmon module is loaded, or if it's
usage count is 0, then the vmblacklisted module is loaded. If the vmmon
module exists and has a usage count greater than 0 then the blacklisted
module is not loaded. This is a patch against
/etc/hotplug/hotplug.functions.

Be sure to use dashes instead of underscores on module names in vmblacklist,
e.g. "usb-storage". The hotplug script expects them.

--- hotplug.functions.orig	2004-11-18 16:55:32.423375746 -0600
+++ hotplug.functions	2004-11-18 17:41:06.757171240 -0600
@@ -134,6 +134,11 @@
 		debug_mesg "... blacklisted module:  $MODULE"
 		continue
 	    fi
+	    if grep -q "^$(echo $MODULE|sed -e 's/[-_]/[-_]/g')\$" $HOTPLUG_DIR/vmblacklist; then
+		if [ "$(lsmod|grep vmmon|awk -F" " '{print $1}')" = "vmmon" -a $(lsmod|grep vmmon|awk -F" " '{print $3}') != "0" ];then
+   		   continue
+		fi
+	    fi
 
 	    # statically linked modules aren't shown by 'lsmod',
 	    # and user mode drivers will ONLY have a setup script;


-- 
Lindsay Haisley       | "Fighting against human |     PGP public key
FMP Computer Services |    creativity is like   |      available at
512-259-1190          |    trying to eradicate  | <http://pubkeys.fmp.com>
http://www.fmp.com    |        dandelions"      |
                      |      (Pamela Jones)     |


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-11-19 16:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-16  4:40 USB/VMWare question Lindsay Haisley
2004-11-19 16:44 ` Lindsay Haisley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).