1

can I write a piece of code that enables serial port and camera without using raspi-config? I would like to auto-config modules without manually using raspi-config to do so.

2
  • Sure but it is probably a waste of time, particularly if most of what raspi-config does is call binaries (that were mostly written in C); you either re-write all that or just make bunches of system() or fork/exec calls. The only reason to want to do that is because C is the only language you know -- which is fair enough, but a shell script to do this would be very, very simple, especially since you can get the content from the raspi-config source (it's a shell script).
    – goldilocks
    Nov 11 '20 at 19:25
  • 1
    BTW, if you want to know "how to automate configuring the camera like raspi-config", that is a very fair and good question -- just don't tack "in C" on it ;)
    – goldilocks
    Nov 11 '20 at 19:26
2

raspi-config is a bash script, so you can read it with a text editor.

The file can be found here /usr/bin/raspi-config

But there is no need to do a C program, you could simply use the bash script and tweak it after your needs.

1
  • 1
    Or use raspi-config in non-interactive mode, by calling it with command-line parameters.
    – Dirk
    Nov 11 '20 at 18:48
1

Yes you can.

Look at what raspi-config does and convert those actions to the programming language of your choice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.