Can Operating Systems handle shift, ctrl and alt key signals separate from the keyboard?












0















The basic problem is this: I have a mini keyboard I'm using for a Raspberry Pi project, and since there is only one shift, ctrl and alt key apiece, that means combinations on the left side of the keyboard like shift-A and ctrl-C are kind of awkward to pull off without dropping it.



My intended solution is to add a separate button to simulate a second shift key. With the RPi and some very basic electronics and programming experience, this is fairly simple in theory. At least for most keys. But since the shift key is kind of a "modifier" key...



The question is, do Operating Systems handle each keypress separately or is it the keyboard's job to send a capital A when the user pushes shift-A? Can I use a second input to simulate a shift key and then push the A key on the keyboard to have the Operating System print a capital A? A general answer is appreciated, but if it depends on the Operating System, the OS in question is Raspbian Stretch, based on Debian Stretch.










share|improve this question



























    0















    The basic problem is this: I have a mini keyboard I'm using for a Raspberry Pi project, and since there is only one shift, ctrl and alt key apiece, that means combinations on the left side of the keyboard like shift-A and ctrl-C are kind of awkward to pull off without dropping it.



    My intended solution is to add a separate button to simulate a second shift key. With the RPi and some very basic electronics and programming experience, this is fairly simple in theory. At least for most keys. But since the shift key is kind of a "modifier" key...



    The question is, do Operating Systems handle each keypress separately or is it the keyboard's job to send a capital A when the user pushes shift-A? Can I use a second input to simulate a shift key and then push the A key on the keyboard to have the Operating System print a capital A? A general answer is appreciated, but if it depends on the Operating System, the OS in question is Raspbian Stretch, based on Debian Stretch.










    share|improve this question

























      0












      0








      0








      The basic problem is this: I have a mini keyboard I'm using for a Raspberry Pi project, and since there is only one shift, ctrl and alt key apiece, that means combinations on the left side of the keyboard like shift-A and ctrl-C are kind of awkward to pull off without dropping it.



      My intended solution is to add a separate button to simulate a second shift key. With the RPi and some very basic electronics and programming experience, this is fairly simple in theory. At least for most keys. But since the shift key is kind of a "modifier" key...



      The question is, do Operating Systems handle each keypress separately or is it the keyboard's job to send a capital A when the user pushes shift-A? Can I use a second input to simulate a shift key and then push the A key on the keyboard to have the Operating System print a capital A? A general answer is appreciated, but if it depends on the Operating System, the OS in question is Raspbian Stretch, based on Debian Stretch.










      share|improve this question














      The basic problem is this: I have a mini keyboard I'm using for a Raspberry Pi project, and since there is only one shift, ctrl and alt key apiece, that means combinations on the left side of the keyboard like shift-A and ctrl-C are kind of awkward to pull off without dropping it.



      My intended solution is to add a separate button to simulate a second shift key. With the RPi and some very basic electronics and programming experience, this is fairly simple in theory. At least for most keys. But since the shift key is kind of a "modifier" key...



      The question is, do Operating Systems handle each keypress separately or is it the keyboard's job to send a capital A when the user pushes shift-A? Can I use a second input to simulate a shift key and then push the A key on the keyboard to have the Operating System print a capital A? A general answer is appreciated, but if it depends on the Operating System, the OS in question is Raspbian Stretch, based on Debian Stretch.







      keyboard operating-systems io shift






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 27 '18 at 16:40









      DevsmanDevsman

      1104




      1104






















          1 Answer
          1






          active

          oldest

          votes


















          3














          Most modern keyboards are interfaced as USB HID devices; there are exceptions, but your case with a raspberry pi is clearly USB.



          In the case of a USB keyboard, the state of modifier keys is communicated by a separate bitmask of states sent along when reporting ordinary keys, see for example https://wiki.osdev.org/USB_Human_Interface_Devices for the specific bits and keys. (This is different from PS/2 keyboards, where modifier keys had their own scan codes).



          If you can find the code which interprets events and understand how it uses the modifier bits, you could modify the logic to look at other things as well. You could also potentially just bitwise OR in your own alternate input states on top of the reported modifier keys (since a "1" indicates a pressed key).



          For some simpler type of keyboards using keyswitches, you might also be able to wire in a separate pushbutton in parallel with an existing modifier key; but this could be tricky.






          share|improve this answer

























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            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
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1388163%2fcan-operating-systems-handle-shift-ctrl-and-alt-key-signals-separate-from-the-k%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









            3














            Most modern keyboards are interfaced as USB HID devices; there are exceptions, but your case with a raspberry pi is clearly USB.



            In the case of a USB keyboard, the state of modifier keys is communicated by a separate bitmask of states sent along when reporting ordinary keys, see for example https://wiki.osdev.org/USB_Human_Interface_Devices for the specific bits and keys. (This is different from PS/2 keyboards, where modifier keys had their own scan codes).



            If you can find the code which interprets events and understand how it uses the modifier bits, you could modify the logic to look at other things as well. You could also potentially just bitwise OR in your own alternate input states on top of the reported modifier keys (since a "1" indicates a pressed key).



            For some simpler type of keyboards using keyswitches, you might also be able to wire in a separate pushbutton in parallel with an existing modifier key; but this could be tricky.






            share|improve this answer






























              3














              Most modern keyboards are interfaced as USB HID devices; there are exceptions, but your case with a raspberry pi is clearly USB.



              In the case of a USB keyboard, the state of modifier keys is communicated by a separate bitmask of states sent along when reporting ordinary keys, see for example https://wiki.osdev.org/USB_Human_Interface_Devices for the specific bits and keys. (This is different from PS/2 keyboards, where modifier keys had their own scan codes).



              If you can find the code which interprets events and understand how it uses the modifier bits, you could modify the logic to look at other things as well. You could also potentially just bitwise OR in your own alternate input states on top of the reported modifier keys (since a "1" indicates a pressed key).



              For some simpler type of keyboards using keyswitches, you might also be able to wire in a separate pushbutton in parallel with an existing modifier key; but this could be tricky.






              share|improve this answer




























                3












                3








                3







                Most modern keyboards are interfaced as USB HID devices; there are exceptions, but your case with a raspberry pi is clearly USB.



                In the case of a USB keyboard, the state of modifier keys is communicated by a separate bitmask of states sent along when reporting ordinary keys, see for example https://wiki.osdev.org/USB_Human_Interface_Devices for the specific bits and keys. (This is different from PS/2 keyboards, where modifier keys had their own scan codes).



                If you can find the code which interprets events and understand how it uses the modifier bits, you could modify the logic to look at other things as well. You could also potentially just bitwise OR in your own alternate input states on top of the reported modifier keys (since a "1" indicates a pressed key).



                For some simpler type of keyboards using keyswitches, you might also be able to wire in a separate pushbutton in parallel with an existing modifier key; but this could be tricky.






                share|improve this answer















                Most modern keyboards are interfaced as USB HID devices; there are exceptions, but your case with a raspberry pi is clearly USB.



                In the case of a USB keyboard, the state of modifier keys is communicated by a separate bitmask of states sent along when reporting ordinary keys, see for example https://wiki.osdev.org/USB_Human_Interface_Devices for the specific bits and keys. (This is different from PS/2 keyboards, where modifier keys had their own scan codes).



                If you can find the code which interprets events and understand how it uses the modifier bits, you could modify the logic to look at other things as well. You could also potentially just bitwise OR in your own alternate input states on top of the reported modifier keys (since a "1" indicates a pressed key).



                For some simpler type of keyboards using keyswitches, you might also be able to wire in a separate pushbutton in parallel with an existing modifier key; but this could be tricky.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 27 '18 at 17:06

























                answered Dec 27 '18 at 17:00









                Chris StrattonChris Stratton

                31017




                31017






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • 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%2fsuperuser.com%2fquestions%2f1388163%2fcan-operating-systems-handle-shift-ctrl-and-alt-key-signals-separate-from-the-k%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

                    Plaza Victoria

                    Puebla de Zaragoza

                    Musa