Thursday, May 6, 2010

Stand Alone Executable in Visual Studio

Another of those not so obvious thing about working with Visual Studio. Here are the list of things that one should try in order to get (hopefully) a standalone executable image (standard window's library dependence is OK).
  • Configuration Properties | General : If not using MFC classes then the option saying Use of MFC should be "Use Standard Windows Libraries". If using MFC then select "Use MFC in a Static Library" for the same option.
  • C/C++ | Code Generation : Runtime Library option should be Multi-threaded (/MT) or Multi-threaded Debug (/MTd) instead of Multi-threaded DLL (/MD) or Multi-threaded Debug DLL (/MDd)
  • Linker | Manifest File : Play with Enable User Account Control (UAC) to see if that helps

Tuesday, May 4, 2010

Elusive HID Mouse Format

The problem is that I don't understand (yet) how Windows & Linux seem to understand the 4-byte Wheel format for HID Mouse that is declared as a Boot (Interface) Mouse (see Device Class Definition for HID Version 1.11 @ usb.org). Boot Interface subclass defines descriptors for Keyboard and Mouse boot devices. The packet format for Mouse data is similar to the PS/2 format except that the Sign & Overflow bits are not used in the first byte and the X-Y range is -128 to +127 (instead of -256 to +255 supported by PS/2).

Maybe the fact that devices are allowed to append additional data to boot reports (for keyboard and mouse) must be the key here. So even though the BIOS may ignore anything beyond the first 3 bytes of a mouse report, the HID driver under Windows or Linux understands the additional data (such as Wheel). However, this is still interesting because as per  Microsoft documentation the Mouse data formats (for PS/2 and USB) require the PS/2 format (see the document here). This implies that the Boot Mouse HID drivers are intelligent to understand the extended packet format that contains the Wheel data in a Boot Mouse report. So the question is what else does this driver support? I haven't found any information on the implementation of generic HID driver for mouse that would explain the behavior.