1.1 --- a/HidDevice.cs	Sun Feb 15 22:13:33 2015 +0100
     1.2 +++ b/HidDevice.cs	Sun Feb 15 22:57:38 2015 +0100
     1.3 @@ -47,9 +47,6 @@
     1.4          public HIDP_VALUE_CAPS[] InputValueCapabilities { get { return iInputValueCapabilities; } }
     1.5          private HIDP_VALUE_CAPS[] iInputValueCapabilities;
     1.6  
     1.7 -        
     1.8 -        
     1.9 -
    1.10          /// <summary>
    1.11          /// Class constructor will fetch this object properties from HID sub system.
    1.12          /// </summary>
    1.13 @@ -265,6 +262,30 @@
    1.14          }
    1.15  
    1.16          /// <summary>
    1.17 +        /// 
    1.18 +        /// </summary>
    1.19 +        /// <param name="aCaps"></param>
    1.20 +        /// <returns></returns>
    1.21 +        public string InputValueCapabilityDescription(HIDP_VALUE_CAPS aCaps)
    1.22 +        {
    1.23 +            if (!aCaps.IsRange && Enum.IsDefined(typeof(UsagePage), Capabilities.UsagePage))
    1.24 +            {
    1.25 +                return "Input Value: " + Enum.GetName(Utils.UsageType((UsagePage)Capabilities.UsagePage), aCaps.NotRange.Usage);
    1.26 +            }
    1.27 +
    1.28 +            return null;
    1.29 +        }
    1.30 +
    1.31 +        public bool IsGamePad
    1.32 +        {
    1.33 +            get
    1.34 +            {
    1.35 +                return ((UsagePage)iCapabilities.UsagePage == UsagePage.GenericDesktopControls && (UsageCollectionGenericDesktop)iCapabilities.Usage == UsageCollectionGenericDesktop.GamePad);
    1.36 +            }
    1.37 +        }
    1.38 +
    1.39 +
    1.40 +        /// <summary>
    1.41          /// Print information about this device to our debug output.
    1.42          /// </summary>
    1.43          public void DebugWrite()
     2.1 --- a/HidUtils.cs	Sun Feb 15 22:13:33 2015 +0100
     2.2 +++ b/HidUtils.cs	Sun Feb 15 22:57:38 2015 +0100
     2.3 @@ -28,5 +28,38 @@
     2.4                      return null;
     2.5              }
     2.6          }
     2.7 +
     2.8 +        /// <summary>
     2.9 +        /// Provide the type for the usage corresponding to the given usage page.
    2.10 +        /// </summary>
    2.11 +        /// <param name="aUsagePage"></param>
    2.12 +        /// <returns></returns>
    2.13 +        public static Type UsageType(UsagePage aUsagePage)
    2.14 +        {
    2.15 +            switch (aUsagePage)
    2.16 +            {
    2.17 +                case UsagePage.GenericDesktopControls:
    2.18 +                    return typeof(UsageTables.GenericDesktop);
    2.19 +
    2.20 +                case UsagePage.Consumer:
    2.21 +                    return typeof(UsageTables.ConsumerControl);
    2.22 +
    2.23 +                case UsagePage.WindowsMediaCenterRemoteControl:
    2.24 +                    return typeof(UsageTables.WindowsMediaCenterRemoteControl);
    2.25 +
    2.26 +                case UsagePage.Telephony:
    2.27 +                    return typeof(UsageTables.TelephonyDevice);
    2.28 +
    2.29 +                case UsagePage.SimulationControls:
    2.30 +                    return typeof(UsageTables.SimulationControl);
    2.31 +
    2.32 +                case UsagePage.GameControls:
    2.33 +                    return typeof(UsageTables.GameControl);
    2.34 +
    2.35 +                default:
    2.36 +                    return null;
    2.37 +            }
    2.38 +        }
    2.39 +
    2.40      }
    2.41  }
     3.1 --- a/MainForm.Designer.cs	Sun Feb 15 22:13:33 2015 +0100
     3.2 +++ b/MainForm.Designer.cs	Sun Feb 15 22:57:38 2015 +0100
     3.3 @@ -27,6 +27,8 @@
     3.4              this.columnHeaderTime = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
     3.5              this.tabPageDevices = new System.Windows.Forms.TabPage();
     3.6              this.treeViewDevices = new System.Windows.Forms.TreeView();
     3.7 +            this.buttonTreeViewCollapseAll = new System.Windows.Forms.Button();
     3.8 +            this.buttonTreeViewExpandAll = new System.Windows.Forms.Button();
     3.9              this.tabControl.SuspendLayout();
    3.10              this.tabPageMessages.SuspendLayout();
    3.11              this.tabPageDevices.SuspendLayout();
    3.12 @@ -139,11 +141,13 @@
    3.13              // 
    3.14              // tabPageDevices
    3.15              // 
    3.16 +            this.tabPageDevices.Controls.Add(this.buttonTreeViewExpandAll);
    3.17 +            this.tabPageDevices.Controls.Add(this.buttonTreeViewCollapseAll);
    3.18              this.tabPageDevices.Controls.Add(this.treeViewDevices);
    3.19              this.tabPageDevices.Location = new System.Drawing.Point(4, 22);
    3.20              this.tabPageDevices.Name = "tabPageDevices";
    3.21              this.tabPageDevices.Padding = new System.Windows.Forms.Padding(3);
    3.22 -            this.tabPageDevices.Size = new System.Drawing.Size(918, 512);
    3.23 +            this.tabPageDevices.Size = new System.Drawing.Size(894, 488);
    3.24              this.tabPageDevices.TabIndex = 1;
    3.25              this.tabPageDevices.Text = "Devices";
    3.26              this.tabPageDevices.UseVisualStyleBackColor = true;
    3.27 @@ -154,9 +158,29 @@
    3.28              | System.Windows.Forms.AnchorStyles.Left)));
    3.29              this.treeViewDevices.Location = new System.Drawing.Point(8, 6);
    3.30              this.treeViewDevices.Name = "treeViewDevices";
    3.31 -            this.treeViewDevices.Size = new System.Drawing.Size(713, 498);
    3.32 +            this.treeViewDevices.Size = new System.Drawing.Size(713, 474);
    3.33              this.treeViewDevices.TabIndex = 0;
    3.34              // 
    3.35 +            // buttonTreeViewCollapseAll
    3.36 +            // 
    3.37 +            this.buttonTreeViewCollapseAll.Location = new System.Drawing.Point(813, 35);
    3.38 +            this.buttonTreeViewCollapseAll.Name = "buttonTreeViewCollapseAll";
    3.39 +            this.buttonTreeViewCollapseAll.Size = new System.Drawing.Size(75, 23);
    3.40 +            this.buttonTreeViewCollapseAll.TabIndex = 1;
    3.41 +            this.buttonTreeViewCollapseAll.Text = "Collapse All";
    3.42 +            this.buttonTreeViewCollapseAll.UseVisualStyleBackColor = true;
    3.43 +            this.buttonTreeViewCollapseAll.Click += new System.EventHandler(this.buttonTreeViewCollapseAll_Click);
    3.44 +            // 
    3.45 +            // buttonTreeViewExpandAll
    3.46 +            // 
    3.47 +            this.buttonTreeViewExpandAll.Location = new System.Drawing.Point(813, 6);
    3.48 +            this.buttonTreeViewExpandAll.Name = "buttonTreeViewExpandAll";
    3.49 +            this.buttonTreeViewExpandAll.Size = new System.Drawing.Size(75, 23);
    3.50 +            this.buttonTreeViewExpandAll.TabIndex = 2;
    3.51 +            this.buttonTreeViewExpandAll.Text = "Expand All";
    3.52 +            this.buttonTreeViewExpandAll.UseVisualStyleBackColor = true;
    3.53 +            this.buttonTreeViewExpandAll.Click += new System.EventHandler(this.buttonTreeViewExpandAll_Click);
    3.54 +            // 
    3.55              // MainForm
    3.56              // 
    3.57              this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    3.58 @@ -175,5 +199,8 @@
    3.59          }
    3.60          #endregion Windows Form Designer generated code
    3.61  
    3.62 +        private System.Windows.Forms.Button buttonTreeViewExpandAll;
    3.63 +        private System.Windows.Forms.Button buttonTreeViewCollapseAll;
    3.64 +
    3.65      }
    3.66  }
     4.1 --- a/MainForm.cs	Sun Feb 15 22:13:33 2015 +0100
     4.2 +++ b/MainForm.cs	Sun Feb 15 22:57:38 2015 +0100
     4.3 @@ -166,5 +166,15 @@
     4.4  			listViewEvents.Items.Clear();
     4.5  		}
     4.6  
     4.7 +        private void buttonTreeViewCollapseAll_Click(object sender, EventArgs e)
     4.8 +        {
     4.9 +            treeViewDevices.CollapseAll();            
    4.10 +        }
    4.11 +
    4.12 +        private void buttonTreeViewExpandAll_Click(object sender, EventArgs e)
    4.13 +        {
    4.14 +            treeViewDevices.ExpandAll();
    4.15 +        }
    4.16 +
    4.17  	}
    4.18  }
     5.1 --- a/RawInput.cs	Sun Feb 15 22:13:33 2015 +0100
     5.2 +++ b/RawInput.cs	Sun Feb 15 22:57:38 2015 +0100
     5.3 @@ -206,7 +206,20 @@
     5.4                  {
     5.5                      node.Nodes.Add(hidDevice.InputCapabilitiesDescription);
     5.6                  }
     5.7 -                
     5.8 +
     5.9 +                if (hidDevice.InputValueCapabilities != null)
    5.10 +                {
    5.11 +                    foreach (HIDP_VALUE_CAPS caps in hidDevice.InputValueCapabilities)
    5.12 +                    {
    5.13 +                        string des = hidDevice.InputValueCapabilityDescription(caps);
    5.14 +                        if (des != null)
    5.15 +                        {
    5.16 +                            node.Nodes.Add(des);
    5.17 +                        }
    5.18 +                    }
    5.19 +
    5.20 +                }
    5.21 +
    5.22                  node.Nodes.Add(hidDevice.Name);
    5.23              }
    5.24          }