Linux MInt 19.x Mate Sounds

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Linux MInt 19.x Mate Sounds

Post by MrEen »

Ha, I just found this in one of my open tabs:

Code: Select all

ENV{XAUTHORITY}="/home/username/.Xauthority"
Looks like the env can/should be set in the .rules file. I didn't search that properly, and just got lucky in finding it.
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Linux MInt 19.x Mate Sounds

Post by MrEen »

You're very welcome. This is how I learn myself, so I'm rewarded as well. It was a fun exercise. :D
zaileion
Level 4
Level 4
Posts: 297
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

delete, duplicate...
Last edited by zaileion on Sat Nov 02, 2019 4:42 pm, edited 1 time in total.
zaileion
Level 4
Level 4
Posts: 297
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

it plays everything 3x.. Is there a way to get it to play the .wav file only 1x?
zaileion
Level 4
Level 4
Posts: 297
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

MrEen wrote: Sat Nov 02, 2019 4:33 pm Ha, I just found this in one of my open tabs:

Code: Select all

ENV{XAUTHORITY}="/home/username/.Xauthority"
Looks like the env can/should be set in the .rules file. I didn't search that properly, and just got lucky in finding it.
So where do i add this?

These are my current files
Attachments
Selection_008.png
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Linux MInt 19.x Mate Sounds

Post by MrEen »

The "proper" method, as I understand it, would be to have the .rules file look like this:

Code: Select all

ACTION=="add", ENV{XAUTHORITY}="/home/zaileion/.Xauthority", RUN+="/usr/local/bin/99-deviceconnected.sh"
Then change the .sh to just the hashbang and the aplay line and test if it still works.
zaileion
Level 4
Level 4
Posts: 297
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

So I changed it to this and now it only plays the audio file 2x...
Attachments
Selection_009.png
zaileion
Level 4
Level 4
Posts: 297
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

ok. SO i changed it to this

Code: Select all

ACTION=="add", ENV{XAUTHORITY}="/home/zaileion/.Xauthority", RUN+="/usr/local/bin/99-deviceconnected.sh"
and it plays the file 3x again
zaileion
Level 4
Level 4
Posts: 297
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

MrEen wrote: Sat Nov 02, 2019 4:48 pm The "proper" method, as I understand it, would be to have the .rules file look like this:

Code: Select all

ACTION=="add", ENV{XAUTHORITY}="/home/zaileion/.Xauthority", RUN+="/usr/local/bin/99-deviceconnected.sh"
Then change the .sh to just the hashbang and the aplay line and test if it still works.
change what .sh? change the file name from 99-deviceconnected.sh to 99-deviceconnected.# ?
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Linux MInt 19.x Mate Sounds

Post by MrEen »

zaileion wrote: Sat Nov 02, 2019 4:51 pm ok. SO i changed it to this

Code: Select all

ACTION=="add", ENV{XAUTHORITY}="/home/zaileion/.Xauthority", RUN+="/usr/local/bin/99-deviceconnected.sh"
and it plays the file 3x again
Okay, let's try this again in the .rules file:

Code: Select all

ACTION=="add", SUBSYSTEMS=="usb", ENV{XAUTHORITY}="/home/zaileion/.Xauthority", RUN+="/usr/local/bin/99-deviceconnected.sh"
Regarding your last post, change the .sh file to this:

Code: Select all

#!/bin/bash
aplay path/to/file
I just corrected #!/bin/bash in case you missed my correction.
zaileion
Level 4
Level 4
Posts: 297
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

This works but plays the file 3 times...
Attachments
Selection_010.png
zaileion
Level 4
Level 4
Posts: 297
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

This plays the file 2 times...

Oh, and reboots are not required... Now that its working, just change the files and save and bada bing it works...
Attachments
Selection_011.png
Last edited by zaileion on Sat Nov 02, 2019 5:02 pm, edited 1 time in total.
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Linux MInt 19.x Mate Sounds

Post by MrEen »

I'm struggling to figure out why it's playing 3 times. Are there 3 devices connected via USB when this is happening? Maybe we can find another thing to add to the .rules files to help eliminate keyboards, mice, etc. if so.

Maybe this for the .rules file will help:

Code: Select all

ACTION=="add", SUBSYSTEM=="block", SUBSYSTEMS=="usb", ENV{XAUTHORITY}="/home/zaileion/.Xauthority", RUN+="/usr/local/bin/99-deviceconnected.sh"
zaileion
Level 4
Level 4
Posts: 297
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

single USB device in a usb port. its a laptop.. I did have 2 trying different devices and different usb ports but have since disconnected the extra device. I will change the .rules and let you know.
zaileion
Level 4
Level 4
Posts: 297
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

MrEen wrote: Sat Nov 02, 2019 5:01 pm I'm struggling to figure out why it's playing 3 times. Are there 3 devices connected via USB when this is happening? Maybe we can find another thing to add to the .rules files to help eliminate keyboards, mice, etc. if so.

Maybe this for the .rules file will help:

Code: Select all

ACTION=="add", SUBSYSTEM=="block", SUBSYSTEMS=="usb", ENV{XAUTHORITY}="/home/zaileion/.Xauthority", RUN+="/usr/local/bin/99-deviceconnected.sh"
No longer works...
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Linux MInt 19.x Mate Sounds

Post by MrEen »

Okay, that was the wrong subsystem apparently. I'll see if I can figure out which it should be.
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Linux MInt 19.x Mate Sounds

Post by MrEen »

Try this in the terminal then plug in the device and copy the output:

Code: Select all

udevadm monitor --kernel --property --subsystem-match=usb
I believe that might give us the info we need to modify the .rules file properly.
zaileion
Level 4
Level 4
Posts: 297
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

Its a lot... The phone requires me to click allow so it connects, then conects again after I touch allow on the phone. must be some kind of new android security thing...

here is the output:
$ udevadm monitor --kernel --property --subsystematch=usb
monitor will print the received events for:
KERNEL - the kernel uevent

KERNEL[13482.565647] add /devices/pci0000:00/0000:00:14.0/usb1/1-3 (usb)
ACTION=add
BUSNUM=001
DEVNAME=/dev/bus/usb/001/070
DEVNUM=070
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3
DEVTYPE=usb_device
MAJOR=189
MINOR=69
PRODUCT=4e8/6860/400
SEQNUM=5296
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13482.566620] add /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0 (usb)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0
DEVTYPE=usb_interface
INTERFACE=6/1/1
MODALIAS=usb:v04E8p6860d0400dc00dsc00dp00ic06isc01ip01in00
PRODUCT=4e8/6860/400
SEQNUM=5297
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13482.567315] add /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.1 (usb)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.1
DEVTYPE=usb_interface
INTERFACE=2/2/1
MODALIAS=usb:v04E8p6860d0400dc00dsc00dp00ic02isc02ip01in01
PRODUCT=4e8/6860/400
SEQNUM=5298
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13482.569303] bind /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.1 (usb)
ACTION=bind
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.1
DEVTYPE=usb_interface
DRIVER=cdc_acm
INTERFACE=2/2/1
MODALIAS=usb:v04E8p6860d0400dc00dsc00dp00ic02isc02ip01in01
PRODUCT=4e8/6860/400
SEQNUM=5300
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13482.569939] add /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2 (usb)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2
DEVTYPE=usb_interface
DRIVER=cdc_acm
INTERFACE=10/0/0
MODALIAS=usb:v04E8p6860d0400dc00dsc00dp00ic0Aisc00ip00in02
PRODUCT=4e8/6860/400
SEQNUM=5301
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13482.570221] bind /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2 (usb)
ACTION=bind
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2
DEVTYPE=usb_interface
DRIVER=cdc_acm
INTERFACE=10/0/0
MODALIAS=usb:v04E8p6860d0400dc00dsc00dp00ic0Aisc00ip00in02
PRODUCT=4e8/6860/400
SEQNUM=5302
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13482.571038] add /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.3 (usb)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.3
DEVTYPE=usb_interface
INTERFACE=255/66/1
MODALIAS=usb:v04E8p6860d0400dc00dsc00dp00icFFisc42ip01in03
PRODUCT=4e8/6860/400
SEQNUM=5303
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13482.571333] bind /devices/pci0000:00/0000:00:14.0/usb1/1-3 (usb)
ACTION=bind
BUSNUM=001
DEVNAME=/dev/bus/usb/001/070
DEVNUM=070
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3
DEVTYPE=usb_device
DRIVER=usb
MAJOR=189
MINOR=69
PRODUCT=4e8/6860/400
SEQNUM=5304
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13483.230668] bind /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0 (usb)
ACTION=bind
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0
DEVTYPE=usb_interface
DRIVER=usbfs
INTERFACE=6/1/1
MODALIAS=usb:v04E8p6860d0400dc00dsc00dp00ic06isc01ip01in00
PRODUCT=4e8/6860/400
SEQNUM=5305
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13486.411150] unbind /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0 (usb)
ACTION=unbind
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0
DEVTYPE=usb_interface
INTERFACE=6/1/1
PRODUCT=4e8/6860/400
SEQNUM=5306
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13486.411381] remove /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0 (usb)
ACTION=remove
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0
DEVTYPE=usb_interface
INTERFACE=6/1/1
MODALIAS=usb:v04E8p6860d0400dc00dsc00dp00ic06isc01ip01in00
PRODUCT=4e8/6860/400
SEQNUM=5307
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13486.413482] unbind /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2 (usb)
ACTION=unbind
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2
DEVTYPE=usb_interface
INTERFACE=10/0/0
PRODUCT=4e8/6860/400
SEQNUM=5309
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13486.413729] unbind /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.1 (usb)
ACTION=unbind
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.1
DEVTYPE=usb_interface
INTERFACE=2/2/1
PRODUCT=4e8/6860/400
SEQNUM=5310
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13486.413945] remove /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.1 (usb)
ACTION=remove
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.1
DEVTYPE=usb_interface
INTERFACE=2/2/1
MODALIAS=usb:v04E8p6860d0400dc00dsc00dp00ic02isc02ip01in01
PRODUCT=4e8/6860/400
SEQNUM=5311
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13486.414177] remove /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2 (usb)
ACTION=remove
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2
DEVTYPE=usb_interface
INTERFACE=10/0/0
MODALIAS=usb:v04E8p6860d0400dc00dsc00dp00ic0Aisc00ip00in02
PRODUCT=4e8/6860/400
SEQNUM=5312
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13486.414427] remove /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.3 (usb)
ACTION=remove
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.3
DEVTYPE=usb_interface
INTERFACE=255/66/1
MODALIAS=usb:v04E8p6860d0400dc00dsc00dp00icFFisc42ip01in03
PRODUCT=4e8/6860/400
SEQNUM=5313
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13486.428748] unbind /devices/pci0000:00/0000:00:14.0/usb1/1-3 (usb)
ACTION=unbind
BUSNUM=001
DEVNAME=/dev/bus/usb/001/070
DEVNUM=070
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3
DEVTYPE=usb_device
MAJOR=189
MINOR=69
PRODUCT=4e8/6860/400
SEQNUM=5314
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13486.429142] remove /devices/pci0000:00/0000:00:14.0/usb1/1-3 (usb)
ACTION=remove
BUSNUM=001
DEVNAME=/dev/bus/usb/001/070
DEVNUM=070
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3
DEVTYPE=usb_device
MAJOR=189
MINOR=69
PRODUCT=4e8/6860/400
SEQNUM=5315
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13487.176733] add /devices/pci0000:00/0000:00:14.0/usb1/1-3 (usb)
ACTION=add
BUSNUM=001
DEVNAME=/dev/bus/usb/001/071
DEVNUM=071
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3
DEVTYPE=usb_device
MAJOR=189
MINOR=70
PRODUCT=4e8/6860/400
SEQNUM=5316
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13487.178146] add /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0 (usb)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0
DEVTYPE=usb_interface
INTERFACE=6/1/1
MODALIAS=usb:v04E8p6860d0400dc00dsc00dp00ic06isc01ip01in00
PRODUCT=4e8/6860/400
SEQNUM=5317
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13487.179910] add /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.1 (usb)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.1
DEVTYPE=usb_interface
INTERFACE=2/2/1
MODALIAS=usb:v04E8p6860d0400dc00dsc00dp00ic02isc02ip01in01
PRODUCT=4e8/6860/400
SEQNUM=5318
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13487.180902] bind /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.1 (usb)
ACTION=bind
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.1
DEVTYPE=usb_interface
DRIVER=cdc_acm
INTERFACE=2/2/1
MODALIAS=usb:v04E8p6860d0400dc00dsc00dp00ic02isc02ip01in01
PRODUCT=4e8/6860/400
SEQNUM=5320
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13487.181662] add /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2 (usb)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2
DEVTYPE=usb_interface
DRIVER=cdc_acm
INTERFACE=10/0/0
MODALIAS=usb:v04E8p6860d0400dc00dsc00dp00ic0Aisc00ip00in02
PRODUCT=4e8/6860/400
SEQNUM=5321
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13487.182021] bind /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2 (usb)
ACTION=bind
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2
DEVTYPE=usb_interface
DRIVER=cdc_acm
INTERFACE=10/0/0
MODALIAS=usb:v04E8p6860d0400dc00dsc00dp00ic0Aisc00ip00in02
PRODUCT=4e8/6860/400
SEQNUM=5322
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13487.182734] add /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.3 (usb)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.3
DEVTYPE=usb_interface
INTERFACE=255/66/1
MODALIAS=usb:v04E8p6860d0400dc00dsc00dp00icFFisc42ip01in03
PRODUCT=4e8/6860/400
SEQNUM=5323
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13487.182951] bind /devices/pci0000:00/0000:00:14.0/usb1/1-3 (usb)
ACTION=bind
BUSNUM=001
DEVNAME=/dev/bus/usb/001/071
DEVNUM=071
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3
DEVTYPE=usb_device
DRIVER=usb
MAJOR=189
MINOR=70
PRODUCT=4e8/6860/400
SEQNUM=5324
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[13487.987369] bind /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0 (usb)
ACTION=bind
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0
DEVTYPE=usb_interface
DRIVER=usbfs
INTERFACE=6/1/1
MODALIAS=usb:v04E8p6860d0400dc00dsc00dp00ic06isc01ip01in00
PRODUCT=4e8/6860/400
SEQNUM=5325
SUBSYSTEM=usb
TYPE=0/0/0
zaileion
Level 4
Level 4
Posts: 297
Joined: Sun Jan 25, 2015 6:01 pm

Re: Linux MInt 19.x Mate Sounds

Post by zaileion »

So if i plug a usb drive in it plays the audio file about 15 times in a row...
User avatar
MrEen
Level 23
Level 23
Posts: 18343
Joined: Mon Jun 12, 2017 8:39 pm

Re: Linux MInt 19.x Mate Sounds

Post by MrEen »

I'm thinking the file is playing for every instance up the tree that is matched.

In your specific case, I think this might work to play the file one time, but it won't work on some other USB devices. Change the .rules to this:

Code: Select all

ACTION=="bind", DRIVER=="usbfs", ENV{XAUTHORITY}="/home/zaileion/.Xauthority", RUN+="/usr/local/bin/99-deviceconnected.sh"
I believe that will play the file AFTER you click to allow on the phone.
Locked

Return to “Beginner Questions”