Jump to content

- - - - -

[download] Driver: USB-UIRT

  • Please log in to reply
4 replies to this topic

#1 123



  • Registered
  • PipPipPipPip
  • 2086 posts
  • Location:Montreal, QC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1

Posted 04 February 2009 - 04:03 PM

Posted Image

File Name: Driver: USB-UIRT
File Submitter: 123
File Submitted: 4 Feb 2009
File Updated: 23 Feb 2009
File Category: Premise
Author: 123
Contact: PM me
Version: 0.6

The following driver (spUSBUIRT.dll) enables Premise Home Control to send and receive IR codes via a USB-UIRT device.

Version (V0.6) provides the following functions:
  • Send an IR code, in Pronto format, via any one of the USB-UIRT's three zones (Left, Right, Center) or via all zones concurrently.
  • Receive IR codes, in UIR format, via the "Center" zone (represents the IR receiver on the front of the device).
  • Learn IR codes, in Pronto format, via the "Center" zone.
  • Support multiple USB-UIRT devices.
  • Send an IR code continuously ("ContinuousSend").
  • Locks command modes (i.e. cannot request Learn mode while performing ContinuousSend).
Source code (C++) is also available (PM me) to anyone who wishes to see how it was constructed or to enhance it. You will need Visual Studio 2005 (not the Express version) and the Premise HSDK in order to compile the source.

Installation Notes
Before installing the Premise USB-UIRT driver, ensure the USB-UIRT's Windows driver is installed correctly (see the manufacturer's instructions).

Install the Premise USB-UIRT driver as follows:
  • Extract the DLL file from the attached zip archive.
  • Copy spUSBUIRT.dll to C:\Program Files\Premise\SYS\bin\devices
  • In Premise Builder, select File > AddIns.
  • Checkmark the USBUIRT selection and click OK.
  • In the Shortcut Bar, click Devices.
  • Right-click USBUIRT and select New > UUIRT

If you plan to use multiple USB-UIRT's, you must assign each device a unique name using the "uurename" utility from the manufacturer. A USB-UIRT's default name is "USB-UIRT". Here's how to rename it to "USB-UIRT-2":
  • Plug in the USB-UIRT you wish to rename. Ensure all others USB-UIRT devices are disconnected.
  • Stop any applications using the USB-UIRT.
  • Run "uurename" from a command shell.
  • When prompted to rename the device, choose 'Y'es
  • Enter the number '2'.
  • Disconnect then reconnect the device to initialize the new name.

Please post questions and bug reports in the discussion thread associated with this Download post.

Click here to download this file

Edited by 123, 23 February 2009 - 01:18 PM.

#2 flobik



  • Registered
  • Pip
  • 7 posts
  • Location:Russia Ekaterinburg

Posted 17 February 2009 - 01:02 PM

thx !
Please, send to me Source code )

#3 123



  • Registered
  • PipPipPipPip
  • 2086 posts
  • Location:Montreal, QC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1

Posted 17 February 2009 - 02:12 PM


I'm very close to completing the multi-device version of the driver (potentially with support for ContinuousSend). I'll send you the latest version when it is finished (end of the week). Send me a PM, containing your email address, and I'll send you the zipped Visual Studio project when it is ready. If you simply want to inspect the code, I can send you the main ".cpp" file instead of the entire VS project. Let me know what you need.

To compile the source code, you'll need Visual Studio 2005 (C++) and the Premise HDSK.

#4 123



  • Registered
  • PipPipPipPip
  • 2086 posts
  • Location:Montreal, QC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1

Posted 21 February 2009 - 11:31 AM

Will wonders never cease ...
  • Version 0.6 of the USB-UIRT driver passed all tests on my development PC. :)
  • It failed to display debugging messages on my test PC. :P
  • It won't load on a Tablet PC . :)

FWIW, version 0.5 also refuses to load on a Tablet PC. Premise generates an alert indicating the "Driver cannot be registered". Thinking it was due to a duplicated GUID somewhere, I reset Premise server to a clean slate and tried again. No luck. I will try to run the "Hello World" driver on the Tablet PC to determine if this is a problem with all home-brew drivers or limited to my USB-UIRT driver. Either way, I have no plans to chase this bug down, so the driver is officially incompatible with Win XP Tablet Edition. Sorry.

As for the AWOL debugging messages, well, V0.6 uses a function called "Systrace" I found in one of the SDK's header files. Essentially, it's a wrapper function for OutputDebugStringW so it *should* work as well as in V0.5 (... not!). Kind of ironic because I added extensive debugging messages to help track down potential problems ... yet it is the debugging mechanism that has failed. :huh:

Version 0.6 offers more functionality than V0.5 yet is substantially smaller (64K versus 80K). For future driver writers, the key space saver was to avoid inheriting from the CPremiseBufferedPortDevice class. This driver does not communicate via a serial or network port (it talks via functions in a manufacturer-supplied DLL) therefore it has no need for the extensive port and data handling functionality provided by CPremiseBufferedPortDevice. I've only scraped the surface of this class but it appears to provide everything you'd possibly need including:
  • Reports the serial/network port's current state.
  • Automatically resets the port if the driver becomes unresponsive.
  • Buffers data transmission and reception.
  • Data buffer handling (purge, retransmit, etc)
  • Acknowledgement Timer; informs you if a transmitted command has not been acknowledged by the device within a specified time frame.
  • Heartbeat Timer; can be used to periodically poll the device(s).
The only thing I needed was a parent class called CPremiseSubscriber that allows my driver to subscribe to property changes (i.e. informed of state changes to Send, Learn, ContinuousSend).

The guys who designed this architecture really knew their stuff!

My mistake; the debug messages aren't displayed on my development PC either. What I had tested on the two PCs wasn't the same version so I had different results. I now realize that I'm not using Systrace correctly. Another example of RTFM! Should be a quick fix ...

Edited by 123, 23 February 2009 - 10:27 AM.

#5 123



  • Registered
  • PipPipPipPip
  • 2086 posts
  • Location:Montreal, QC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1

Posted 23 February 2009 - 02:03 PM

Version 0.6 of the Premise USB-UIRT driver is now available.

New Features
  • Supports multiple USB-UIRT devices.
  • Can transmit an IR code continuously (ContinuousSend mode).
  • Locks out conflicting command modes (i.e. prevents entering Learn mode if the device is in ContinuousSend mode).
Handy things to know
  • Unsupported Properties
    The AutoClip and EnableLogging properties have been removed from the driver's UI because I have no plans to support them.
  • Use V0.6
    If you are using V0.5, I recommend you uninstall it and use V0.6. Even if you don't need V0.6's added features, it employs far more error-checking than V0.5. Uninstall V0.5, restart the Premise service (prkernel.exe) and then install V0.6. If you don't restart the Premise service it may have a lock on the old "spUSBUIRT.dll" file and prevent you from overwriting it.
  • Don't copy-paste driver instances
    To create new driver instances, right-click USBUIRT and select "New > UUIRT". This is the usual way its done with all drivers. Do not copy and paste an existing driver instance! It will create a "zombie" ... a non-functional driver instance that only appears to be OK. I haven't figured out how to programmatically prevent an end-user from copy-pasting an existing driver instance ... so just don't do it.
  • Ensure USB-UIRT device is connected
    When you create a new driver instance, the USB-UIRT device must be physically connected to the PC and its Windows driver must be installed. If not, the driver instance will show it failed to connect and that's the end of that. The driver instance will not attempt to connect to the device if you plug it in later.
  • USB-UIRT device will be monitored
    The driver will query a properly installed USB-UIRT device every 30 seconds. If there is no response, it will disable the "Connect" property and try to reestablish the connection with the device every 30 seconds thereafter.
  • Debug to see more
    If you enable the driver's Debug property, it will display informative messages about its operating state in the Windows Debug Console (you need DebugView to see them). Enable it if you suspect the driver is misbehaving or if you're curious about what it's doing. The Premise driver's debugging messages always begin with "[USB-UIRT]". The USB-UIRT's Windows driver also generates debugging messages (always visible).

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users