MrBool
Posts: 117
Joined: Sat Jul 05, 2014 9:51 am

dtoverlay disable from command line

Sat Sep 21, 2019 9:46 am

I use in my config.txt file
dtoverlay=mcp23017
Is possible to disable that dtoverlay from the command line?
I know that I can remove this line from config.txt but I need to disable it from the command line during test procedure and keep original config.txt

User avatar
DougieLawson
Posts: 40126
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: dtoverlay disable from command line

Sat Sep 21, 2019 10:15 am

You can't do that.

The way to disable it is edit /boot/config.txt and change

Code: Select all

dtoverlay=mcp23017
to

Code: Select all

#dtoverlay=mcp23017
then reboot. To re-enable it reverse that change.
Last edited by DougieLawson on Sat Sep 21, 2019 6:33 pm, edited 1 time in total.
Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3438
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: dtoverlay disable from command line

Sat Sep 21, 2019 1:46 pm

Either my eyesight is failing or the after looks a lot like the before - should there have been a # comment character at the start of the edited version?

User avatar
rpdom
Posts: 17699
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: dtoverlay disable from command line

Sat Sep 21, 2019 1:55 pm

PhilE wrote:
Sat Sep 21, 2019 1:46 pm
Either my eyesight is failing or the after looks a lot like the before - should there have been a # comment character at the start of the edited version?
No comment.
:lol:
Unreadable squiggle

User avatar
DougieLawson
Posts: 40126
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: dtoverlay disable from command line

Sat Sep 21, 2019 6:34 pm

PhilE wrote:
Sat Sep 21, 2019 1:46 pm
Either my eyesight is failing or the after looks a lot like the before - should there have been a # comment character at the start of the edited version?
The postie delivered my new glasses this afternoon.
Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3438
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: dtoverlay disable from command line

Sat Sep 21, 2019 7:02 pm

Although you can't remove an overlay applied from config.txt, you could apply it at runtime instead which would then allow you to subsequently remove it.

Try the following:
1. Comment out the line in the config file and reboot.
2. Run "sudo dtoverlay mcp23017"
3. Verify that it works.
4. Run "sudo dtoverlay -r" to remove the most recent overlay.
5. Confirm that the functionality has been disabled.

N.B. Some subsystems don't react to runtime overlays being applied, but SPI and I2C should be okay.

Return to “Device Tree”