# Generic Devices -\> Button combinations possible?

**URL:** <https://community.folivora.ai/t/generic-devices-button-combinations-possible/30088>\
**Category:** Configuration Help & General Discussion\
**Tags:** help, generic-devices\
**Created:** [January 31, 2023, 12:15pm UTC](https://community.folivora.ai/t/generic-devices-button-combinations-possible/30088 "2023-01-31T12:15:39Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![jnb](https://community.folivora.ai/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@jnb](https://community.folivora.ai/u/jnb)\
**Post date:** [January 31, 2023, 12:15pm UTC](https://community.folivora.ai/t/generic-devices-button-combinations-possible/30088/1 "2023-01-31T12:15:39Z")

</div>

I love this new feature! Very cool idea to implement it this way 👏🏻

I got my PS4 Controller to work. I just had to uncheck 'Report' in the 'parse device' window the first time I used it. Now it works with 'Report' being checked.

When I press two buttons while holding the first one, I can see that the numbers are shown correctly. The first pressed button stays on the value for being pressed and the second one also changes.

What do I have to write in the code, to connect these to buttons two set up a combined Trigger?

Thanks for the great work!

---

<div class="post-metadata">

**Author:** ![Andreas\_Hegenberg](https://community.folivora.ai/user_avatar/community.folivora.ai/andreas_hegenberg/32/39221_2.png) [@Andreas\_Hegenberg](https://community.folivora.ai/u/Andreas_Hegenberg)\
**Post date:** [January 31, 2023, 12:23pm UTC](https://community.folivora.ai/t/generic-devices-button-combinations-possible/30088/2 "2023-01-31T12:23:48Z")

</div>

Can you post the "change log"? First you need to click on the bytes that change, afterwards BTT will generate the log when you trigger the functions.

---

<div class="post-metadata">

**Author:** ![jnb](https://community.folivora.ai/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@jnb](https://community.folivora.ai/u/jnb)\
**Post date:** [January 31, 2023, 12:39pm UTC](https://community.folivora.ai/t/generic-devices-button-combinations-possible/30088/3 "2023-01-31T12:39:04Z")

</div>

Sure, I hope this are the parts you're interested in:

```auto
1675168434.498322|lic|newest date 2021-10-30 12:33:05 +0000|
1675168434.498378|lic|lict 115328943-chre5345849c659-3410887d8e|
1675168434.785582|ASL|deallocating root Window controller|
1675168434.809141|ASL|deallocating BTTPrefsMenuContentContainerVC|
1675168434.809425|ASL|dealloc main ui structure vc|
1675168434.809467|ASL|deallocating BTTMainUIStructureVC|
1675168434.809552|ASL|deallocating BTTMainSplitViewController|
1675168434.810166|ASL|deallocating BTTAppListVC|
1675168434.810495|ASL|deallocating BTTTopMenuVC|
1675168434.811478|ASL|deallocating BTTOutlineModeVC|
1675168434.811747|ASL|deallocating BTTConfigurationVC|
1675168434.818788|ASL|dealloc level1|
1675168434.818829|ASL|deallocating BTTLevel1VC|
1675168434.819242|ASL|deallocating BTTLevel3VC|
1675168434.819579|ASL|deallocating BTTConfigurationVC|
1675168434.839116|NEWUI|DEALLOC Settings Container VC|
1675168438.019928|ASL|result {
    BTTGenericDeviceActiveReports = {
        1 = 1;
    };
    BTTGenericDeviceScript = "// Enter your input analyzer script here. \n// Do not change the function signatures\nfunction analyzeDeviceInput(targetDevice, reportID, reportDataHex) {\n \n\tlet reportBuffer = buffer.Buffer.from(reportDataHex, 'hex');\n // the values you see above are in hex format. To read such a byte\n // use readUInt8(index).\n if(reportBuffer.readUInt8(7) === 0x01) {\n log('Ps');\n bttTriggerDeviceTrigger(targetDevice, 'PsButton');\n }else if(reportBuffer.readUInt8(5) === 0x28) {\n log('X');\n bttTriggerDeviceTrigger(targetDevice, 'Cross');\n }else if(reportBuffer.readUInt8(6) === 0x20) {\n log('Start');\n bttTriggerDeviceTrigger(targetDevice, 'Start');\n }\n}\n\n// Advanced, optional. Use if you want to trigger commands that send data to\n// the device, from a BTT predefined action.\n// See https://docs.folivora.ai/1500_generic_devices.html\nasync function executeBTTCommand(targetDevice, commandName, commandInput) {\n log(\"execute command: \" + commandName)\n switch(commandName) {\n case \"exampleCommand\": {\n // send any hex string to the device\n let deviceResponse = await bttSendDataToDevice({\n BTTActionSendDataTargetDevice: targetDevice,\n BTTActionSendDataData: 'FEEDC0DE',\n BTTActionSendDataReportType: 1,\n BTTActionSendDataResponseType: -1,\n BTTActionSendDataResponsePrefix: ''\n }); \n break;\n }\n }\n return 'done executing ' + commandName\n}";
    BTTGenericDeviceWatchedBytes = {
        1 = (
            7,
            6,
            5
        );
    };
}|
1675168439.953512|NAMED|Close That App|
1675168440.167057|ASL|delay planned: 0.200000 real 0.204275|
1675168440.168142|NAMED|Close That Window|
1675168440.186253|ASL|result {
    BTTGenericDeviceActiveReports = {
        1 = 1;
    };
    BTTGenericDeviceScript = "// Enter your input analyzer script here. \n// Do not change the function signatures\nfunction analyzeDeviceInput(targetDevice, reportID, reportDataHex) {\n \n\tlet reportBuffer = buffer.Buffer.from(reportDataHex, 'hex');\n // the values you see above are in hex format. To read such a byte\n // use readUInt8(index).\n if(reportBuffer.readUInt8(7) === 0x01) {\n log('Ps');\n bttTriggerDeviceTrigger(targetDevice, 'PsButton');\n }else if(reportBuffer.readUInt8(5) === 0x28) {\n log('X');\n bttTriggerDeviceTrigger(targetDevice, 'Cross');\n }else if(reportBuffer.readUInt8(6) === 0x20) {\n log('Start');\n bttTriggerDeviceTrigger(targetDevice, 'Start');\n }\n}\n\n// Advanced, optional. Use if you want to trigger commands that send data to\n// the device, from a BTT predefined action.\n// See https://docs.folivora.ai/1500_generic_devices.html\nasync function executeBTTCommand(targetDevice, commandName, commandInput) {\n log(\"execute command: \" + commandName)\n switch(commandName) {\n case \"exampleCommand\": {\n // send any hex string to the device\n let deviceResponse = await bttSendDataToDevice({\n BTTActionSendDataTargetDevice: targetDevice,\n BTTActionSendDataData: 'FEEDC0DE',\n BTTActionSendDataReportType: 1,\n BTTActionSendDataResponseType: -1,\n BTTActionSendDataResponsePrefix: ''\n }); \n break;\n }\n }\n return 'done executing ' + commandName\n}";
    BTTGenericDeviceWatchedBytes = {
        1 = (
            7,
            6,
            5
        );
    };
}|
1675168440.186471|ASL|result {
    BTTGenericDeviceActiveReports = {
        1 = 1;
    };
    BTTGenericDeviceScript = "// Enter your input analyzer script here. \n// Do not change the function signatures\nfunction analyzeDeviceInput(targetDevice, reportID, reportDataHex) {\n \n\tlet reportBuffer = buffer.Buffer.from(reportDataHex, 'hex');\n // the values you see above are in hex format. To read such a byte\n // use readUInt8(index).\n if(reportBuffer.readUInt8(7) === 0x01) {\n log('Ps');\n bttTriggerDeviceTrigger(targetDevice, 'PsButton');\n }else if(reportBuffer.readUInt8(5) === 0x28) {\n log('X');\n bttTriggerDeviceTrigger(targetDevice, 'Cross');\n }else if(reportBuffer.readUInt8(6) === 0x20) {\n log('Start');\n bttTriggerDeviceTrigger(targetDevice, 'Start');\n }\n}\n\n// Advanced, optional. Use if you want to trigger commands that send data to\n// the device, from a BTT predefined action.\n// See https://docs.folivora.ai/1500_generic_devices.html\nasync function executeBTTCommand(targetDevice, commandName, commandInput) {\n log(\"execute command: \" + commandName)\n switch(commandName) {\n case \"exampleCommand\": {\n // send any hex string to the device\n let deviceResponse = await bttSendDataToDevice({\n BTTActionSendDataTargetDevice: targetDevice,\n BTTActionSendDataData: 'FEEDC0DE',\n BTTActionSendDataReportType: 1,\n BTTActionSendDataResponseType: -1,\n BTTActionSendDataResponsePrefix: ''\n }); \n break;\n }\n }\n return 'done executing ' + commandName\n}";
    BTTGenericDeviceWatchedBytes = {
        1 = (
            7,
            6,
            5
        );
    };
}|
1675168441.836276|NAMED|Close That App|
1675168442.054860|ASL|delay planned: 0.200000 real 0.209458|
1675168442.056121|NAMED|Close That Window|
1675168442.071095|ASL|dealloc bridge|
1675168448.629125|lic|newest date 2021-10-30 12:33:05 +0000|
1675168448.629140|lic|lict 115328943-chre5345849c659-3410887d8e|
1675168454.745948|TERMINATE|SHOULDTERMINATE|

```

---

<div class="post-metadata">

**Author:** ![Andreas\_Hegenberg](https://community.folivora.ai/user_avatar/community.folivora.ai/andreas_hegenberg/32/39221_2.png) [@Andreas\_Hegenberg](https://community.folivora.ai/u/Andreas_Hegenberg)\
**Post date:** [January 31, 2023, 12:40pm UTC](https://community.folivora.ai/t/generic-devices-button-combinations-possible/30088/4 "2023-01-31T12:40:59Z")

</div>

Ah sorry I meant what is listed here under "History of Monitored Changes"

 ![image](https://community.folivora.ai/uploads/default/original/3X/6/0/60cdcdeea62fac4b1983c585cefc9dcd7c12616b.jpeg)

---

<div class="post-metadata">

**Author:** ![jnb](https://community.folivora.ai/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@jnb](https://community.folivora.ai/u/jnb)\
**Post date:** [January 31, 2023, 12:41pm UTC](https://community.folivora.ai/t/generic-devices-button-combinations-possible/30088/5 "2023-01-31T12:41:08Z")

</div>

Also here is a screenshot. The history shows 4 events. The Log only three.  
The 4 events are obviously

1. Press Ps
2. Press Cross
3. Release Cross
4. Release Ps

 ![Bildschirm­foto 2023-01-31 um 13.32.46](https://community.folivora.ai/uploads/default/original/3X/9/4/94928337931443daaa9970ff567eb977e8199ee9.jpeg)

---

<div class="post-metadata">

**Author:** ![Andreas\_Hegenberg](https://community.folivora.ai/user_avatar/community.folivora.ai/andreas_hegenberg/32/39221_2.png) [@Andreas\_Hegenberg](https://community.folivora.ai/u/Andreas_Hegenberg)\
**Post date:** [January 31, 2023, 12:43pm UTC](https://community.folivora.ai/t/generic-devices-button-combinations-possible/30088/6 "2023-01-31T12:43:22Z")

</div>

In that case to trigger when both are pressed at the same time you can do this:

```auto
function analyzeDeviceInput(targetDevice, reportID, reportDataHex) {
      
	let reportBuffer = buffer.Buffer.from(reportDataHex, 'hex');
        // the values you see above are in hex format. To read such a byte
        // use readUInt8(index).
        if(reportBuffer.readUInt8(5) === 0x28 && reportBuffer.readUInt8(7) === 0x01 ) {
            log('trigger!');
            bttTriggerDeviceTrigger(targetDevice, 'psAndCrossAtTheSameTime');
        }
}

```

It should be the first condition in your if

---

<div class="post-metadata">

**Author:** ![jnb](https://community.folivora.ai/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@jnb](https://community.folivora.ai/u/jnb)\
**Post date:** [January 31, 2023, 1:29pm UTC](https://community.folivora.ai/t/generic-devices-button-combinations-possible/30088/7 "2023-01-31T13:29:39Z")

</div>

That worked!  
Thank you 🔥

Can I ask for one more thing?!  
As soon as I open an app which utilizes the Gamepad, it stops working.  
If I check 'Try to get exclusive access to device' it keeps working.  
But then I can't control the games. They don't get any input.

I guess I have to set up every button in BTT and loop them trough.  
Like 'Press X' lets BTT send the original command for this button.  
How do i do that? What do I have to choose as an Action?

---

<div class="post-metadata">

**Author:** ![Andreas\_Hegenberg](https://community.folivora.ai/user_avatar/community.folivora.ai/andreas_hegenberg/32/39221_2.png) [@Andreas\_Hegenberg](https://community.folivora.ai/u/Andreas_Hegenberg)\
**Post date:** [January 31, 2023, 1:35pm UTC](https://community.folivora.ai/t/generic-devices-button-combinations-possible/30088/8 "2023-01-31T13:35:09Z")

</div>

I don't think that's possible. However I could make it possible to activate the Generic Device only for specific apps (or disable for specific ones). That's currently not possible but should be easy to add for the next version

---

<div class="post-metadata">

**Author:** ![jnb](https://community.folivora.ai/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@jnb](https://community.folivora.ai/u/jnb)\
**Post date:** [January 31, 2023, 1:39pm UTC](https://community.folivora.ai/t/generic-devices-button-combinations-possible/30088/9 "2023-01-31T13:39:15Z")

</div>

Good to know. Thanks, I will play around with the amazing features you gave us so far!  
Would be great though, if this could be a Feature in the future. This is a must have for every gamer 😄

---

<div class="post-metadata">

**Author:** ![Andreas\_Hegenberg](https://community.folivora.ai/user_avatar/community.folivora.ai/andreas_hegenberg/32/39221_2.png) [@Andreas\_Hegenberg](https://community.folivora.ai/u/Andreas_Hegenberg)\
**Post date:** [January 31, 2023, 2:22pm UTC](https://community.folivora.ai/t/generic-devices-button-combinations-possible/30088/10 "2023-01-31T14:22:53Z")

</div>

In v4.004 you can now create a conditional activation group and add the generic device analyzer to that.

For the activation group you can then specify where it should work/not work

 ![image](https://community.folivora.ai/uploads/default/original/3X/2/6/26b22ca39e9b41f762f6ce313c738149df04e24a.jpeg)

 ![image](https://community.folivora.ai/uploads/default/original/3X/4/7/47b5513923455bc8556eae437bec5b195a6684a3.jpeg)

---

<div class="post-metadata">

**Author:** ![jnb](https://community.folivora.ai/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@jnb](https://community.folivora.ai/u/jnb)\
**Post date:** [January 31, 2023, 4:00pm UTC](https://community.folivora.ai/t/generic-devices-button-combinations-possible/30088/11 "2023-01-31T16:00:55Z")

</div>

Nice! Thanks for posting the update!!  
This means I can say that in App X,Y,Z the gamepad works as regular without triggering BTT, right?

Just to be sure, you understood why I asked this:

> I guess I have to set up every button in BTT and loop them trough.  
> Like 'Press X' lets BTT send the original command for this button.  
> How do i do that? What do I have to choose as an Action?

I want to control the games with the gamepad, but make hotkeys with BTT.  
F.e. I play some old games with the Dolphin Emulator. I control the game as is, but as soon as I hit a combination of two specific button, I want BTT to make an action. Could be quit the App with CMD+Q or anything else, what is not game-related.

This would be great for other apps like Steam or [Battle.net](http://Battle.net). Cause we could extend the functionality of the gamepad a lot. Without waiting for the companies to implement something like that by their own 😄  
or switching to a keyboard/mouse

---

<div class="post-metadata">

**Author:** ![Andreas\_Hegenberg](https://community.folivora.ai/user_avatar/community.folivora.ai/andreas_hegenberg/32/39221_2.png) [@Andreas\_Hegenberg](https://community.folivora.ai/u/Andreas_Hegenberg)\
**Post date:** [January 31, 2023, 4:07pm UTC](https://community.folivora.ai/t/generic-devices-button-combinations-possible/30088/12 "2023-01-31T16:07:35Z")

</div>

I see! That probably will not work for games that take full control of the controllers. As far as I know there is no way to get events from a device that has been captured by another app.

---

<div class="post-metadata">

**Author:** ![jnb](https://community.folivora.ai/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@jnb](https://community.folivora.ai/u/jnb)\
**Post date:** [January 31, 2023, 5:06pm UTC](https://community.folivora.ai/t/generic-devices-button-combinations-possible/30088/13 "2023-01-31T17:06:00Z")

</div>

Oh ok, that‘s a bummer 😅

As a workaround i was trying to map keyboard keys to the gamepad and use it that way. It works as long as i am not in an app, that tries to use the gamepad.

In the settings of that app(s) i did switch to keyboard controls, but nothing gets through with the gamepad.

Only in apps for playing games. In every other app, f.e. TextEdit, it works. Any idea what could be the reason?

---

<div class="post-metadata">

**Author:** ![buckbuck](https://community.folivora.ai/user_avatar/community.folivora.ai/buckbuck/32/20701_2.png) [@buckbuck](https://community.folivora.ai/u/buckbuck)\
**Post date:** [January 31, 2023, 11:23pm UTC](https://community.folivora.ai/t/generic-devices-button-combinations-possible/30088/14 "2023-01-31T23:23:41Z")

</div>

If you're using steam, you can use their Game Controller mapper to dedicate some keys to send basic keyboard shortcuts (that BTT picks up) while still using the defaults for the other buttons.

That's what I'm using for now, because they have more options for how to customize the joystick inputs. But BTT is really powerful because I can use it to press one button and get mouse drags or timed combos.

 ![ControllerPic](https://community.folivora.ai/uploads/default/original/3X/a/0/a0a2ec95efcf0a0150d8420443abf6d1751ec634.png)

---

<div class="post-metadata">

**Author:** ![jnb](https://community.folivora.ai/letter_avatar_proxy/v4/letter/j/df705f/32.png) [@jnb](https://community.folivora.ai/u/jnb)\
**Post date:** [February 1, 2023, 2:50pm UTC](https://community.folivora.ai/t/generic-devices-button-combinations-possible/30088/15 "2023-02-01T14:50:55Z")

</div>

Thanks @buckbuck for that tipp!  
For the use with Steam this works great

---

<div class="post-metadata">

**Author:** ![buckbuck](https://community.folivora.ai/user_avatar/community.folivora.ai/buckbuck/32/20701_2.png) [@buckbuck](https://community.folivora.ai/u/buckbuck)\
**Post date:** [February 1, 2023, 8:30pm UTC](https://community.folivora.ai/t/generic-devices-button-combinations-possible/30088/16 "2023-02-01T20:30:00Z")

</div>

If you leave steam running in the background, it still gives an outside-of-steam "Desktop Configuration". This can work even if you're running an app outside of Steam. It's a special profile that's not connected to a specific game. It's in the main _Settings; Controller; Desktop Configuration._

I use it to map the joystick controls, assign all the buttons to higher function keys so I can customize them in BTT for different app profiles... and then I use it for desktop use and games outside of steam. I turn off the controller in the other apps.

The only drawback is that Steam has to be open in the background. I'll be happy if I can sort out joystick logic natively to BTT, but hybrid is fine for me for now.
