USB DAC disconnect detection

325 views
Skip to first unread message

JK

unread,
Aug 15, 2016, 1:50:33 AM8/15/16
to Tasker
Hello.  First time user here.  I'm having trouble getting Tasker to recognize USB DAC disconnecting and would appreciate any help.

Hardware:  Moto E (2nd gen), stock/unrooted, Android v5.1
Objective:  automatically play music when USB DAC is plugged in and pause when unplugged
Profile:  Hardware - USB Connected - Audio
Task:  Play [Simulated Only], On, Play Music
Symptoms:  When USB DAC is initially connected, music plays as intended.  When DAC is disconnected, music pauses (which is default Android behavior).  However, Tasker does not recognize that the DAC disconnected and thus will not resume playback when the DAC is connected again.  When the screen is locked and then unlocked, then Tasker recognizes that DAC disconnected.

I'm not sure whether this is a hardware or a software issue, but I'm willing to try something/anything after many hours of searching and tinkering.

Thank you.

JK

Rich D

unread,
Aug 15, 2016, 4:50:59 AM8/15/16
to Tasker Google Groups Post


>
> I'm not sure whether this is a hardware or a software issue, but I'm willing to try something/anything after many hours of searching and tinkering.
>

Could you turn on and check the run log(menu / more / runlog) then post the relevant part of the log along with the exported profile description.

To post your profile or task here...  Long press on the profile or task name / ( 3 dot menu with 4.0+ ) export / export "DESCRIPTION" to clipboard (not XML)

Any linked tasks will be exported with the profile they are linked to..

To be able to export, The beginner mode needs to be off and the profile needs to be named by you (Not the Tasker listed name.  Tasker will list your profile with the context name if you have not given it one).

JK

unread,
Aug 17, 2016, 12:27:49 AM8/17/16
to Tasker
I think this is it.  As visible below, the Profile "DAC Connected" activates at 22.15.34 when I plug in the DAC.  I unplugged the DAC five seconds later, which stops music playing, but the Profile doesn't go Inactive until 30 seconds later when I lock/unlock the screen.

20160816 22.15.30 M Restart  ID0:0.0  Monitor

20160816 22.15.34 P Active   ID2      DAC Connected

20160816 22.15.34 E Start    ID0:0.0  TaskService

20160816 22.15.34 T Running  ID3      Play

20160816 22.15.34 A OK       ID3.1    Play.Media Control

20160816 22.15.34 T ExitOK   ID3      Play

20160816 22.15.34 E Stop     ID0:0.0  TaskService

20160816 22.16.01 P Inactive ID2      DAC Connected


For the life of me, I couldn't get the Profile exported.  But, below is the Task export.  There's only one Profile: "DAC Connected" and "Play" is the only Task.  Thank you for your help.


Play (3)
A1: Media Control [ Cmd:Play [Simulated Only] Simulate Media Button:On App:Play Music ]



Rich D

unread,
Aug 17, 2016, 5:02:26 AM8/17/16
to Tasker Google Groups Post

>
> I think this is it.  As visible below, the Profile "DAC Connected" activates at 22.15.34 when I plug in the DAC.  I unplugged the DAC five seconds later, which stops music playing, but the Profile doesn't go Inactive until 30 seconds later when I lock/unlock the screen.
>

We should start with the basics. Try all the relevant suggestions here.


http://tasker.dinglisch.net/userguide/en/androidpowermanagement.html

>
>
> For the life of me, I couldn't get the Profile exported. 

Make sure you have given the profile a user name.

JK

unread,
Aug 18, 2016, 12:28:16 AM8/18/16
to Tasker
Run in Foreground is checked.  Reliable alarms in on Always.  Neither made any difference.

There seems to be no way to disable Battery Optimization (at app level) on this MotoE, Android 5.1.

Anything else I could try?  Thank you.

Rich D

unread,
Aug 18, 2016, 5:22:06 AM8/18/16
to Tasker Google Groups Post


> Anything else I could try?  Thank you.

You could try a additional context with a state / hardware / usb: media.  Then select the invert option to see if will detect it that way.

Rich D

unread,
Aug 18, 2016, 12:46:39 PM8/18/16
to Tasker Google Groups Post

> You could try a additional context

I meant try a additional profile with a context of state / hardware / usb: media.  Then select the invert option to see if will detect it that way.

JK

unread,
Aug 18, 2016, 11:16:01 PM8/18/16
to Tasker
I don't have "usb:media" under hardware.  I have tried USB:any with same results as before.

JK

unread,
Aug 18, 2016, 11:50:17 PM8/18/16
to Tasker
I have tried inverting the profile.  It acts as expected.  The unplug event recognized only after screen lock/unlock.

I also tried a USB mouse.  Plugging/unplugging events are recognized within seconds, repeatedly.  For some reason, I'm having trouble getting Tasker to recognize the USB DAC being unplugged.

Android knows it is being unplugged just fine: music pauses immediately when the DAC is unplugged.  Tasker doesn't, not until screen is locked/unlocked.

Rich D

unread,
Aug 19, 2016, 5:06:42 AM8/19/16
to Tasker Google Groups Post


> I have tried inverting the profile.  It acts as expected.  The unplug event recognized only after screen lock/unlock.
>
> I also tried a USB mouse.  Plugging/unplugging events are recognized within seconds, repeatedly.  For some reason, I'm having trouble getting Tasker to recognize the USB DAC being unplugged.
>
> Android knows it is being unplugged just fine: music pauses immediately when the DAC is unplugged.  Tasker doesn't, not until screen is locked/unlocked.
>

> --

That does sound like A bug. I do not have the correct cable to confirm it happens across multiple devices. You could try emailing the developer directly at sup...@apps.dinglisch.net . Be sure to send a link to this discussion.

Rich..

JK

unread,
Aug 19, 2016, 11:47:42 AM8/19/16
to Tasker
I've tried plugging/unplugging both the mouse and the DAC through a USB hub.  Tasker now recognizes that both are being plugged/unplugged.

Let's see why the developer says...

Thank you.

JK

unread,
Aug 26, 2016, 12:30:36 AM8/26/16
to Tasker
Or not.

Antarctic

unread,
Sep 2, 2016, 2:13:26 PM9/2/16
to Tasker

Same behaviour with mine DAC, I have tried two profile the first is USB AUDIO connected and it work perfectly, the second is USB AUDIO INVERT but when I unplug the DAC nothing happens until I shut off the screen and switch on the tablet....
Note: sometimes after a long time (maybe 10 minutes) Tasker understand that USB AUDIO has been disconnected.... Can't understand whats going wrong.
My DAC is connected to a 4 port HUB btw.

I hope someone will help us on this issue.. thanx.
Reply all
Reply to author
Forward
0 new messages