Nieuws:

Welkom, Gast. Alsjeblieft inloggen of registreren.
Heb je de activerings-mail niet ontvangen?

Auteur Topic: Arch: met udev rule voor add werkt, maar remove action niet.  (gelezen 1504 keer)

Offline bart85

  • Lid
Arch: met udev rule voor add werkt, maar remove action niet.
« Gepost op: 2023/01/31, 10:46:25 »
https://gitlab.com/kingsindian85/creative-ideas/-/blob/main/soundvolume.sh

Bovenstaand script werkt, maar 2x bluetoothctl oproepen is overbodig.
Ik wil een environment variable instellen met een udev rule. Bij het aankoppelen van mijn bluetooth speaker wil ik die variable instellen en systemwide is op te vragen. Globaal is dat onderstaand maar moet nog aangepast worden.
ACTION=="add", SUBSYSTEM=="bluetooth", ATTRS{address}=="xx:xx:xx:xx:xx:xx", RUN+="???"
Hoe stel ik een variabele in met udev? Waarbij de variabele het Mac address bevat.

*Het zou ook kunnen met:
+RUN="/bin/bash -c ' echo xx > /tmp/bt_speaker'"En bij remove het aangemaakte bestand weer verwijderen.
« Laatst bewerkt op: 2023/01/31, 17:53:54 door bart85 »
Je leert maar mooi over weg gaan met de commandline.
Linus: "I'm happy with the people who are wandering around looking at the stars but I am looking at the ground and I want to fix the pothole before I fall in."
I look to the clouds behind me and see the thunder coming.

Offline bart85

  • Lid
Re: Arch: met udev rule variabele systemwide instellen?
« Reactie #1 Gepost op: 2023/01/31, 14:45:59 »
De udev rules en ook aanpassingen werkt niet.
Je leert maar mooi over weg gaan met de commandline.
Linus: "I'm happy with the people who are wandering around looking at the stars but I am looking at the ground and I want to fix the pothole before I fall in."
I look to the clouds behind me and see the thunder coming.

Offline bart85

  • Lid
Re: Arch: met udev rule variabele systemwide instellen?
« Reactie #2 Gepost op: 2023/01/31, 15:44:02 »
ACTION=="add", SUBSYSTEM=="input", ATTR{name}=="JBL Charge Essential (AVRCP)", RUN+="/root/btspeaker.add"
ACTION=="remove", SUBSYSTEM=="input",  ATTR{name}=="JBL Charge Essential (AVRCP)", RUN+="/root/btspeaker.remove"

Dit is de nieuwe regel. Bij het toevoegen werkt het. De remove action werkt niet.
Je leert maar mooi over weg gaan met de commandline.
Linus: "I'm happy with the people who are wandering around looking at the stars but I am looking at the ground and I want to fix the pothole before I fall in."
I look to the clouds behind me and see the thunder coming.

Offline bart85

  • Lid
Re: Arch: met udev rule voor add werkt, maar remove action niet.
« Reactie #3 Gepost op: 2023/02/01, 17:40:21 »
https://gitlab.com/kingsindian85/creative-ideas/-/blob/main/sndvol.sh

Udev rule maakt nu een symlink aan ipv een script uitvoeren. Mijn programma kan nu via de symlink zien of speaker verbonden is. Bij afkoppelen word de symlink weer verwijderd. Een remove action is nu overbodig.
Script op gitlab kan volume aanpassen voor zowel gewone speakers als bluetooth speakers. Nodig voor de configuratie van sway.
Opgelost
« Laatst bewerkt op: 2023/02/01, 18:11:26 door bart85 »
Je leert maar mooi over weg gaan met de commandline.
Linus: "I'm happy with the people who are wandering around looking at the stars but I am looking at the ground and I want to fix the pothole before I fall in."
I look to the clouds behind me and see the thunder coming.