Raspberry pi autostart command for USB serial?

Yes those are installed by packages, when they’re enabled they’re symlinked from /usr/lib/systemd/system.

It’s been staring me in the face the whole time, it’s just printing “pwm_100 > /dev/ttyUSB0”. Sorry I was rushed this morning and I didn’t verify my assumptions, that doesn’t excuse this evening though. :man_facepalming:

# /usr/bin/startfan

#!/usr/bin/bash
echo pwm_100 > /dev/ttyUSB0
[Unit]
Description=cooling fan

[Service]
ExecStart=/usr/bin/startfan

EDIT:

Ah you kinda beat me to it.

OK so I should have a script in /usr/bin or /usr/local/bin?

should I set all files with chown root:root and chmod 644 ?

I’m creating the files with nano and stoping services befor editing - doing daemon-reload - and then start them again?

Technically root owned executables you install manually should go in /usr/local/bin, and ones installed by packages should go in /usr/bin. In practice AFAIK it doesn’t actually matter, it’s just to organise things.

At least it will work if you put your files in /usr/bin, package owned files should not be in /usr/local/bin.

Yes, except the script should be 744.

You need to disable and re-enable if you change dependencies (such as WantedBy, Before, After etc), AFAIK any other changes should be picked up with a deamon-reload.

A service without an Install section can’t be enabled it’s called by a timer etc. The timer can and should be enabled, I don’t think you need to disable it a daemon-reload should do the trick.

OK so this is kinda where I was at before.
Did a shutdown and powered back up and no fan.

I can start the fan in terminal

It hadn’t been triggered yet, I set it 1 minute to hopefully make sure the device was detected first.

By starting the service manually?

I didn’t try that - I did the echo command to usb

Ok so set it to pwm_0, if that works, and try the service, post any errors.

pwm_0 would be 0% fan speed.
Can I edit the timer to say 15 without the “Min” would that equate to 15 seconds?

I mean set it to 0 (or something low like 20, so you can see/hear the difference) then run sudo systemctl start startfan.service if it doesn’t start up again then run the command itself to turn the fan back on then post the output of systemctl status startfan.

You can change the timer, but we should get it working first.

!!!BOOOM!!!
I did shutdown and I have fan!
I changed to timer to 15sec
Highest praise to you sir!
How should I mark this topic? lol

1 Like

You have the patience of a hungry cat. I really am greatful. Thank you for your time.

Timeshift time.

1 Like

Awesome.

Honestly I don’t know, no single post stands out, so I’ve put what I think was the final config below.

# /usr/local/bin/startfan

#!/usr/bin/bash
echo pwm_100 > /dev/ttyUSB0
# /etc/systemd/systemd/startfan.service
[Unit]
Description=cooling fan

[Service]
ExecStart=/usr/local/bin/startfan
# /etc/systemd/systemd/startfan.timer
[Unit]
Description=startfan timer

[Timer]
OnBootSec=15sec

[Install]
WantedBy=multi-user.target
sudo chmod 744 /usr/local/bin/startfan
sudo systemctl enable startfan.timer

Or post your config and mark that.

1 Like

This was a workaround for the deskpi pro v2 to get the fan working with Manjaro 23.02 arm64 on raspberry pi 4 B without a driver.
The case was modified with a bigger heatsink and fan but should work the same with stock hardware. Thanks DMT.
The original driver for system shutdown works and can be installed manually with clues from the manjaro install script.
depends on git installed to clone the original from the driver github page.
If testing original c make install method depends on base-devel installed.
If youre reading this and have github fork and commit knowledge and time to contribute they could use the help over there.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.