Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 1 | /* |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 2 | * (c) 1999 Andreas Gal <gal@cs.uni-magdeburg.de> |
| 3 | * (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz> |
| 4 | * (c) 2007 Jiri Kosina |
| 5 | * |
| 6 | * Some debug stuff for the HID parser. |
| 7 | */ |
| 8 | |
| 9 | /* |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; either version 2 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program; if not, write to the Free Software |
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 23 | * |
| 24 | * Should you need to contact me, the author, you can do so either by |
| 25 | * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: |
| 26 | * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic |
| 27 | */ |
| 28 | |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 29 | #include <linux/hid.h> |
Adrian Bunk | 4330eb2 | 2007-02-21 12:57:30 +0100 | [diff] [blame] | 30 | #include <linux/hid-debug.h> |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 31 | |
| 32 | struct hid_usage_entry { |
| 33 | unsigned page; |
| 34 | unsigned usage; |
Joe Perches | 0ce1ac3 | 2007-09-26 16:29:53 +0200 | [diff] [blame] | 35 | const char *description; |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | static const struct hid_usage_entry hid_usage_table[] = { |
| 39 | { 0, 0, "Undefined" }, |
| 40 | { 1, 0, "GenericDesktop" }, |
| 41 | {0, 0x01, "Pointer"}, |
| 42 | {0, 0x02, "Mouse"}, |
| 43 | {0, 0x04, "Joystick"}, |
| 44 | {0, 0x05, "GamePad"}, |
| 45 | {0, 0x06, "Keyboard"}, |
| 46 | {0, 0x07, "Keypad"}, |
| 47 | {0, 0x08, "MultiAxis"}, |
| 48 | {0, 0x30, "X"}, |
| 49 | {0, 0x31, "Y"}, |
| 50 | {0, 0x32, "Z"}, |
| 51 | {0, 0x33, "Rx"}, |
| 52 | {0, 0x34, "Ry"}, |
| 53 | {0, 0x35, "Rz"}, |
| 54 | {0, 0x36, "Slider"}, |
| 55 | {0, 0x37, "Dial"}, |
| 56 | {0, 0x38, "Wheel"}, |
| 57 | {0, 0x39, "HatSwitch"}, |
| 58 | {0, 0x3a, "CountedBuffer"}, |
| 59 | {0, 0x3b, "ByteCount"}, |
| 60 | {0, 0x3c, "MotionWakeup"}, |
| 61 | {0, 0x3d, "Start"}, |
| 62 | {0, 0x3e, "Select"}, |
| 63 | {0, 0x40, "Vx"}, |
| 64 | {0, 0x41, "Vy"}, |
| 65 | {0, 0x42, "Vz"}, |
| 66 | {0, 0x43, "Vbrx"}, |
| 67 | {0, 0x44, "Vbry"}, |
| 68 | {0, 0x45, "Vbrz"}, |
| 69 | {0, 0x46, "Vno"}, |
| 70 | {0, 0x80, "SystemControl"}, |
| 71 | {0, 0x81, "SystemPowerDown"}, |
| 72 | {0, 0x82, "SystemSleep"}, |
| 73 | {0, 0x83, "SystemWakeUp"}, |
| 74 | {0, 0x84, "SystemContextMenu"}, |
| 75 | {0, 0x85, "SystemMainMenu"}, |
| 76 | {0, 0x86, "SystemAppMenu"}, |
| 77 | {0, 0x87, "SystemMenuHelp"}, |
| 78 | {0, 0x88, "SystemMenuExit"}, |
| 79 | {0, 0x89, "SystemMenuSelect"}, |
| 80 | {0, 0x8a, "SystemMenuRight"}, |
| 81 | {0, 0x8b, "SystemMenuLeft"}, |
| 82 | {0, 0x8c, "SystemMenuUp"}, |
| 83 | {0, 0x8d, "SystemMenuDown"}, |
| 84 | {0, 0x90, "D-PadUp"}, |
| 85 | {0, 0x91, "D-PadDown"}, |
| 86 | {0, 0x92, "D-PadRight"}, |
| 87 | {0, 0x93, "D-PadLeft"}, |
| 88 | { 2, 0, "Simulation" }, |
| 89 | {0, 0xb0, "Aileron"}, |
| 90 | {0, 0xb1, "AileronTrim"}, |
| 91 | {0, 0xb2, "Anti-Torque"}, |
| 92 | {0, 0xb3, "Autopilot"}, |
| 93 | {0, 0xb4, "Chaff"}, |
| 94 | {0, 0xb5, "Collective"}, |
| 95 | {0, 0xb6, "DiveBrake"}, |
| 96 | {0, 0xb7, "ElectronicCountermeasures"}, |
| 97 | {0, 0xb8, "Elevator"}, |
| 98 | {0, 0xb9, "ElevatorTrim"}, |
| 99 | {0, 0xba, "Rudder"}, |
| 100 | {0, 0xbb, "Throttle"}, |
| 101 | {0, 0xbc, "FlightCommunications"}, |
| 102 | {0, 0xbd, "FlareRelease"}, |
| 103 | {0, 0xbe, "LandingGear"}, |
| 104 | {0, 0xbf, "ToeBrake"}, |
| 105 | { 7, 0, "Keyboard" }, |
| 106 | { 8, 0, "LED" }, |
| 107 | {0, 0x01, "NumLock"}, |
| 108 | {0, 0x02, "CapsLock"}, |
| 109 | {0, 0x03, "ScrollLock"}, |
| 110 | {0, 0x04, "Compose"}, |
| 111 | {0, 0x05, "Kana"}, |
| 112 | {0, 0x4b, "GenericIndicator"}, |
| 113 | { 9, 0, "Button" }, |
| 114 | { 10, 0, "Ordinal" }, |
| 115 | { 12, 0, "Consumer" }, |
| 116 | {0, 0x238, "HorizontalWheel"}, |
| 117 | { 13, 0, "Digitizers" }, |
| 118 | {0, 0x01, "Digitizer"}, |
| 119 | {0, 0x02, "Pen"}, |
| 120 | {0, 0x03, "LightPen"}, |
| 121 | {0, 0x04, "TouchScreen"}, |
| 122 | {0, 0x05, "TouchPad"}, |
| 123 | {0, 0x20, "Stylus"}, |
| 124 | {0, 0x21, "Puck"}, |
| 125 | {0, 0x22, "Finger"}, |
| 126 | {0, 0x30, "TipPressure"}, |
| 127 | {0, 0x31, "BarrelPressure"}, |
| 128 | {0, 0x32, "InRange"}, |
| 129 | {0, 0x33, "Touch"}, |
| 130 | {0, 0x34, "UnTouch"}, |
| 131 | {0, 0x35, "Tap"}, |
| 132 | {0, 0x39, "TabletFunctionKey"}, |
| 133 | {0, 0x3a, "ProgramChangeKey"}, |
| 134 | {0, 0x3c, "Invert"}, |
| 135 | {0, 0x42, "TipSwitch"}, |
| 136 | {0, 0x43, "SecondaryTipSwitch"}, |
| 137 | {0, 0x44, "BarrelSwitch"}, |
| 138 | {0, 0x45, "Eraser"}, |
| 139 | {0, 0x46, "TabletPick"}, |
Stephane Chatty | 89f536c | 2009-05-20 15:41:24 +0200 | [diff] [blame] | 140 | {0, 0x47, "Confidence"}, |
| 141 | {0, 0x48, "Width"}, |
| 142 | {0, 0x49, "Height"}, |
| 143 | {0, 0x51, "ContactID"}, |
| 144 | {0, 0x52, "InputMode"}, |
| 145 | {0, 0x53, "DeviceIndex"}, |
| 146 | {0, 0x54, "ContactCount"}, |
| 147 | {0, 0x55, "ContactMaximumNumber"}, |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 148 | { 15, 0, "PhysicalInterfaceDevice" }, |
| 149 | {0, 0x00, "Undefined"}, |
| 150 | {0, 0x01, "Physical_Interface_Device"}, |
| 151 | {0, 0x20, "Normal"}, |
| 152 | {0, 0x21, "Set_Effect_Report"}, |
| 153 | {0, 0x22, "Effect_Block_Index"}, |
| 154 | {0, 0x23, "Parameter_Block_Offset"}, |
| 155 | {0, 0x24, "ROM_Flag"}, |
| 156 | {0, 0x25, "Effect_Type"}, |
| 157 | {0, 0x26, "ET_Constant_Force"}, |
| 158 | {0, 0x27, "ET_Ramp"}, |
| 159 | {0, 0x28, "ET_Custom_Force_Data"}, |
| 160 | {0, 0x30, "ET_Square"}, |
| 161 | {0, 0x31, "ET_Sine"}, |
| 162 | {0, 0x32, "ET_Triangle"}, |
| 163 | {0, 0x33, "ET_Sawtooth_Up"}, |
| 164 | {0, 0x34, "ET_Sawtooth_Down"}, |
| 165 | {0, 0x40, "ET_Spring"}, |
| 166 | {0, 0x41, "ET_Damper"}, |
| 167 | {0, 0x42, "ET_Inertia"}, |
| 168 | {0, 0x43, "ET_Friction"}, |
| 169 | {0, 0x50, "Duration"}, |
| 170 | {0, 0x51, "Sample_Period"}, |
| 171 | {0, 0x52, "Gain"}, |
| 172 | {0, 0x53, "Trigger_Button"}, |
| 173 | {0, 0x54, "Trigger_Repeat_Interval"}, |
| 174 | {0, 0x55, "Axes_Enable"}, |
| 175 | {0, 0x56, "Direction_Enable"}, |
| 176 | {0, 0x57, "Direction"}, |
| 177 | {0, 0x58, "Type_Specific_Block_Offset"}, |
| 178 | {0, 0x59, "Block_Type"}, |
| 179 | {0, 0x5A, "Set_Envelope_Report"}, |
| 180 | {0, 0x5B, "Attack_Level"}, |
| 181 | {0, 0x5C, "Attack_Time"}, |
| 182 | {0, 0x5D, "Fade_Level"}, |
| 183 | {0, 0x5E, "Fade_Time"}, |
| 184 | {0, 0x5F, "Set_Condition_Report"}, |
| 185 | {0, 0x60, "CP_Offset"}, |
| 186 | {0, 0x61, "Positive_Coefficient"}, |
| 187 | {0, 0x62, "Negative_Coefficient"}, |
| 188 | {0, 0x63, "Positive_Saturation"}, |
| 189 | {0, 0x64, "Negative_Saturation"}, |
| 190 | {0, 0x65, "Dead_Band"}, |
| 191 | {0, 0x66, "Download_Force_Sample"}, |
| 192 | {0, 0x67, "Isoch_Custom_Force_Enable"}, |
| 193 | {0, 0x68, "Custom_Force_Data_Report"}, |
| 194 | {0, 0x69, "Custom_Force_Data"}, |
| 195 | {0, 0x6A, "Custom_Force_Vendor_Defined_Data"}, |
| 196 | {0, 0x6B, "Set_Custom_Force_Report"}, |
| 197 | {0, 0x6C, "Custom_Force_Data_Offset"}, |
| 198 | {0, 0x6D, "Sample_Count"}, |
| 199 | {0, 0x6E, "Set_Periodic_Report"}, |
| 200 | {0, 0x6F, "Offset"}, |
| 201 | {0, 0x70, "Magnitude"}, |
| 202 | {0, 0x71, "Phase"}, |
| 203 | {0, 0x72, "Period"}, |
| 204 | {0, 0x73, "Set_Constant_Force_Report"}, |
| 205 | {0, 0x74, "Set_Ramp_Force_Report"}, |
| 206 | {0, 0x75, "Ramp_Start"}, |
| 207 | {0, 0x76, "Ramp_End"}, |
| 208 | {0, 0x77, "Effect_Operation_Report"}, |
| 209 | {0, 0x78, "Effect_Operation"}, |
| 210 | {0, 0x79, "Op_Effect_Start"}, |
| 211 | {0, 0x7A, "Op_Effect_Start_Solo"}, |
| 212 | {0, 0x7B, "Op_Effect_Stop"}, |
| 213 | {0, 0x7C, "Loop_Count"}, |
| 214 | {0, 0x7D, "Device_Gain_Report"}, |
| 215 | {0, 0x7E, "Device_Gain"}, |
| 216 | {0, 0x7F, "PID_Pool_Report"}, |
| 217 | {0, 0x80, "RAM_Pool_Size"}, |
| 218 | {0, 0x81, "ROM_Pool_Size"}, |
| 219 | {0, 0x82, "ROM_Effect_Block_Count"}, |
| 220 | {0, 0x83, "Simultaneous_Effects_Max"}, |
| 221 | {0, 0x84, "Pool_Alignment"}, |
| 222 | {0, 0x85, "PID_Pool_Move_Report"}, |
| 223 | {0, 0x86, "Move_Source"}, |
| 224 | {0, 0x87, "Move_Destination"}, |
| 225 | {0, 0x88, "Move_Length"}, |
| 226 | {0, 0x89, "PID_Block_Load_Report"}, |
| 227 | {0, 0x8B, "Block_Load_Status"}, |
| 228 | {0, 0x8C, "Block_Load_Success"}, |
| 229 | {0, 0x8D, "Block_Load_Full"}, |
| 230 | {0, 0x8E, "Block_Load_Error"}, |
| 231 | {0, 0x8F, "Block_Handle"}, |
| 232 | {0, 0x90, "PID_Block_Free_Report"}, |
| 233 | {0, 0x91, "Type_Specific_Block_Handle"}, |
| 234 | {0, 0x92, "PID_State_Report"}, |
| 235 | {0, 0x94, "Effect_Playing"}, |
| 236 | {0, 0x95, "PID_Device_Control_Report"}, |
| 237 | {0, 0x96, "PID_Device_Control"}, |
| 238 | {0, 0x97, "DC_Enable_Actuators"}, |
| 239 | {0, 0x98, "DC_Disable_Actuators"}, |
| 240 | {0, 0x99, "DC_Stop_All_Effects"}, |
| 241 | {0, 0x9A, "DC_Device_Reset"}, |
| 242 | {0, 0x9B, "DC_Device_Pause"}, |
| 243 | {0, 0x9C, "DC_Device_Continue"}, |
| 244 | {0, 0x9F, "Device_Paused"}, |
| 245 | {0, 0xA0, "Actuators_Enabled"}, |
| 246 | {0, 0xA4, "Safety_Switch"}, |
| 247 | {0, 0xA5, "Actuator_Override_Switch"}, |
| 248 | {0, 0xA6, "Actuator_Power"}, |
| 249 | {0, 0xA7, "Start_Delay"}, |
| 250 | {0, 0xA8, "Parameter_Block_Size"}, |
| 251 | {0, 0xA9, "Device_Managed_Pool"}, |
| 252 | {0, 0xAA, "Shared_Parameter_Blocks"}, |
| 253 | {0, 0xAB, "Create_New_Effect_Report"}, |
| 254 | {0, 0xAC, "RAM_Pool_Available"}, |
| 255 | { 0x84, 0, "Power Device" }, |
| 256 | { 0x84, 0x02, "PresentStatus" }, |
| 257 | { 0x84, 0x03, "ChangeStatus" }, |
| 258 | { 0x84, 0x04, "UPS" }, |
| 259 | { 0x84, 0x05, "PowerSupply" }, |
| 260 | { 0x84, 0x10, "BatterySystem" }, |
| 261 | { 0x84, 0x11, "BatterySystemID" }, |
| 262 | { 0x84, 0x12, "Battery" }, |
| 263 | { 0x84, 0x13, "BatteryID" }, |
| 264 | { 0x84, 0x14, "Charger" }, |
| 265 | { 0x84, 0x15, "ChargerID" }, |
| 266 | { 0x84, 0x16, "PowerConverter" }, |
| 267 | { 0x84, 0x17, "PowerConverterID" }, |
| 268 | { 0x84, 0x18, "OutletSystem" }, |
| 269 | { 0x84, 0x19, "OutletSystemID" }, |
| 270 | { 0x84, 0x1a, "Input" }, |
| 271 | { 0x84, 0x1b, "InputID" }, |
| 272 | { 0x84, 0x1c, "Output" }, |
| 273 | { 0x84, 0x1d, "OutputID" }, |
| 274 | { 0x84, 0x1e, "Flow" }, |
| 275 | { 0x84, 0x1f, "FlowID" }, |
| 276 | { 0x84, 0x20, "Outlet" }, |
| 277 | { 0x84, 0x21, "OutletID" }, |
| 278 | { 0x84, 0x22, "Gang" }, |
| 279 | { 0x84, 0x24, "PowerSummary" }, |
| 280 | { 0x84, 0x25, "PowerSummaryID" }, |
| 281 | { 0x84, 0x30, "Voltage" }, |
| 282 | { 0x84, 0x31, "Current" }, |
| 283 | { 0x84, 0x32, "Frequency" }, |
| 284 | { 0x84, 0x33, "ApparentPower" }, |
| 285 | { 0x84, 0x35, "PercentLoad" }, |
| 286 | { 0x84, 0x40, "ConfigVoltage" }, |
| 287 | { 0x84, 0x41, "ConfigCurrent" }, |
| 288 | { 0x84, 0x43, "ConfigApparentPower" }, |
| 289 | { 0x84, 0x53, "LowVoltageTransfer" }, |
| 290 | { 0x84, 0x54, "HighVoltageTransfer" }, |
| 291 | { 0x84, 0x56, "DelayBeforeStartup" }, |
| 292 | { 0x84, 0x57, "DelayBeforeShutdown" }, |
| 293 | { 0x84, 0x58, "Test" }, |
| 294 | { 0x84, 0x5a, "AudibleAlarmControl" }, |
| 295 | { 0x84, 0x60, "Present" }, |
| 296 | { 0x84, 0x61, "Good" }, |
| 297 | { 0x84, 0x62, "InternalFailure" }, |
| 298 | { 0x84, 0x65, "Overload" }, |
| 299 | { 0x84, 0x66, "OverCharged" }, |
| 300 | { 0x84, 0x67, "OverTemperature" }, |
| 301 | { 0x84, 0x68, "ShutdownRequested" }, |
| 302 | { 0x84, 0x69, "ShutdownImminent" }, |
| 303 | { 0x84, 0x6b, "SwitchOn/Off" }, |
| 304 | { 0x84, 0x6c, "Switchable" }, |
| 305 | { 0x84, 0x6d, "Used" }, |
| 306 | { 0x84, 0x6e, "Boost" }, |
| 307 | { 0x84, 0x73, "CommunicationLost" }, |
| 308 | { 0x84, 0xfd, "iManufacturer" }, |
| 309 | { 0x84, 0xfe, "iProduct" }, |
| 310 | { 0x84, 0xff, "iSerialNumber" }, |
| 311 | { 0x85, 0, "Battery System" }, |
| 312 | { 0x85, 0x01, "SMBBatteryMode" }, |
| 313 | { 0x85, 0x02, "SMBBatteryStatus" }, |
| 314 | { 0x85, 0x03, "SMBAlarmWarning" }, |
| 315 | { 0x85, 0x04, "SMBChargerMode" }, |
| 316 | { 0x85, 0x05, "SMBChargerStatus" }, |
| 317 | { 0x85, 0x06, "SMBChargerSpecInfo" }, |
| 318 | { 0x85, 0x07, "SMBSelectorState" }, |
| 319 | { 0x85, 0x08, "SMBSelectorPresets" }, |
| 320 | { 0x85, 0x09, "SMBSelectorInfo" }, |
| 321 | { 0x85, 0x29, "RemainingCapacityLimit" }, |
| 322 | { 0x85, 0x2c, "CapacityMode" }, |
| 323 | { 0x85, 0x42, "BelowRemainingCapacityLimit" }, |
| 324 | { 0x85, 0x44, "Charging" }, |
| 325 | { 0x85, 0x45, "Discharging" }, |
| 326 | { 0x85, 0x4b, "NeedReplacement" }, |
| 327 | { 0x85, 0x66, "RemainingCapacity" }, |
| 328 | { 0x85, 0x68, "RunTimeToEmpty" }, |
| 329 | { 0x85, 0x6a, "AverageTimeToFull" }, |
| 330 | { 0x85, 0x83, "DesignCapacity" }, |
| 331 | { 0x85, 0x85, "ManufacturerDate" }, |
| 332 | { 0x85, 0x89, "iDeviceChemistry" }, |
| 333 | { 0x85, 0x8b, "Rechargable" }, |
| 334 | { 0x85, 0x8f, "iOEMInformation" }, |
| 335 | { 0x85, 0x8d, "CapacityGranularity1" }, |
| 336 | { 0x85, 0xd0, "ACPresent" }, |
| 337 | /* pages 0xff00 to 0xffff are vendor-specific */ |
| 338 | { 0xffff, 0, "Vendor-specific-FF" }, |
| 339 | { 0, 0, NULL } |
| 340 | }; |
| 341 | |
| 342 | static void resolv_usage_page(unsigned page) { |
| 343 | const struct hid_usage_entry *p; |
| 344 | |
| 345 | for (p = hid_usage_table; p->description; p++) |
| 346 | if (p->page == page) { |
| 347 | printk("%s", p->description); |
| 348 | return; |
| 349 | } |
| 350 | printk("%04x", page); |
| 351 | } |
| 352 | |
| 353 | void hid_resolv_usage(unsigned usage) { |
| 354 | const struct hid_usage_entry *p; |
| 355 | |
Jiri Kosina | 58037eb | 2007-05-30 15:07:13 +0200 | [diff] [blame] | 356 | if (!hid_debug) |
| 357 | return; |
| 358 | |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 359 | resolv_usage_page(usage >> 16); |
| 360 | printk("."); |
| 361 | for (p = hid_usage_table; p->description; p++) |
| 362 | if (p->page == (usage >> 16)) { |
| 363 | for(++p; p->description && p->usage != 0; p++) |
| 364 | if (p->usage == (usage & 0xffff)) { |
| 365 | printk("%s", p->description); |
| 366 | return; |
| 367 | } |
| 368 | break; |
| 369 | } |
| 370 | printk("%04x", usage & 0xffff); |
| 371 | } |
| 372 | EXPORT_SYMBOL_GPL(hid_resolv_usage); |
| 373 | |
Joe Perches | 0ce1ac3 | 2007-09-26 16:29:53 +0200 | [diff] [blame] | 374 | static void tab(int n) { |
| 375 | printk(KERN_DEBUG "%*s", n, ""); |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 376 | } |
| 377 | |
| 378 | void hid_dump_field(struct hid_field *field, int n) { |
| 379 | int j; |
| 380 | |
Jiri Kosina | 58037eb | 2007-05-30 15:07:13 +0200 | [diff] [blame] | 381 | if (!hid_debug) |
| 382 | return; |
| 383 | |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 384 | if (field->physical) { |
| 385 | tab(n); |
| 386 | printk("Physical("); |
| 387 | hid_resolv_usage(field->physical); printk(")\n"); |
| 388 | } |
| 389 | if (field->logical) { |
| 390 | tab(n); |
| 391 | printk("Logical("); |
| 392 | hid_resolv_usage(field->logical); printk(")\n"); |
| 393 | } |
| 394 | tab(n); printk("Usage(%d)\n", field->maxusage); |
| 395 | for (j = 0; j < field->maxusage; j++) { |
| 396 | tab(n+2); hid_resolv_usage(field->usage[j].hid); printk("\n"); |
| 397 | } |
| 398 | if (field->logical_minimum != field->logical_maximum) { |
| 399 | tab(n); printk("Logical Minimum(%d)\n", field->logical_minimum); |
| 400 | tab(n); printk("Logical Maximum(%d)\n", field->logical_maximum); |
| 401 | } |
| 402 | if (field->physical_minimum != field->physical_maximum) { |
| 403 | tab(n); printk("Physical Minimum(%d)\n", field->physical_minimum); |
| 404 | tab(n); printk("Physical Maximum(%d)\n", field->physical_maximum); |
| 405 | } |
| 406 | if (field->unit_exponent) { |
| 407 | tab(n); printk("Unit Exponent(%d)\n", field->unit_exponent); |
| 408 | } |
| 409 | if (field->unit) { |
Joe Perches | 0ce1ac3 | 2007-09-26 16:29:53 +0200 | [diff] [blame] | 410 | static const char *systems[5] = { "None", "SI Linear", "SI Rotation", "English Linear", "English Rotation" }; |
| 411 | static const char *units[5][8] = { |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 412 | { "None", "None", "None", "None", "None", "None", "None", "None" }, |
| 413 | { "None", "Centimeter", "Gram", "Seconds", "Kelvin", "Ampere", "Candela", "None" }, |
| 414 | { "None", "Radians", "Gram", "Seconds", "Kelvin", "Ampere", "Candela", "None" }, |
| 415 | { "None", "Inch", "Slug", "Seconds", "Fahrenheit", "Ampere", "Candela", "None" }, |
| 416 | { "None", "Degrees", "Slug", "Seconds", "Fahrenheit", "Ampere", "Candela", "None" } |
| 417 | }; |
| 418 | |
| 419 | int i; |
| 420 | int sys; |
| 421 | __u32 data = field->unit; |
| 422 | |
| 423 | /* First nibble tells us which system we're in. */ |
| 424 | sys = data & 0xf; |
| 425 | data >>= 4; |
| 426 | |
| 427 | if(sys > 4) { |
| 428 | tab(n); printk("Unit(Invalid)\n"); |
| 429 | } |
| 430 | else { |
| 431 | int earlier_unit = 0; |
| 432 | |
| 433 | tab(n); printk("Unit(%s : ", systems[sys]); |
| 434 | |
| 435 | for (i=1 ; i<sizeof(__u32)*2 ; i++) { |
| 436 | char nibble = data & 0xf; |
| 437 | data >>= 4; |
| 438 | if (nibble != 0) { |
| 439 | if(earlier_unit++ > 0) |
| 440 | printk("*"); |
| 441 | printk("%s", units[sys][i]); |
| 442 | if(nibble != 1) { |
| 443 | /* This is a _signed_ nibble(!) */ |
| 444 | |
| 445 | int val = nibble & 0x7; |
| 446 | if(nibble & 0x08) |
| 447 | val = -((0x7 & ~val) +1); |
| 448 | printk("^%d", val); |
| 449 | } |
| 450 | } |
| 451 | } |
| 452 | printk(")\n"); |
| 453 | } |
| 454 | } |
| 455 | tab(n); printk("Report Size(%u)\n", field->report_size); |
| 456 | tab(n); printk("Report Count(%u)\n", field->report_count); |
| 457 | tab(n); printk("Report Offset(%u)\n", field->report_offset); |
| 458 | |
| 459 | tab(n); printk("Flags( "); |
| 460 | j = field->flags; |
| 461 | printk("%s", HID_MAIN_ITEM_CONSTANT & j ? "Constant " : ""); |
| 462 | printk("%s", HID_MAIN_ITEM_VARIABLE & j ? "Variable " : "Array "); |
| 463 | printk("%s", HID_MAIN_ITEM_RELATIVE & j ? "Relative " : "Absolute "); |
| 464 | printk("%s", HID_MAIN_ITEM_WRAP & j ? "Wrap " : ""); |
| 465 | printk("%s", HID_MAIN_ITEM_NONLINEAR & j ? "NonLinear " : ""); |
Joe Perches | 0ce1ac3 | 2007-09-26 16:29:53 +0200 | [diff] [blame] | 466 | printk("%s", HID_MAIN_ITEM_NO_PREFERRED & j ? "NoPreferredState " : ""); |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 467 | printk("%s", HID_MAIN_ITEM_NULL_STATE & j ? "NullState " : ""); |
| 468 | printk("%s", HID_MAIN_ITEM_VOLATILE & j ? "Volatile " : ""); |
| 469 | printk("%s", HID_MAIN_ITEM_BUFFERED_BYTE & j ? "BufferedByte " : ""); |
| 470 | printk(")\n"); |
| 471 | } |
| 472 | EXPORT_SYMBOL_GPL(hid_dump_field); |
| 473 | |
| 474 | void hid_dump_device(struct hid_device *device) { |
| 475 | struct hid_report_enum *report_enum; |
| 476 | struct hid_report *report; |
| 477 | struct list_head *list; |
| 478 | unsigned i,k; |
Joe Perches | 0ce1ac3 | 2007-09-26 16:29:53 +0200 | [diff] [blame] | 479 | static const char *table[] = {"INPUT", "OUTPUT", "FEATURE"}; |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 480 | |
Jiri Kosina | 58037eb | 2007-05-30 15:07:13 +0200 | [diff] [blame] | 481 | if (!hid_debug) |
| 482 | return; |
| 483 | |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 484 | for (i = 0; i < HID_REPORT_TYPES; i++) { |
| 485 | report_enum = device->report_enum + i; |
| 486 | list = report_enum->report_list.next; |
| 487 | while (list != &report_enum->report_list) { |
| 488 | report = (struct hid_report *) list; |
| 489 | tab(2); |
| 490 | printk("%s", table[i]); |
| 491 | if (report->id) |
| 492 | printk("(%d)", report->id); |
| 493 | printk("[%s]", table[report->type]); |
| 494 | printk("\n"); |
| 495 | for (k = 0; k < report->maxfield; k++) { |
| 496 | tab(4); |
| 497 | printk("Field(%d)\n", k); |
| 498 | hid_dump_field(report->field[k], 6); |
| 499 | } |
| 500 | list = list->next; |
| 501 | } |
| 502 | } |
| 503 | } |
| 504 | EXPORT_SYMBOL_GPL(hid_dump_device); |
| 505 | |
| 506 | void hid_dump_input(struct hid_usage *usage, __s32 value) { |
Anssi Hannula | 377e10f | 2008-03-22 23:50:13 +0100 | [diff] [blame] | 507 | if (hid_debug < 2) |
Jiri Kosina | 58037eb | 2007-05-30 15:07:13 +0200 | [diff] [blame] | 508 | return; |
| 509 | |
Joe Perches | 0ce1ac3 | 2007-09-26 16:29:53 +0200 | [diff] [blame] | 510 | printk(KERN_DEBUG "hid-debug: input "); |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 511 | hid_resolv_usage(usage->hid); |
| 512 | printk(" = %d\n", value); |
| 513 | } |
| 514 | EXPORT_SYMBOL_GPL(hid_dump_input); |
| 515 | |
Joe Perches | 0ce1ac3 | 2007-09-26 16:29:53 +0200 | [diff] [blame] | 516 | static const char *events[EV_MAX + 1] = { |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 517 | [EV_SYN] = "Sync", [EV_KEY] = "Key", |
| 518 | [EV_REL] = "Relative", [EV_ABS] = "Absolute", |
| 519 | [EV_MSC] = "Misc", [EV_LED] = "LED", |
| 520 | [EV_SND] = "Sound", [EV_REP] = "Repeat", |
| 521 | [EV_FF] = "ForceFeedback", [EV_PWR] = "Power", |
| 522 | [EV_FF_STATUS] = "ForceFeedbackStatus", |
| 523 | }; |
| 524 | |
Stephane Chatty | 89f536c | 2009-05-20 15:41:24 +0200 | [diff] [blame] | 525 | static const char *syncs[3] = { |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 526 | [SYN_REPORT] = "Report", [SYN_CONFIG] = "Config", |
Stephane Chatty | 89f536c | 2009-05-20 15:41:24 +0200 | [diff] [blame] | 527 | [SYN_MT_REPORT] = "MT Report", |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 528 | }; |
Stephane Chatty | 89f536c | 2009-05-20 15:41:24 +0200 | [diff] [blame] | 529 | |
Joe Perches | 0ce1ac3 | 2007-09-26 16:29:53 +0200 | [diff] [blame] | 530 | static const char *keys[KEY_MAX + 1] = { |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 531 | [KEY_RESERVED] = "Reserved", [KEY_ESC] = "Esc", |
| 532 | [KEY_1] = "1", [KEY_2] = "2", |
| 533 | [KEY_3] = "3", [KEY_4] = "4", |
| 534 | [KEY_5] = "5", [KEY_6] = "6", |
| 535 | [KEY_7] = "7", [KEY_8] = "8", |
| 536 | [KEY_9] = "9", [KEY_0] = "0", |
| 537 | [KEY_MINUS] = "Minus", [KEY_EQUAL] = "Equal", |
| 538 | [KEY_BACKSPACE] = "Backspace", [KEY_TAB] = "Tab", |
| 539 | [KEY_Q] = "Q", [KEY_W] = "W", |
| 540 | [KEY_E] = "E", [KEY_R] = "R", |
| 541 | [KEY_T] = "T", [KEY_Y] = "Y", |
| 542 | [KEY_U] = "U", [KEY_I] = "I", |
| 543 | [KEY_O] = "O", [KEY_P] = "P", |
| 544 | [KEY_LEFTBRACE] = "LeftBrace", [KEY_RIGHTBRACE] = "RightBrace", |
| 545 | [KEY_ENTER] = "Enter", [KEY_LEFTCTRL] = "LeftControl", |
| 546 | [KEY_A] = "A", [KEY_S] = "S", |
| 547 | [KEY_D] = "D", [KEY_F] = "F", |
| 548 | [KEY_G] = "G", [KEY_H] = "H", |
| 549 | [KEY_J] = "J", [KEY_K] = "K", |
| 550 | [KEY_L] = "L", [KEY_SEMICOLON] = "Semicolon", |
| 551 | [KEY_APOSTROPHE] = "Apostrophe", [KEY_GRAVE] = "Grave", |
| 552 | [KEY_LEFTSHIFT] = "LeftShift", [KEY_BACKSLASH] = "BackSlash", |
| 553 | [KEY_Z] = "Z", [KEY_X] = "X", |
| 554 | [KEY_C] = "C", [KEY_V] = "V", |
| 555 | [KEY_B] = "B", [KEY_N] = "N", |
| 556 | [KEY_M] = "M", [KEY_COMMA] = "Comma", |
| 557 | [KEY_DOT] = "Dot", [KEY_SLASH] = "Slash", |
| 558 | [KEY_RIGHTSHIFT] = "RightShift", [KEY_KPASTERISK] = "KPAsterisk", |
| 559 | [KEY_LEFTALT] = "LeftAlt", [KEY_SPACE] = "Space", |
| 560 | [KEY_CAPSLOCK] = "CapsLock", [KEY_F1] = "F1", |
| 561 | [KEY_F2] = "F2", [KEY_F3] = "F3", |
| 562 | [KEY_F4] = "F4", [KEY_F5] = "F5", |
| 563 | [KEY_F6] = "F6", [KEY_F7] = "F7", |
| 564 | [KEY_F8] = "F8", [KEY_F9] = "F9", |
| 565 | [KEY_F10] = "F10", [KEY_NUMLOCK] = "NumLock", |
| 566 | [KEY_SCROLLLOCK] = "ScrollLock", [KEY_KP7] = "KP7", |
| 567 | [KEY_KP8] = "KP8", [KEY_KP9] = "KP9", |
| 568 | [KEY_KPMINUS] = "KPMinus", [KEY_KP4] = "KP4", |
| 569 | [KEY_KP5] = "KP5", [KEY_KP6] = "KP6", |
| 570 | [KEY_KPPLUS] = "KPPlus", [KEY_KP1] = "KP1", |
| 571 | [KEY_KP2] = "KP2", [KEY_KP3] = "KP3", |
| 572 | [KEY_KP0] = "KP0", [KEY_KPDOT] = "KPDot", |
| 573 | [KEY_ZENKAKUHANKAKU] = "Zenkaku/Hankaku", [KEY_102ND] = "102nd", |
| 574 | [KEY_F11] = "F11", [KEY_F12] = "F12", |
| 575 | [KEY_RO] = "RO", [KEY_KATAKANA] = "Katakana", |
| 576 | [KEY_HIRAGANA] = "HIRAGANA", [KEY_HENKAN] = "Henkan", |
| 577 | [KEY_KATAKANAHIRAGANA] = "Katakana/Hiragana", [KEY_MUHENKAN] = "Muhenkan", |
| 578 | [KEY_KPJPCOMMA] = "KPJpComma", [KEY_KPENTER] = "KPEnter", |
| 579 | [KEY_RIGHTCTRL] = "RightCtrl", [KEY_KPSLASH] = "KPSlash", |
| 580 | [KEY_SYSRQ] = "SysRq", [KEY_RIGHTALT] = "RightAlt", |
| 581 | [KEY_LINEFEED] = "LineFeed", [KEY_HOME] = "Home", |
| 582 | [KEY_UP] = "Up", [KEY_PAGEUP] = "PageUp", |
| 583 | [KEY_LEFT] = "Left", [KEY_RIGHT] = "Right", |
| 584 | [KEY_END] = "End", [KEY_DOWN] = "Down", |
| 585 | [KEY_PAGEDOWN] = "PageDown", [KEY_INSERT] = "Insert", |
| 586 | [KEY_DELETE] = "Delete", [KEY_MACRO] = "Macro", |
| 587 | [KEY_MUTE] = "Mute", [KEY_VOLUMEDOWN] = "VolumeDown", |
| 588 | [KEY_VOLUMEUP] = "VolumeUp", [KEY_POWER] = "Power", |
| 589 | [KEY_KPEQUAL] = "KPEqual", [KEY_KPPLUSMINUS] = "KPPlusMinus", |
| 590 | [KEY_PAUSE] = "Pause", [KEY_KPCOMMA] = "KPComma", |
| 591 | [KEY_HANGUEL] = "Hangeul", [KEY_HANJA] = "Hanja", |
| 592 | [KEY_YEN] = "Yen", [KEY_LEFTMETA] = "LeftMeta", |
| 593 | [KEY_RIGHTMETA] = "RightMeta", [KEY_COMPOSE] = "Compose", |
| 594 | [KEY_STOP] = "Stop", [KEY_AGAIN] = "Again", |
| 595 | [KEY_PROPS] = "Props", [KEY_UNDO] = "Undo", |
| 596 | [KEY_FRONT] = "Front", [KEY_COPY] = "Copy", |
| 597 | [KEY_OPEN] = "Open", [KEY_PASTE] = "Paste", |
| 598 | [KEY_FIND] = "Find", [KEY_CUT] = "Cut", |
| 599 | [KEY_HELP] = "Help", [KEY_MENU] = "Menu", |
| 600 | [KEY_CALC] = "Calc", [KEY_SETUP] = "Setup", |
| 601 | [KEY_SLEEP] = "Sleep", [KEY_WAKEUP] = "WakeUp", |
| 602 | [KEY_FILE] = "File", [KEY_SENDFILE] = "SendFile", |
| 603 | [KEY_DELETEFILE] = "DeleteFile", [KEY_XFER] = "X-fer", |
| 604 | [KEY_PROG1] = "Prog1", [KEY_PROG2] = "Prog2", |
| 605 | [KEY_WWW] = "WWW", [KEY_MSDOS] = "MSDOS", |
| 606 | [KEY_COFFEE] = "Coffee", [KEY_DIRECTION] = "Direction", |
| 607 | [KEY_CYCLEWINDOWS] = "CycleWindows", [KEY_MAIL] = "Mail", |
| 608 | [KEY_BOOKMARKS] = "Bookmarks", [KEY_COMPUTER] = "Computer", |
| 609 | [KEY_BACK] = "Back", [KEY_FORWARD] = "Forward", |
| 610 | [KEY_CLOSECD] = "CloseCD", [KEY_EJECTCD] = "EjectCD", |
| 611 | [KEY_EJECTCLOSECD] = "EjectCloseCD", [KEY_NEXTSONG] = "NextSong", |
| 612 | [KEY_PLAYPAUSE] = "PlayPause", [KEY_PREVIOUSSONG] = "PreviousSong", |
| 613 | [KEY_STOPCD] = "StopCD", [KEY_RECORD] = "Record", |
| 614 | [KEY_REWIND] = "Rewind", [KEY_PHONE] = "Phone", |
| 615 | [KEY_ISO] = "ISOKey", [KEY_CONFIG] = "Config", |
| 616 | [KEY_HOMEPAGE] = "HomePage", [KEY_REFRESH] = "Refresh", |
| 617 | [KEY_EXIT] = "Exit", [KEY_MOVE] = "Move", |
| 618 | [KEY_EDIT] = "Edit", [KEY_SCROLLUP] = "ScrollUp", |
| 619 | [KEY_SCROLLDOWN] = "ScrollDown", [KEY_KPLEFTPAREN] = "KPLeftParenthesis", |
| 620 | [KEY_KPRIGHTPAREN] = "KPRightParenthesis", [KEY_NEW] = "New", |
| 621 | [KEY_REDO] = "Redo", [KEY_F13] = "F13", |
| 622 | [KEY_F14] = "F14", [KEY_F15] = "F15", |
| 623 | [KEY_F16] = "F16", [KEY_F17] = "F17", |
| 624 | [KEY_F18] = "F18", [KEY_F19] = "F19", |
| 625 | [KEY_F20] = "F20", [KEY_F21] = "F21", |
| 626 | [KEY_F22] = "F22", [KEY_F23] = "F23", |
| 627 | [KEY_F24] = "F24", [KEY_PLAYCD] = "PlayCD", |
| 628 | [KEY_PAUSECD] = "PauseCD", [KEY_PROG3] = "Prog3", |
| 629 | [KEY_PROG4] = "Prog4", [KEY_SUSPEND] = "Suspend", |
| 630 | [KEY_CLOSE] = "Close", [KEY_PLAY] = "Play", |
| 631 | [KEY_FASTFORWARD] = "FastForward", [KEY_BASSBOOST] = "BassBoost", |
| 632 | [KEY_PRINT] = "Print", [KEY_HP] = "HP", |
| 633 | [KEY_CAMERA] = "Camera", [KEY_SOUND] = "Sound", |
| 634 | [KEY_QUESTION] = "Question", [KEY_EMAIL] = "Email", |
| 635 | [KEY_CHAT] = "Chat", [KEY_SEARCH] = "Search", |
| 636 | [KEY_CONNECT] = "Connect", [KEY_FINANCE] = "Finance", |
| 637 | [KEY_SPORT] = "Sport", [KEY_SHOP] = "Shop", |
| 638 | [KEY_ALTERASE] = "AlternateErase", [KEY_CANCEL] = "Cancel", |
| 639 | [KEY_BRIGHTNESSDOWN] = "BrightnessDown", [KEY_BRIGHTNESSUP] = "BrightnessUp", |
| 640 | [KEY_MEDIA] = "Media", [KEY_UNKNOWN] = "Unknown", |
| 641 | [BTN_0] = "Btn0", [BTN_1] = "Btn1", |
| 642 | [BTN_2] = "Btn2", [BTN_3] = "Btn3", |
| 643 | [BTN_4] = "Btn4", [BTN_5] = "Btn5", |
| 644 | [BTN_6] = "Btn6", [BTN_7] = "Btn7", |
| 645 | [BTN_8] = "Btn8", [BTN_9] = "Btn9", |
| 646 | [BTN_LEFT] = "LeftBtn", [BTN_RIGHT] = "RightBtn", |
| 647 | [BTN_MIDDLE] = "MiddleBtn", [BTN_SIDE] = "SideBtn", |
| 648 | [BTN_EXTRA] = "ExtraBtn", [BTN_FORWARD] = "ForwardBtn", |
| 649 | [BTN_BACK] = "BackBtn", [BTN_TASK] = "TaskBtn", |
| 650 | [BTN_TRIGGER] = "Trigger", [BTN_THUMB] = "ThumbBtn", |
| 651 | [BTN_THUMB2] = "ThumbBtn2", [BTN_TOP] = "TopBtn", |
| 652 | [BTN_TOP2] = "TopBtn2", [BTN_PINKIE] = "PinkieBtn", |
| 653 | [BTN_BASE] = "BaseBtn", [BTN_BASE2] = "BaseBtn2", |
| 654 | [BTN_BASE3] = "BaseBtn3", [BTN_BASE4] = "BaseBtn4", |
| 655 | [BTN_BASE5] = "BaseBtn5", [BTN_BASE6] = "BaseBtn6", |
| 656 | [BTN_DEAD] = "BtnDead", [BTN_A] = "BtnA", |
| 657 | [BTN_B] = "BtnB", [BTN_C] = "BtnC", |
| 658 | [BTN_X] = "BtnX", [BTN_Y] = "BtnY", |
| 659 | [BTN_Z] = "BtnZ", [BTN_TL] = "BtnTL", |
| 660 | [BTN_TR] = "BtnTR", [BTN_TL2] = "BtnTL2", |
| 661 | [BTN_TR2] = "BtnTR2", [BTN_SELECT] = "BtnSelect", |
| 662 | [BTN_START] = "BtnStart", [BTN_MODE] = "BtnMode", |
| 663 | [BTN_THUMBL] = "BtnThumbL", [BTN_THUMBR] = "BtnThumbR", |
| 664 | [BTN_TOOL_PEN] = "ToolPen", [BTN_TOOL_RUBBER] = "ToolRubber", |
| 665 | [BTN_TOOL_BRUSH] = "ToolBrush", [BTN_TOOL_PENCIL] = "ToolPencil", |
| 666 | [BTN_TOOL_AIRBRUSH] = "ToolAirbrush", [BTN_TOOL_FINGER] = "ToolFinger", |
| 667 | [BTN_TOOL_MOUSE] = "ToolMouse", [BTN_TOOL_LENS] = "ToolLens", |
| 668 | [BTN_TOUCH] = "Touch", [BTN_STYLUS] = "Stylus", |
| 669 | [BTN_STYLUS2] = "Stylus2", [BTN_TOOL_DOUBLETAP] = "ToolDoubleTap", |
| 670 | [BTN_TOOL_TRIPLETAP] = "ToolTripleTap", [BTN_GEAR_DOWN] = "WheelBtn", |
| 671 | [BTN_GEAR_UP] = "Gear up", [KEY_OK] = "Ok", |
| 672 | [KEY_SELECT] = "Select", [KEY_GOTO] = "Goto", |
| 673 | [KEY_CLEAR] = "Clear", [KEY_POWER2] = "Power2", |
| 674 | [KEY_OPTION] = "Option", [KEY_INFO] = "Info", |
| 675 | [KEY_TIME] = "Time", [KEY_VENDOR] = "Vendor", |
| 676 | [KEY_ARCHIVE] = "Archive", [KEY_PROGRAM] = "Program", |
| 677 | [KEY_CHANNEL] = "Channel", [KEY_FAVORITES] = "Favorites", |
| 678 | [KEY_EPG] = "EPG", [KEY_PVR] = "PVR", |
| 679 | [KEY_MHP] = "MHP", [KEY_LANGUAGE] = "Language", |
| 680 | [KEY_TITLE] = "Title", [KEY_SUBTITLE] = "Subtitle", |
| 681 | [KEY_ANGLE] = "Angle", [KEY_ZOOM] = "Zoom", |
| 682 | [KEY_MODE] = "Mode", [KEY_KEYBOARD] = "Keyboard", |
| 683 | [KEY_SCREEN] = "Screen", [KEY_PC] = "PC", |
| 684 | [KEY_TV] = "TV", [KEY_TV2] = "TV2", |
| 685 | [KEY_VCR] = "VCR", [KEY_VCR2] = "VCR2", |
| 686 | [KEY_SAT] = "Sat", [KEY_SAT2] = "Sat2", |
| 687 | [KEY_CD] = "CD", [KEY_TAPE] = "Tape", |
| 688 | [KEY_RADIO] = "Radio", [KEY_TUNER] = "Tuner", |
| 689 | [KEY_PLAYER] = "Player", [KEY_TEXT] = "Text", |
| 690 | [KEY_DVD] = "DVD", [KEY_AUX] = "Aux", |
| 691 | [KEY_MP3] = "MP3", [KEY_AUDIO] = "Audio", |
| 692 | [KEY_VIDEO] = "Video", [KEY_DIRECTORY] = "Directory", |
| 693 | [KEY_LIST] = "List", [KEY_MEMO] = "Memo", |
| 694 | [KEY_CALENDAR] = "Calendar", [KEY_RED] = "Red", |
| 695 | [KEY_GREEN] = "Green", [KEY_YELLOW] = "Yellow", |
| 696 | [KEY_BLUE] = "Blue", [KEY_CHANNELUP] = "ChannelUp", |
| 697 | [KEY_CHANNELDOWN] = "ChannelDown", [KEY_FIRST] = "First", |
| 698 | [KEY_LAST] = "Last", [KEY_AB] = "AB", |
| 699 | [KEY_NEXT] = "Next", [KEY_RESTART] = "Restart", |
| 700 | [KEY_SLOW] = "Slow", [KEY_SHUFFLE] = "Shuffle", |
| 701 | [KEY_BREAK] = "Break", [KEY_PREVIOUS] = "Previous", |
| 702 | [KEY_DIGITS] = "Digits", [KEY_TEEN] = "TEEN", |
| 703 | [KEY_TWEN] = "TWEN", [KEY_DEL_EOL] = "DeleteEOL", |
| 704 | [KEY_DEL_EOS] = "DeleteEOS", [KEY_INS_LINE] = "InsertLine", |
| 705 | [KEY_DEL_LINE] = "DeleteLine", |
| 706 | [KEY_SEND] = "Send", [KEY_REPLY] = "Reply", |
| 707 | [KEY_FORWARDMAIL] = "ForwardMail", [KEY_SAVE] = "Save", |
Jiri Kosina | 1fe8736d | 2007-08-09 13:24:11 +0200 | [diff] [blame] | 708 | [KEY_DOCUMENTS] = "Documents", [KEY_SPELLCHECK] = "SpellCheck", |
Khelben Blackstaff | e2bca07 | 2007-10-04 10:32:03 +0200 | [diff] [blame] | 709 | [KEY_LOGOFF] = "Logoff", |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 710 | [KEY_FN] = "Fn", [KEY_FN_ESC] = "Fn+ESC", |
| 711 | [KEY_FN_1] = "Fn+1", [KEY_FN_2] = "Fn+2", |
| 712 | [KEY_FN_B] = "Fn+B", [KEY_FN_D] = "Fn+D", |
| 713 | [KEY_FN_E] = "Fn+E", [KEY_FN_F] = "Fn+F", |
| 714 | [KEY_FN_S] = "Fn+S", |
| 715 | [KEY_FN_F1] = "Fn+F1", [KEY_FN_F2] = "Fn+F2", |
| 716 | [KEY_FN_F3] = "Fn+F3", [KEY_FN_F4] = "Fn+F4", |
| 717 | [KEY_FN_F5] = "Fn+F5", [KEY_FN_F6] = "Fn+F6", |
| 718 | [KEY_FN_F7] = "Fn+F7", [KEY_FN_F8] = "Fn+F8", |
| 719 | [KEY_FN_F9] = "Fn+F9", [KEY_FN_F10] = "Fn+F10", |
| 720 | [KEY_FN_F11] = "Fn+F11", [KEY_FN_F12] = "Fn+F12", |
| 721 | [KEY_KBDILLUMTOGGLE] = "KbdIlluminationToggle", |
| 722 | [KEY_KBDILLUMDOWN] = "KbdIlluminationDown", |
| 723 | [KEY_KBDILLUMUP] = "KbdIlluminationUp", |
| 724 | [KEY_SWITCHVIDEOMODE] = "SwitchVideoMode", |
| 725 | }; |
| 726 | |
Joe Perches | 0ce1ac3 | 2007-09-26 16:29:53 +0200 | [diff] [blame] | 727 | static const char *relatives[REL_MAX + 1] = { |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 728 | [REL_X] = "X", [REL_Y] = "Y", |
| 729 | [REL_Z] = "Z", [REL_RX] = "Rx", |
| 730 | [REL_RY] = "Ry", [REL_RZ] = "Rz", |
| 731 | [REL_HWHEEL] = "HWheel", [REL_DIAL] = "Dial", |
| 732 | [REL_WHEEL] = "Wheel", [REL_MISC] = "Misc", |
| 733 | }; |
| 734 | |
Joe Perches | 0ce1ac3 | 2007-09-26 16:29:53 +0200 | [diff] [blame] | 735 | static const char *absolutes[ABS_MAX + 1] = { |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 736 | [ABS_X] = "X", [ABS_Y] = "Y", |
| 737 | [ABS_Z] = "Z", [ABS_RX] = "Rx", |
| 738 | [ABS_RY] = "Ry", [ABS_RZ] = "Rz", |
| 739 | [ABS_THROTTLE] = "Throttle", [ABS_RUDDER] = "Rudder", |
| 740 | [ABS_WHEEL] = "Wheel", [ABS_GAS] = "Gas", |
| 741 | [ABS_BRAKE] = "Brake", [ABS_HAT0X] = "Hat0X", |
| 742 | [ABS_HAT0Y] = "Hat0Y", [ABS_HAT1X] = "Hat1X", |
| 743 | [ABS_HAT1Y] = "Hat1Y", [ABS_HAT2X] = "Hat2X", |
| 744 | [ABS_HAT2Y] = "Hat2Y", [ABS_HAT3X] = "Hat3X", |
| 745 | [ABS_HAT3Y] = "Hat 3Y", [ABS_PRESSURE] = "Pressure", |
| 746 | [ABS_DISTANCE] = "Distance", [ABS_TILT_X] = "XTilt", |
Stephane Chatty | 89f536c | 2009-05-20 15:41:24 +0200 | [diff] [blame] | 747 | [ABS_TILT_Y] = "YTilt", [ABS_TOOL_WIDTH] = "ToolWidth", |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 748 | [ABS_VOLUME] = "Volume", [ABS_MISC] = "Misc", |
Stephane Chatty | 89f536c | 2009-05-20 15:41:24 +0200 | [diff] [blame] | 749 | [ABS_MT_TOUCH_MAJOR] = "MTMajor", |
| 750 | [ABS_MT_TOUCH_MINOR] = "MTMinor", |
| 751 | [ABS_MT_WIDTH_MAJOR] = "MTMajorW", |
| 752 | [ABS_MT_WIDTH_MINOR] = "MTMinorW", |
| 753 | [ABS_MT_ORIENTATION] = "MTOrientation", |
| 754 | [ABS_MT_POSITION_X] = "MTPositionX", |
| 755 | [ABS_MT_POSITION_Y] = "MTPositionY", |
| 756 | [ABS_MT_TOOL_TYPE] = "MTToolType", |
| 757 | [ABS_MT_BLOB_ID] = "MTBlobID", |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 758 | }; |
| 759 | |
Joe Perches | 0ce1ac3 | 2007-09-26 16:29:53 +0200 | [diff] [blame] | 760 | static const char *misc[MSC_MAX + 1] = { |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 761 | [MSC_SERIAL] = "Serial", [MSC_PULSELED] = "Pulseled", |
| 762 | [MSC_GESTURE] = "Gesture", [MSC_RAW] = "RawData" |
| 763 | }; |
| 764 | |
Joe Perches | 0ce1ac3 | 2007-09-26 16:29:53 +0200 | [diff] [blame] | 765 | static const char *leds[LED_MAX + 1] = { |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 766 | [LED_NUML] = "NumLock", [LED_CAPSL] = "CapsLock", |
| 767 | [LED_SCROLLL] = "ScrollLock", [LED_COMPOSE] = "Compose", |
| 768 | [LED_KANA] = "Kana", [LED_SLEEP] = "Sleep", |
| 769 | [LED_SUSPEND] = "Suspend", [LED_MUTE] = "Mute", |
| 770 | [LED_MISC] = "Misc", |
| 771 | }; |
| 772 | |
Joe Perches | 0ce1ac3 | 2007-09-26 16:29:53 +0200 | [diff] [blame] | 773 | static const char *repeats[REP_MAX + 1] = { |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 774 | [REP_DELAY] = "Delay", [REP_PERIOD] = "Period" |
| 775 | }; |
| 776 | |
Joe Perches | 0ce1ac3 | 2007-09-26 16:29:53 +0200 | [diff] [blame] | 777 | static const char *sounds[SND_MAX + 1] = { |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 778 | [SND_CLICK] = "Click", [SND_BELL] = "Bell", |
| 779 | [SND_TONE] = "Tone" |
| 780 | }; |
| 781 | |
Joe Perches | 0ce1ac3 | 2007-09-26 16:29:53 +0200 | [diff] [blame] | 782 | static const char **names[EV_MAX + 1] = { |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 783 | [EV_SYN] = syncs, [EV_KEY] = keys, |
| 784 | [EV_REL] = relatives, [EV_ABS] = absolutes, |
| 785 | [EV_MSC] = misc, [EV_LED] = leds, |
| 786 | [EV_SND] = sounds, [EV_REP] = repeats, |
| 787 | }; |
| 788 | |
| 789 | void hid_resolv_event(__u8 type, __u16 code) { |
| 790 | |
Jiri Kosina | 58037eb | 2007-05-30 15:07:13 +0200 | [diff] [blame] | 791 | if (!hid_debug) |
| 792 | return; |
| 793 | |
Jiri Kosina | c080d89 | 2007-01-25 11:43:31 +0100 | [diff] [blame] | 794 | printk("%s.%s", events[type] ? events[type] : "?", |
| 795 | names[type] ? (names[type][code] ? names[type][code] : "?") : "?"); |
| 796 | } |
| 797 | EXPORT_SYMBOL_GPL(hid_resolv_event); |