The USB Wireless Security Lock is an interesting piece of hardware, a little green button that you carry on your person, which allows your computer to lock itself when you walk away from it. It consists of the key fob, and a receiver that plugs in via usb. There are no drivers to install, as the device is seen as a simple USB Human Interface Device. The OEM software is nearly useless, but there’s a homemade replacement, called UsbWiSec – here’s the HOW TO…HOW TO by-
The OEM software is nearly useless, but I was able to write my own replacement, called UsbWiSec. This replacement software is available on SourceForge, and there is an MSDN article written by Scott Hanselman that describes its architecture.
The hardware is essentially a re-purposed cheap wireless mouse. If you want more information on the technical details of the hardware, you can read the MSDN article and my original article describing my journey in figuring out what makes it tick.
One of the goals of UsbWiSec is to be as easily extensible as possible. When I released my initial proof of concept, I was deluged by requests for various features. My next release included a plugin system. When Scott ported the code to .NET 2.0 for the MSDN article, he beefed up the plugin system, and wrote several new plugins.
The locking mechanism itself is simply a plugin, which you could disable if you were not interested in security, and for example just want your music to be paused when you step away from the workstation.
By far, the best plugin (from an extensibility point of view) is the Batch File plugin. It simply executes locked.bat when the station should lock, and unlocked.bat when it should unlock. You can craft any script you desire. In fact, if .NET isn’t your language platform of choice, you can write a plugin in any language you want, and compile it into an executable, and call it from the batch files.
The batch files that are executed for lock and unlock events.
The preferred method of extending the app is writing a plugin. The major advantage to this approach is you can provide an integrated configuration screen. You also have access to the raw messages sent by the KeyFob, and the PresenceNotification events – in addition to being informed of lock and unlock events.
The main interface to UsbWiSec, you can see the plugins listed.
How to create a plugin for UsbWiSec
You will need:
* Visual Studio 2005 Beta 2
* UsbWiSec 2.0.1 installed
First, start a new project in Visual Studio 2005
Add a reference to the UsbWirelessSecurity.Core.dll to your project
Create a new class, and name it accordingly for what your plugin does.
You will then:
* Add a using statement for the UsbWirelessSecurity namespace.
* Make your class sub-class PresencePluginBase
* Add an attribute that defines the name of the plugin, and an optional configurator type (which also means you would need to create a configurator, which is just a WinForm):
o [PresencePluginConfigurator(“My Plugin”, typeof(MyPluginConfigurator))]
* Override any of the following methods:
o HandleMessage(KeyFobMessage m)
o HandlePresenceNotification(PresenceNotificationEventArgs e)
o InitializePlugin(string pluginDirectory)
A barebones plugin looks like this:
[PresencePluginConfigurator( “Sample Plugin”)]
public class MyPlugin : PresencePluginBase
public override void WorkstationLocked()
//do cool stuff here
public override void WorkstationUnlocked()
//do more cool stuff here
Then compile your plugin, copy the .dll to the program directory for the UsbWiSec app, and restart the UsbWiSec app. Your plugin will then appear in the app!
For examples of more complex plugins, and how to create a plugin configurator, you can download the source code from SourceForge and examine it for yourself. When you have completed your plugin, let one of us know and we might include it into the core plugin set.