Checking acpi key bindings and remapping keyboard keypress events to acpi events












0















I got two systems with Ubuntu 18.04.1 installed. The two have similar hardware and software configurations but one of them suspends to SBTN press event whereas the other does nothing. I checked gsettings and both have similar org.gnome.settings-daemon.plugins.power configurations. I want to know the complete key bindings associated with SBTN key event.



How and where can I check for these?



Also, how can I remap a keyboard keypress event(say keycode 127 which is pause/break button) to SBTN button/PWBN button?



How can I map system suspend action to keyboard pause/break button?



PS: I'm using acpi_listen for listening to PWBN and SBTN key events and I'm able to see the key presses. For checking for keyboard events I'm using xinput test. Also, I need to get the system back live using the same keypress after suspend action.










share|improve this question







New contributor




sanadell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    I got two systems with Ubuntu 18.04.1 installed. The two have similar hardware and software configurations but one of them suspends to SBTN press event whereas the other does nothing. I checked gsettings and both have similar org.gnome.settings-daemon.plugins.power configurations. I want to know the complete key bindings associated with SBTN key event.



    How and where can I check for these?



    Also, how can I remap a keyboard keypress event(say keycode 127 which is pause/break button) to SBTN button/PWBN button?



    How can I map system suspend action to keyboard pause/break button?



    PS: I'm using acpi_listen for listening to PWBN and SBTN key events and I'm able to see the key presses. For checking for keyboard events I'm using xinput test. Also, I need to get the system back live using the same keypress after suspend action.










    share|improve this question







    New contributor




    sanadell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I got two systems with Ubuntu 18.04.1 installed. The two have similar hardware and software configurations but one of them suspends to SBTN press event whereas the other does nothing. I checked gsettings and both have similar org.gnome.settings-daemon.plugins.power configurations. I want to know the complete key bindings associated with SBTN key event.



      How and where can I check for these?



      Also, how can I remap a keyboard keypress event(say keycode 127 which is pause/break button) to SBTN button/PWBN button?



      How can I map system suspend action to keyboard pause/break button?



      PS: I'm using acpi_listen for listening to PWBN and SBTN key events and I'm able to see the key presses. For checking for keyboard events I'm using xinput test. Also, I need to get the system back live using the same keypress after suspend action.










      share|improve this question







      New contributor




      sanadell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I got two systems with Ubuntu 18.04.1 installed. The two have similar hardware and software configurations but one of them suspends to SBTN press event whereas the other does nothing. I checked gsettings and both have similar org.gnome.settings-daemon.plugins.power configurations. I want to know the complete key bindings associated with SBTN key event.



      How and where can I check for these?



      Also, how can I remap a keyboard keypress event(say keycode 127 which is pause/break button) to SBTN button/PWBN button?



      How can I map system suspend action to keyboard pause/break button?



      PS: I'm using acpi_listen for listening to PWBN and SBTN key events and I'm able to see the key presses. For checking for keyboard events I'm using xinput test. Also, I need to get the system back live using the same keypress after suspend action.







      keyboard suspend remapping events






      share|improve this question







      New contributor




      sanadell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      sanadell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      sanadell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 3 hours ago









      sanadellsanadell

      11




      11




      New contributor




      sanadell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      sanadell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      sanadell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes


















          0














          First, check if you have acpi service running on the other machine, with sudo systemctl status acpid or sudo service acpid status



          If you do, test systemctl suspend on the other machine that does not respond to the sleep/suspend button press and see if any errors or warnings get printed.



          As far as setting a custom keybinding to Pause/Break key, I would try to bind it to a script that executes systemctl suspend command , as trying to remap sleep/suspend button will require clearing the previous binding for the built-in sleep/suspend key if there is one, if I recall correctly. In other words, make a script suspendme.sh.



          touch suspendme.sh
          nano suspendme.sh


          inside the suspendme.sh script:



          #!/bin/bash
          systemctl suspend



          chown u+x suspendme.sh
          mv suspendme.sh /usr/local/bin/


          And then you can just use "System Settings" > "Keyboard" > "Shortcuts" > "Custom Shortcuts" in both Gnome and Unity to set the shortcut. Just click on + and for the command to execute with the Pause key use suspendme.sh as it is in /usr/local/bin and will be part of the path.






          share|improve this answer
























          • How does the system wakeup? Will it search for script again when I press the sleep button when its in suspended state? I’m asking this since currently the system doesn’t respond to normal keyboard key button presses when suspended. It’s the bug I’m actually looking to circumvent.

            – sanadell
            2 hours ago













          • check grep . /sys/bus/usb/devices/*/power/wakeup and change the listen to wake up with echo enabled > /sys/bus/usb/devices/usb1/power/wakeup change usb1 to the the path of your keyboard.

            – BarBar1234
            2 hours ago











          • Once you find the correct usb path of your keyboard and successfully test it, make sure you make it permanent, by pasting the echo enabled > [sys bus path to keyboard] into /etc/rc.local. You will likely need to sudo, so sudo nano /etc/rc.local and paste it there.

            – BarBar1234
            2 hours ago











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          sanadell is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1122391%2fchecking-acpi-key-bindings-and-remapping-keyboard-keypress-events-to-acpi-events%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          First, check if you have acpi service running on the other machine, with sudo systemctl status acpid or sudo service acpid status



          If you do, test systemctl suspend on the other machine that does not respond to the sleep/suspend button press and see if any errors or warnings get printed.



          As far as setting a custom keybinding to Pause/Break key, I would try to bind it to a script that executes systemctl suspend command , as trying to remap sleep/suspend button will require clearing the previous binding for the built-in sleep/suspend key if there is one, if I recall correctly. In other words, make a script suspendme.sh.



          touch suspendme.sh
          nano suspendme.sh


          inside the suspendme.sh script:



          #!/bin/bash
          systemctl suspend



          chown u+x suspendme.sh
          mv suspendme.sh /usr/local/bin/


          And then you can just use "System Settings" > "Keyboard" > "Shortcuts" > "Custom Shortcuts" in both Gnome and Unity to set the shortcut. Just click on + and for the command to execute with the Pause key use suspendme.sh as it is in /usr/local/bin and will be part of the path.






          share|improve this answer
























          • How does the system wakeup? Will it search for script again when I press the sleep button when its in suspended state? I’m asking this since currently the system doesn’t respond to normal keyboard key button presses when suspended. It’s the bug I’m actually looking to circumvent.

            – sanadell
            2 hours ago













          • check grep . /sys/bus/usb/devices/*/power/wakeup and change the listen to wake up with echo enabled > /sys/bus/usb/devices/usb1/power/wakeup change usb1 to the the path of your keyboard.

            – BarBar1234
            2 hours ago











          • Once you find the correct usb path of your keyboard and successfully test it, make sure you make it permanent, by pasting the echo enabled > [sys bus path to keyboard] into /etc/rc.local. You will likely need to sudo, so sudo nano /etc/rc.local and paste it there.

            – BarBar1234
            2 hours ago
















          0














          First, check if you have acpi service running on the other machine, with sudo systemctl status acpid or sudo service acpid status



          If you do, test systemctl suspend on the other machine that does not respond to the sleep/suspend button press and see if any errors or warnings get printed.



          As far as setting a custom keybinding to Pause/Break key, I would try to bind it to a script that executes systemctl suspend command , as trying to remap sleep/suspend button will require clearing the previous binding for the built-in sleep/suspend key if there is one, if I recall correctly. In other words, make a script suspendme.sh.



          touch suspendme.sh
          nano suspendme.sh


          inside the suspendme.sh script:



          #!/bin/bash
          systemctl suspend



          chown u+x suspendme.sh
          mv suspendme.sh /usr/local/bin/


          And then you can just use "System Settings" > "Keyboard" > "Shortcuts" > "Custom Shortcuts" in both Gnome and Unity to set the shortcut. Just click on + and for the command to execute with the Pause key use suspendme.sh as it is in /usr/local/bin and will be part of the path.






          share|improve this answer
























          • How does the system wakeup? Will it search for script again when I press the sleep button when its in suspended state? I’m asking this since currently the system doesn’t respond to normal keyboard key button presses when suspended. It’s the bug I’m actually looking to circumvent.

            – sanadell
            2 hours ago













          • check grep . /sys/bus/usb/devices/*/power/wakeup and change the listen to wake up with echo enabled > /sys/bus/usb/devices/usb1/power/wakeup change usb1 to the the path of your keyboard.

            – BarBar1234
            2 hours ago











          • Once you find the correct usb path of your keyboard and successfully test it, make sure you make it permanent, by pasting the echo enabled > [sys bus path to keyboard] into /etc/rc.local. You will likely need to sudo, so sudo nano /etc/rc.local and paste it there.

            – BarBar1234
            2 hours ago














          0












          0








          0







          First, check if you have acpi service running on the other machine, with sudo systemctl status acpid or sudo service acpid status



          If you do, test systemctl suspend on the other machine that does not respond to the sleep/suspend button press and see if any errors or warnings get printed.



          As far as setting a custom keybinding to Pause/Break key, I would try to bind it to a script that executes systemctl suspend command , as trying to remap sleep/suspend button will require clearing the previous binding for the built-in sleep/suspend key if there is one, if I recall correctly. In other words, make a script suspendme.sh.



          touch suspendme.sh
          nano suspendme.sh


          inside the suspendme.sh script:



          #!/bin/bash
          systemctl suspend



          chown u+x suspendme.sh
          mv suspendme.sh /usr/local/bin/


          And then you can just use "System Settings" > "Keyboard" > "Shortcuts" > "Custom Shortcuts" in both Gnome and Unity to set the shortcut. Just click on + and for the command to execute with the Pause key use suspendme.sh as it is in /usr/local/bin and will be part of the path.






          share|improve this answer













          First, check if you have acpi service running on the other machine, with sudo systemctl status acpid or sudo service acpid status



          If you do, test systemctl suspend on the other machine that does not respond to the sleep/suspend button press and see if any errors or warnings get printed.



          As far as setting a custom keybinding to Pause/Break key, I would try to bind it to a script that executes systemctl suspend command , as trying to remap sleep/suspend button will require clearing the previous binding for the built-in sleep/suspend key if there is one, if I recall correctly. In other words, make a script suspendme.sh.



          touch suspendme.sh
          nano suspendme.sh


          inside the suspendme.sh script:



          #!/bin/bash
          systemctl suspend



          chown u+x suspendme.sh
          mv suspendme.sh /usr/local/bin/


          And then you can just use "System Settings" > "Keyboard" > "Shortcuts" > "Custom Shortcuts" in both Gnome and Unity to set the shortcut. Just click on + and for the command to execute with the Pause key use suspendme.sh as it is in /usr/local/bin and will be part of the path.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 3 hours ago









          BarBar1234BarBar1234

          1714




          1714













          • How does the system wakeup? Will it search for script again when I press the sleep button when its in suspended state? I’m asking this since currently the system doesn’t respond to normal keyboard key button presses when suspended. It’s the bug I’m actually looking to circumvent.

            – sanadell
            2 hours ago













          • check grep . /sys/bus/usb/devices/*/power/wakeup and change the listen to wake up with echo enabled > /sys/bus/usb/devices/usb1/power/wakeup change usb1 to the the path of your keyboard.

            – BarBar1234
            2 hours ago











          • Once you find the correct usb path of your keyboard and successfully test it, make sure you make it permanent, by pasting the echo enabled > [sys bus path to keyboard] into /etc/rc.local. You will likely need to sudo, so sudo nano /etc/rc.local and paste it there.

            – BarBar1234
            2 hours ago



















          • How does the system wakeup? Will it search for script again when I press the sleep button when its in suspended state? I’m asking this since currently the system doesn’t respond to normal keyboard key button presses when suspended. It’s the bug I’m actually looking to circumvent.

            – sanadell
            2 hours ago













          • check grep . /sys/bus/usb/devices/*/power/wakeup and change the listen to wake up with echo enabled > /sys/bus/usb/devices/usb1/power/wakeup change usb1 to the the path of your keyboard.

            – BarBar1234
            2 hours ago











          • Once you find the correct usb path of your keyboard and successfully test it, make sure you make it permanent, by pasting the echo enabled > [sys bus path to keyboard] into /etc/rc.local. You will likely need to sudo, so sudo nano /etc/rc.local and paste it there.

            – BarBar1234
            2 hours ago

















          How does the system wakeup? Will it search for script again when I press the sleep button when its in suspended state? I’m asking this since currently the system doesn’t respond to normal keyboard key button presses when suspended. It’s the bug I’m actually looking to circumvent.

          – sanadell
          2 hours ago







          How does the system wakeup? Will it search for script again when I press the sleep button when its in suspended state? I’m asking this since currently the system doesn’t respond to normal keyboard key button presses when suspended. It’s the bug I’m actually looking to circumvent.

          – sanadell
          2 hours ago















          check grep . /sys/bus/usb/devices/*/power/wakeup and change the listen to wake up with echo enabled > /sys/bus/usb/devices/usb1/power/wakeup change usb1 to the the path of your keyboard.

          – BarBar1234
          2 hours ago





          check grep . /sys/bus/usb/devices/*/power/wakeup and change the listen to wake up with echo enabled > /sys/bus/usb/devices/usb1/power/wakeup change usb1 to the the path of your keyboard.

          – BarBar1234
          2 hours ago













          Once you find the correct usb path of your keyboard and successfully test it, make sure you make it permanent, by pasting the echo enabled > [sys bus path to keyboard] into /etc/rc.local. You will likely need to sudo, so sudo nano /etc/rc.local and paste it there.

          – BarBar1234
          2 hours ago





          Once you find the correct usb path of your keyboard and successfully test it, make sure you make it permanent, by pasting the echo enabled > [sys bus path to keyboard] into /etc/rc.local. You will likely need to sudo, so sudo nano /etc/rc.local and paste it there.

          – BarBar1234
          2 hours ago










          sanadell is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          sanadell is a new contributor. Be nice, and check out our Code of Conduct.













          sanadell is a new contributor. Be nice, and check out our Code of Conduct.












          sanadell is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1122391%2fchecking-acpi-key-bindings-and-remapping-keyboard-keypress-events-to-acpi-events%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          GameSpot

          日野市

          Tu-95轟炸機