Find out whether SPI is enabled or not Announcing the arrival of Valued Associate #679: Cesar...

When a candle burns, why does the top of wick glow if bottom of flame is hottest?

Time to Settle Down!

Sum letters are not two different

How much damage would a cupful of neutron star matter do to the Earth?

Is it fair for a professor to grade us on the possession of past papers?

How to write this math term? with cases it isn't working

Why do we need to use the builder design pattern when we can do the same thing with setters?

Crossing US/Canada Border for less than 24 hours

Trademark violation for app?

What would you call this weird metallic apparatus that allows you to lift people?

How were pictures turned from film to a big picture in a picture frame before digital scanning?

Generate an RGB colour grid

A term for a woman complaining about things/begging in a cute/childish way

Can anything be seen from the center of the Boötes void? How dark would it be?

Is grep documentation about ignoring case wrong, since it doesn't ignore case in filenames?

Hangman Game with C++

Question about debouncing - delay of state change

Disembodied hand growing fangs

Should I use a zero-interest credit card for a large one-time purchase?

Performance gap between vector<bool> and array

How to write the following sign?

How often does castling occur in grandmaster games?

Maximum summed subsequences with non-adjacent items

Project Euler #1 in C++



Find out whether SPI is enabled or not



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Congratulation Joan for 50k!Does SPI port work on Raspberry B+Raspbian Jessie+ breaks SPI (RFID Reader MFCR 522)?Rpi3 missing spi-bcm2708 moduleMFRC522 Not working over SPI InterfaceUbuntu Mate pernament CPU governor state?How to make raspbian load the spi module on boot up?Unable to activate SPI module on Raspberry Pi Zero W running on DietPiRaspberry Pi SPI and interbyte delayHow can the SPI interface suddenly stop working?SPI DMA and continuous transfers





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















I have a game that needs SPI. In the installation instructions, I noted that SPI has to be enabled via raspi-config.



Now, I'd like to check in a shell script whether the user has activated SPI or not. How can I query the SPI state?










share|improve this question





























    1















    I have a game that needs SPI. In the installation instructions, I noted that SPI has to be enabled via raspi-config.



    Now, I'd like to check in a shell script whether the user has activated SPI or not. How can I query the SPI state?










    share|improve this question

























      1












      1








      1








      I have a game that needs SPI. In the installation instructions, I noted that SPI has to be enabled via raspi-config.



      Now, I'd like to check in a shell script whether the user has activated SPI or not. How can I query the SPI state?










      share|improve this question














      I have a game that needs SPI. In the installation instructions, I noted that SPI has to be enabled via raspi-config.



      Now, I'd like to check in a shell script whether the user has activated SPI or not. How can I query the SPI state?







      spi bash






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 17 hours ago









      Thomas WellerThomas Weller

      1,23811237




      1,23811237






















          2 Answers
          2






          active

          oldest

          votes


















          4














          You can use raspi-config non-interactively to get the SPI status:



          sudo raspi-config nonint get_spi


          Which returns 1 (enabled) or 0 (disabled)



          Similarly, enable with:



          sudo raspi-config nonint set_spi 1





          share|improve this answer
























          • Wow. That's awesome. Didn't know that this exists. It may solve so many problems!

            – Thomas Weller
            13 hours ago











          • Good to hear - please mark as the correct answer if suitable.

            – ben_nuttall
            10 hours ago











          • Yes, I will, after I have tried it.

            – Thomas Weller
            9 hours ago



















          1














          SPI does not have to be enabled by raspi-config. It is just a convenient way of doing so on Raspbian.



          Try something like the following to check if the kernel SPI device exists.



          #!/bin/bash

          if [[ -e /dev/spidev0.0 ]]
          then echo "SPI exists"
          else echo "no SPI"
          fi


          This isn't fool proof as you don't need to use the kernel driver to use SPI.






          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function () {
            return StackExchange.using("schematics", function () {
            StackExchange.schematics.init();
            });
            }, "cicuitlab");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "447"
            };
            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: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            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%2fraspberrypi.stackexchange.com%2fquestions%2f96670%2ffind-out-whether-spi-is-enabled-or-not%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            4














            You can use raspi-config non-interactively to get the SPI status:



            sudo raspi-config nonint get_spi


            Which returns 1 (enabled) or 0 (disabled)



            Similarly, enable with:



            sudo raspi-config nonint set_spi 1





            share|improve this answer
























            • Wow. That's awesome. Didn't know that this exists. It may solve so many problems!

              – Thomas Weller
              13 hours ago











            • Good to hear - please mark as the correct answer if suitable.

              – ben_nuttall
              10 hours ago











            • Yes, I will, after I have tried it.

              – Thomas Weller
              9 hours ago
















            4














            You can use raspi-config non-interactively to get the SPI status:



            sudo raspi-config nonint get_spi


            Which returns 1 (enabled) or 0 (disabled)



            Similarly, enable with:



            sudo raspi-config nonint set_spi 1





            share|improve this answer
























            • Wow. That's awesome. Didn't know that this exists. It may solve so many problems!

              – Thomas Weller
              13 hours ago











            • Good to hear - please mark as the correct answer if suitable.

              – ben_nuttall
              10 hours ago











            • Yes, I will, after I have tried it.

              – Thomas Weller
              9 hours ago














            4












            4








            4







            You can use raspi-config non-interactively to get the SPI status:



            sudo raspi-config nonint get_spi


            Which returns 1 (enabled) or 0 (disabled)



            Similarly, enable with:



            sudo raspi-config nonint set_spi 1





            share|improve this answer













            You can use raspi-config non-interactively to get the SPI status:



            sudo raspi-config nonint get_spi


            Which returns 1 (enabled) or 0 (disabled)



            Similarly, enable with:



            sudo raspi-config nonint set_spi 1






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 13 hours ago









            ben_nuttallben_nuttall

            64947




            64947













            • Wow. That's awesome. Didn't know that this exists. It may solve so many problems!

              – Thomas Weller
              13 hours ago











            • Good to hear - please mark as the correct answer if suitable.

              – ben_nuttall
              10 hours ago











            • Yes, I will, after I have tried it.

              – Thomas Weller
              9 hours ago



















            • Wow. That's awesome. Didn't know that this exists. It may solve so many problems!

              – Thomas Weller
              13 hours ago











            • Good to hear - please mark as the correct answer if suitable.

              – ben_nuttall
              10 hours ago











            • Yes, I will, after I have tried it.

              – Thomas Weller
              9 hours ago

















            Wow. That's awesome. Didn't know that this exists. It may solve so many problems!

            – Thomas Weller
            13 hours ago





            Wow. That's awesome. Didn't know that this exists. It may solve so many problems!

            – Thomas Weller
            13 hours ago













            Good to hear - please mark as the correct answer if suitable.

            – ben_nuttall
            10 hours ago





            Good to hear - please mark as the correct answer if suitable.

            – ben_nuttall
            10 hours ago













            Yes, I will, after I have tried it.

            – Thomas Weller
            9 hours ago





            Yes, I will, after I have tried it.

            – Thomas Weller
            9 hours ago













            1














            SPI does not have to be enabled by raspi-config. It is just a convenient way of doing so on Raspbian.



            Try something like the following to check if the kernel SPI device exists.



            #!/bin/bash

            if [[ -e /dev/spidev0.0 ]]
            then echo "SPI exists"
            else echo "no SPI"
            fi


            This isn't fool proof as you don't need to use the kernel driver to use SPI.






            share|improve this answer




























              1














              SPI does not have to be enabled by raspi-config. It is just a convenient way of doing so on Raspbian.



              Try something like the following to check if the kernel SPI device exists.



              #!/bin/bash

              if [[ -e /dev/spidev0.0 ]]
              then echo "SPI exists"
              else echo "no SPI"
              fi


              This isn't fool proof as you don't need to use the kernel driver to use SPI.






              share|improve this answer


























                1












                1








                1







                SPI does not have to be enabled by raspi-config. It is just a convenient way of doing so on Raspbian.



                Try something like the following to check if the kernel SPI device exists.



                #!/bin/bash

                if [[ -e /dev/spidev0.0 ]]
                then echo "SPI exists"
                else echo "no SPI"
                fi


                This isn't fool proof as you don't need to use the kernel driver to use SPI.






                share|improve this answer













                SPI does not have to be enabled by raspi-config. It is just a convenient way of doing so on Raspbian.



                Try something like the following to check if the kernel SPI device exists.



                #!/bin/bash

                if [[ -e /dev/spidev0.0 ]]
                then echo "SPI exists"
                else echo "no SPI"
                fi


                This isn't fool proof as you don't need to use the kernel driver to use SPI.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 17 hours ago









                joanjoan

                50.6k35183




                50.6k35183






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Raspberry Pi Stack Exchange!


                    • 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%2fraspberrypi.stackexchange.com%2fquestions%2f96670%2ffind-out-whether-spi-is-enabled-or-not%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

                    VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

                    Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

                    Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...