Page 3 of 4

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 4:33 pm
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.

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 4:34 pm
by MrEen
You're very welcome. This is how I learn myself, so I'm rewarded as well. It was a fun exercise. :D

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 4:42 pm
by zaileion
delete, duplicate...

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 4:42 pm
by zaileion
it plays everything 3x.. Is there a way to get it to play the .wav file only 1x?

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 4:44 pm
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

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 4:48 pm
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.

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 4:49 pm
by zaileion
So I changed it to this and now it only plays the audio file 2x...

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 4:51 pm
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

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 4:52 pm
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.# ?

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 4:54 pm
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.

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 4:56 pm
by zaileion
This works but plays the file 3 times...

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 4:58 pm
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...

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 5:01 pm
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"

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 5:03 pm
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.

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 5:04 pm
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...

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 5:06 pm
by MrEen
Okay, that was the wrong subsystem apparently. I'll see if I can figure out which it should be.

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 5:12 pm
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.

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 5:19 pm
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

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 5:23 pm
by zaileion
So if i plug a usb drive in it plays the audio file about 15 times in a row...

Re: Linux MInt 19.x Mate Sounds

Posted: Sat Nov 02, 2019 5:31 pm
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.