Fixing [Errno 25] Inappropriate ioctl for device

Recently I wrote an application on Python for Raspberry. At my development rPI everything was working smoothly until I copy files to production rPI.

Error output was:

...
OSError: [Errno 25] Inappropriate ioctl for device

My search results showing (mostly) error source is terminal output or terminal output is redirected another app etc. I didn’t get suspicius because I was using vpn-like system for SSH for security.

However; it’s not related with terminal at all. Somehow, I changed my development rPI’s config (don’t remember at all), that’s why I didn’t get that error.

Fixing it is pretty easy. Probably you can do it over raspi-config but I don’t like this kind of tools so I can’t show it over it but in terminal;

sudo nano /boot/config.txt

Add below line to the end of the file

dtoverlay=pi3-miniuart-bt

Save and exit from nano and reboot your Raspberry.



If you’re still getting error;

sudo raspi-config

Hit Interface Options > Serial Port

Login shell over serial?: No
Serial port hardware enabled?: Yes

Enjoy

· raspberry