Skip to content

Getting Android Device Attributes

Doug Nelson edited this page Nov 21, 2023 · 1 revision

Getting Device Input Details

In order to discover the best and fastest way for Home Assistant to communicate with an android device, we can send a simple adb command to the device and examine the output.

adb shell dumpsys input

It is possible to execute this command through the Home Assistant UI in just a few steps:

  1. Open Developer Tools
  2. Click the SERVICES Tab
  3. Select Android Debug Bridge: ADB command service
  4. Choose your device by clicking on the Choose Entity button
  5. Enter adb shell dumpsys input into the command field
  6. Click the CALL SERVICE button

image

  1. Click over to the Developer Tools STATES tab
  2. Scroll down until you find the entity that you sent the command to in step 4. To help find your entity faster, you can try typing its name into the Filter Entities field
  3. The contents of the Attributes field contains your device's response to the ADB command. If you are running this command as someone's request, you will want to copy the entire contents on this field. It will be lengthy, and will require you to scroll down.

image

Using this example, if I needed to post this data into a issue or a comment thread, this is what it would look like:

source_list: com.amazon.tv.inputpreference.service
app_id: com.amazon.tv.inputpreference.service
source: com.amazon.tv.inputpreference.service
adb_response: INPUT MANAGER (dumpsys input)

Input Manager State:
  Interactive: true
  System UI Visibility: 0x0
  Pointer Speed: 0
  Pointer Gestures Enabled: true
  Show Touches: false
  Pointer Capture Enabled: false

Event Hub State:
  BuiltInKeyboardId: -2
  Devices:
    -1: Virtual
      Classes: 0x40000023
      Path: <virtual>
      Enabled: true
      Descriptor: a718a782d34bc767f4689c232d64d527998ea7fd:00000000
      Location: 
      ControllerNumber: 0
      UniqueId: <virtual>
      Identifier: bus=0x0000, vendor=0x0000, product=0x0000, version=0x0000
      KeyLayoutFile: /system/usr/keylayout/Generic.kl
      KeyCharacterMapFile: /system/usr/keychars/Virtual.kcm
      ConfigurationFile: 
      HaveKeyboardLayoutOverlay: false
    1: MStar Smart TV IR Receiver
      Classes: 0x80000021
      Path: /dev/input/event0
      Enabled: true
      Descriptor: 0e50bdc18d3ae0b6f247100cbd99062d93c208eb:36970001
      Location: /dev/ir
      ControllerNumber: 0
      UniqueId: 
      Identifier: bus=0x0018, vendor=0x3697, product=0x0001, version=0x0001
      KeyLayoutFile: /vendor/usr/keylayout/Vendor_3697_Product_0001.kl
      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm
      ConfigurationFile: /vendor/usr/idc/Vendor_3697_Product_0001.idc
      HaveKeyboardLayoutOverlay: false
    2: MTK TV KEYPAD
      Classes: 0x00000001
      Path: /dev/input/event1
      Enabled: true
      Descriptor: 8f43d929a9472e8dc54d48a6c41e2435e8eaff35:36970002
      Location: 
      ControllerNumber: 0
      UniqueId: 
      Identifier: bus=0x0019, vendor=0x3697, product=0x0002, version=0x0002
      KeyLayoutFile: /vendor/usr/keylayout/Vendor_3697_Product_0002.kl
      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm
      ConfigurationFile: 
      HaveKeyboardLayoutOverlay: false
    3: amazon_touch
      Classes: 0x00000014
      Path: /dev/input/event2
      Enabled: true
      Descriptor: 185733e0df071e21edd860dd6224a1f9f378c689:00000000
      Location: 
      ControllerNumber: 0
      UniqueId: 
      Identifier: bus=0x0005, vendor=0x0000, product=0x0000, version=0x0008
      KeyLayoutFile: 
      KeyCharacterMapFile: 
      ConfigurationFile: /system/usr/idc/amazon_touch.idc
      HaveKeyboardLayoutOverlay: false
    4: kcmouse
      Classes: 0x80000008
      Path: /dev/input/event3
      Enabled: true
      Descriptor: 3b975ed12e4cb4357a995906d1f9c74d8457fd71:00000000
      Location: 
      ControllerNumber: 0
      UniqueId: 
      Identifier: bus=0x0005, vendor=0x0000, product=0x0000, version=0x0008
      KeyLayoutFile: 
      KeyCharacterMapFile: 
      ConfigurationFile: 
      HaveKeyboardLayoutOverlay: false
    5: amzkeyboard
      Classes: 0x80000023
      Path: /dev/input/event4
      Enabled: true
      Descriptor: ea16b8e37822378b09336d67566ac23418d207f4:00000000
      Location: 
      ControllerNumber: 0
      UniqueId: 
      Identifier: bus=0x0005, vendor=0x0000, product=0x0000, version=0x0008
      KeyLayoutFile: /system/usr/keylayout/amzkeyboard.kl
      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm
      ConfigurationFile: 
      HaveKeyboardLayoutOverlay: false
    12: Amazon Fire TV Remote
      Classes: 0x80000021
      Path: /dev/input/event5
      Enabled: true
      Descriptor: 1f942b8d12ca6e735e32dbe546e140fd612f0221:01710425
      Location: 
      ControllerNumber: 0
      UniqueId: C0:91:B9:9E:65:88
      Identifier: bus=0x0005, vendor=0x0171, product=0x0425, version=0x0037
      KeyLayoutFile: /system/usr/keylayout/Vendor_0171_Product_0425.kl
      KeyCharacterMapFile: /system/usr/keychars/Generic.kcm
      ConfigurationFile: 
      HaveKeyboardLayoutOverlay: false

Input Reader State:
  Device -1: Virtual
    Generation: 2
    IsExternal: false
    HasMic:     false
    Sources: 0x00000301
    KeyboardType: 2
    Keyboard Input Mapper:
      Parameters:
        HasAssociatedDisplay: false
        OrientationAware: false
        HandlesKeyRepeat: false
      KeyboardType: 2
      Orientation: 0
      KeyDowns: 0 keys currently down
      MetaState: 0x0
      DownTime: 0
  Device 1: MStar Smart TV IR Receiver
    Generation: 6
    IsExternal: true
    HasMic:     false
    Sources: 0x00000301
    KeyboardType: 1
    Keyboard Input Mapper:
      Parameters:
        HasAssociatedDisplay: false
        OrientationAware: false
        HandlesKeyRepeat: false
      KeyboardType: 1
      Orientation: 0
      KeyDowns: 0 keys currently down
      MetaState: 0x0
      DownTime: 418192145215000
  Device 2: MTK TV KEYPAD
    Generation: 4
    IsExternal: false
    HasMic:     false
    Sources: 0x00000101
    KeyboardType: 1
    Keyboard Input Mapper:
      Parameters:
        HasAssociatedDisplay: false
        OrientationAware: false
        HandlesKeyRepeat: false
      KeyboardType: 1
      Orientation: 0
      KeyDowns: 0 keys currently down
      MetaState: 0x0
      DownTime: 0
  Device 3: amazon_touch
    Generation: 11
    IsExternal: false
    HasMic:     false
    Sources: 0x00001002
    KeyboardType: 0
    Motion Ranges:
      X: source=0x00001002, min=0.000, max=1919.000, flat=0.000, fuzz=0.000, resolution=0.000
      Y: source=0x00001002, min=0.000, max=1079.000, flat=0.000, fuzz=0.000, resolution=0.000
      PRESSURE: source=0x00001002, min=0.000, max=1.000, flat=0.000, fuzz=0.000, resolution=0.000
    Touch Input Mapper (mode - direct):
      Parameters:
        GestureMode: multi-touch
        DeviceType: touchScreen
        AssociatedDisplay: hasAssociatedDisplay=true, isExternal=false, displayId=''
        OrientationAware: true
      Raw Touch Axes:
        X: min=0, max=1919, flat=0, fuzz=0, resolution=0
        Y: min=0, max=1079, flat=0, fuzz=0, resolution=0
        Pressure: unknown range
        TouchMajor: unknown range
        TouchMinor: unknown range
        ToolMajor: unknown range
        ToolMinor: unknown range
        Orientation: unknown range
        Distance: unknown range
        TiltX: unknown range
        TiltY: unknown range
        TrackingId: unknown range
        Slot: unknown range
      Calibration:
        touch.size.calibration: none
        touch.size.scale: 40.000
        touch.size.bias: 0.000
        touch.size.isSummed: false
        touch.pressure.calibration: none
        touch.pressure.scale: 0.013
        touch.orientation.calibration: none
        touch.distance.calibration: none
        touch.coverage.calibration: none
      Affine Transformation:
        X scale: 1.000
        X ymix: 0.000
        X offset: 0.000
        Y xmix: 0.000
        Y scale: 1.000
        Y offset: 0.000
      Viewport: displayId=0, orientation=0, logicalFrame=[0, 0, 1920, 1080], physicalFrame=[0, 0, 3840, 2160], deviceSize=[3840, 2160]
      SurfaceWidth: 1920px
      SurfaceHeight: 1080px
      SurfaceLeft: 0
      SurfaceTop: 0
      SurfaceOrientation: 0
      Translation and Scaling Factors:
        XTranslate: 0.000
        YTranslate: 0.000
        XScale: 1.000
        YScale: 1.000
        XPrecision: 1.000
        YPrecision: 1.000
        GeometricScale: 1.000
        PressureScale: 0.000
        SizeScale: 0.000
        OrientationScale: 0.000
        DistanceScale: 0.000
        HaveTilt: false
        TiltXCenter: 0.000
        TiltXScale: 0.000
        TiltYCenter: 0.000
        TiltYScale: 0.000
      Last Raw Button State: 0x00000000
      Last Raw Touch: pointerCount=0
      Last Cooked Button State: 0x00000000
      Last Cooked Touch: pointerCount=0
      Stylus Fusion:
        ExternalStylusConnected: false
        External Stylus ID: -1
        External Stylus Data Timeout: 9223372036854775807
      External Stylus State:
        When: 9223372036854775807
        Pressure: 0.000000
        Button State: 0x00000000
        Tool Type: 0
  Device 4: kcmouse
    Generation: 71
    IsExternal: true
    HasMic:     false
    Sources: 0x00002002
    KeyboardType: 0
    Motion Ranges:
      X: source=0x00002002, min=0.000, max=1919.000, flat=0.000, fuzz=0.000, resolution=0.000
      Y: source=0x00002002, min=0.000, max=1079.000, flat=0.000, fuzz=0.000, resolution=0.000
      PRESSURE: source=0x00002002, min=0.000, max=1.000, flat=0.000, fuzz=0.000, resolution=0.000
      VSCROLL: source=0x00002002, min=-1.000, max=1.000, flat=0.000, fuzz=0.000, resolution=0.000
    Cursor Input Mapper:
      Parameters:
        HasAssociatedDisplay: true
        Mode: pointer
        OrientationAware: false
      XScale: 1.000
      YScale: 1.000
      XPrecision: 1.000
      YPrecision: 1.000
      HaveVWheel: true
      HaveHWheel: false
      VWheelScale: 1.000
      HWheelScale: 1.000
      Orientation: 0
      ButtonState: 0x00000000
      Down: false
      DownTime: 0
  Device 5: amzkeyboard
    Generation: 18
    IsExternal: true
    HasMic:     false
    Sources: 0x00000301
    KeyboardType: 2
    Keyboard Input Mapper:
      Parameters:
        HasAssociatedDisplay: false
        OrientationAware: false
        HandlesKeyRepeat: false
      KeyboardType: 2
      Orientation: 0
      KeyDowns: 0 keys currently down
      MetaState: 0x0
      DownTime: 0
  Device 12: Amazon Fire TV Remote
    Generation: 68
    IsExternal: true
    HasMic:     false
    Sources: 0x00000301
    KeyboardType: 1
    Keyboard Input Mapper:
      Parameters:
        HasAssociatedDisplay: false
        OrientationAware: false
        HandlesKeyRepeat: false
      KeyboardType: 1
      Orientation: 0
      KeyDowns: 0 keys currently down
      MetaState: 0x0
      DownTime: 426350310556000
  Configuration:
    ExcludedDeviceNames: []
    VirtualKeyQuietTime: 0.0ms
    PointerVelocityControlParameters: scale=1.000, lowThreshold=500.000, highThreshold=3000.000, acceleration=3.000
    WheelVelocityControlParameters: scale=1.000, lowThreshold=15.000, highThreshold=50.000, acceleration=4.000
    PointerGesture:
      Enabled: true
      QuietInterval: 100.0ms
      DragMinSwitchSpeed: 50.0px/s
      TapInterval: 150.0ms
      TapDragInterval: 300.0ms
      TapSlop: 20.0px
      MultitouchSettleInterval: 100.0ms
      MultitouchMinDistance: 15.0px
      SwipeTransitionAngleCosine: 0.3
      SwipeMaxWidthRatio: 0.2
      MovementSpeedRatio: 0.8
      ZoomSpeedRatio: 0.3
      Viewports:
        ViewportInternal:
          Viewport: displayId=0, orientation=0, uniqueId='', logicalFrame=[0, 0, 1920, 1080], physicalFrame=[0, 0, 3840, 2160], deviceSize=[3840, 2160]
        ViewportExternal:
          Viewport: displayId=0, orientation=0, uniqueId='', logicalFrame=[0, 0, 1920, 1080], physicalFrame=[0, 0, 3840, 2160], deviceSize=[3840, 2160]
        ViewportVirtual:

Input Dispatcher State:
  DispatchEnabled: 1
  DispatchFrozen: 0
  FocusedApplication: name='AppWindowToken{787dbbd token=Token{d5cd714 ActivityRecord{fbdd67 u0 com.amazon.tv.inputpreference.service/com.amazon.tv.inputpreference.player.PassthroughPlayerActivity t2221}}}', dispatchingTimeout=5000.000ms
  FocusedWindow: name='Window{7c1fc9d u0 com.amazon.tv.inputpreference.service/com.amazon.tv.inputpreference.player.PassthroughPlayerActivity}'
  TouchStates: <no displays touched>
  Windows:
    0: name='Window{b09f4d8 u0 com.amazon.vizzini}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x01400108, type=0x000007da, layer=0, frame=[0,0][1920,1080], scale=1.000000, touchableRegion=[0,0][1920,1080], inputFeatures=0x00000000, ownerPid=4769, ownerUid=10108, dispatchingTimeout=5000.000ms
    1: name='Window{5f8e1b6 u0 com.amazon.vizzini}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x01400100, type=0x000007da, layer=0, frame=[0,0][1920,1080], scale=1.000000, touchableRegion=[0,0][1920,1080], inputFeatures=0x00000000, ownerPid=4769, ownerUid=10108, dispatchingTimeout=5000.000ms
    2: name='Window{f9a3ed2 u0 de.cyberdream.firenotifications.amazon}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=true, canReceiveKeys=false, flags=0x01040228, type=0x000007f6, layer=0, frame=[1300,700][1301,701], scale=1.000000, touchableRegion=[1300,700][1301,701], inputFeatures=0x00000000, ownerPid=13572, ownerUid=10123, dispatchingTimeout=5000.000ms
    3: name='Window{7c1fc9d u0 com.amazon.tv.inputpreference.service/com.amazon.tv.inputpreference.player.PassthroughPlayerActivity}', displayId=0, paused=false, hasFocus=true, hasWallpaper=false, visible=true, canReceiveKeys=true, flags=0x838101a0, type=0x00000001, layer=0, frame=[0,0][1920,1080], scale=1.000000, touchableRegion=[0,0][1920,1080], inputFeatures=0x00000000, ownerPid=5020, ownerUid=10093, dispatchingTimeout=5000.000ms
    4: name='Window{bddd443 u0 com.amazon.tv.launcher/com.amazon.tv.launcher.ui.HomeActivity_vNext}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x83810120, type=0x00000001, layer=0, frame=[0,0][1920,1080], scale=1.000000, touchableRegion=[0,0][1920,1080], inputFeatures=0x00000000, ownerPid=4895, ownerUid=10041, dispatchingTimeout=5000.000ms
    5: name='Window{bb4f173 u0 net.cme.voyo.cz.tvapp/net.cme.voyo.cz.tvapp.MainActivity}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x81810920, type=0x00000001, layer=0, frame=[0,0][1920,1080], scale=1.000000, touchableRegion=[0,0][1920,1080], inputFeatures=0x00000000, ownerPid=28176, ownerUid=10242, dispatchingTimeout=5000.000ms
    6: name='Window{ea5c495 u0 com.esaba.downloader/com.esaba.downloader.MainActivity}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x81810120, type=0x00000001, layer=0, frame=[0,0][1920,1080], scale=1.000000, touchableRegion=[0,0][1920,1080], inputFeatures=0x00000000, ownerPid=25420, ownerUid=10254, dispatchingTimeout=5000.000ms
    7: name='Window{2b38dbe u0 com.amazon.tv.inputpreference.service/com.amazon.tv.inputpreference.inputtab.InputTabActivity}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x83810120, type=0x00000001, layer=0, frame=[0,0][1920,1080], scale=1.000000, touchableRegion=[0,0][1920,1080], inputFeatures=0x00000000, ownerPid=5020, ownerUid=10093, dispatchingTimeout=5000.000ms
    8: name='Window{52e762f u0 com.amazon.firetv.youtube/dev.cobalt.app.MainActivity}', displayId=0, paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x81810120, type=0x00000001, layer=0, frame=[0,0][1920,1080], scale=1.000000, touchableRegion=[0,0][1920,1080], inputFeatures=0x00000000, ownerPid=8476, ownerUid=10202, dispatchingTimeout=5000.000ms
  MonitoringChannels:
    0: 'WindowManager (server)'
  RecentQueue: length=10
    KeyEvent, age=5863055.5ms
    KeyEvent, age=5863055.0ms
    KeyEvent, age=5798993.5ms
    KeyEvent, age=5798993.5ms
    KeyEvent, age=5719051.5ms
    KeyEvent, age=5719051.0ms
    KeyEvent, age=5643429.0ms
    KeyEvent, age=5643428.5ms
    KeyEvent, age=3803777.2ms
    KeyEvent, age=3803777.0ms
  PendingEvent: <none>
  InboundQueue: <empty>
  ReplacedKeys: <empty>
  Connections:
    0: channelName='WindowManager (server)', windowName='monitor', status=NORMAL, monitor=true, inputPublisherBlocked=false
      OutboundQueue: <empty>
      WaitQueue: <empty>
    1: channelName='2b38dbe com.amazon.tv.inputpreference.service/com.amazon.tv.inputpreference.inputtab.InputTabActivity (server)', windowName='Window{2b38dbe u0 com.amazon.tv.inputpreference.service/com.amazon.tv.inputpreference.inputtab.InputTabActivity}', status=NORMAL, monitor=false, inputPublisherBlocked=false
      OutboundQueue: <empty>
      WaitQueue: <empty>
    2: channelName='f9a3ed2 de.cyberdream.firenotifications.amazon (server)', windowName='Window{f9a3ed2 u0 de.cyberdream.firenotifications.amazon}', status=NORMAL, monitor=false, inputPublisherBlocked=false
      OutboundQueue: <empty>
      WaitQueue: <empty>
    3: channelName='ea5c495 com.esaba.downloader/com.esaba.downloader.MainActivity (server)', windowName='Window{ea5c495 u0 com.esaba.downloader/com.esaba.downloader.MainActivity}', status=NORMAL, monitor=false, inputPublisherBlocked=false
      OutboundQueue: <empty>
      WaitQueue: <empty>
    4: channelName='bb4f173 net.cme.voyo.cz.tvapp/net.cme.voyo.cz.tvapp.MainActivity (server)', windowName='Window{bb4f173 u0 net.cme.voyo.cz.tvapp/net.cme.voyo.cz.tvapp.MainActivity}', status=NORMAL, monitor=false, inputPublisherBlocked=false
      OutboundQueue: <empty>
      WaitQueue: <empty>
    5: channelName='7c1fc9d com.amazon.tv.inputpreference.service/com.amazon.tv.inputpreference.player.PassthroughPlayerActivity (server)', windowName='Window{7c1fc9d u0 com.amazon.tv.inputpreference.service/com.amazon.tv.inputpreference.player.PassthroughPlayerActivity}', status=NORMAL, monitor=false, inputPublisherBlocked=false
      OutboundQueue: <empty>
      WaitQueue: <empty>
    6: channelName='bddd443 com.amazon.tv.launcher/com.amazon.tv.launcher.ui.HomeActivity_vNext (server)', windowName='Window{bddd443 u0 com.amazon.tv.launcher/com.amazon.tv.launcher.ui.HomeActivity_vNext}', status=NORMAL, monitor=false, inputPublisherBlocked=false
      OutboundQueue: <empty>
      WaitQueue: <empty>
    7: channelName='5f8e1b6 com.amazon.vizzini (server)', windowName='Window{5f8e1b6 u0 com.amazon.vizzini}', status=NORMAL, monitor=false, inputPublisherBlocked=false
      OutboundQueue: <empty>
      WaitQueue: <empty>
    8: channelName='b09f4d8 com.amazon.vizzini (server)', windowName='Window{b09f4d8 u0 com.amazon.vizzini}', status=NORMAL, monitor=false, inputPublisherBlocked=false
      OutboundQueue: <empty>
      WaitQueue: <empty>
    9: channelName='52e762f com.amazon.firetv.youtube/dev.cobalt.app.MainActivity (server)', windowName='Window{52e762f u0 com.amazon.firetv.youtube/dev.cobalt.app.MainActivity}', status=NORMAL, monitor=false, inputPublisherBlocked=false
      OutboundQueue: <empty>
      WaitQueue: <empty>
  AppSwitch: not pending
  Configuration:
    KeyRepeatDelay: 50.0ms
    KeyRepeatTimeout: 500.0ms
hdmi_input: null
device_class: tv
entity_picture: /api/media_player_proxy/media_player.fire_tv_192_168_107_88?token=6d2fb44ea4c2d007d290dcc766762e5efb93847c33769a7bd675fd08e0a419d9&cache=d16db697757b5dc7
friendly_name: Master Bedroom Fire TV
supported_features: 22961