Jump to content

  1. 0
  2. 0
  3. 0/5

Rate this Topic

* * * * *
17 votes

Timur's Kernel - USB ROM - Most popular thread on Rootzwiki

  • This topic is locked

b0bd

b0bd

Member

  • 66 posts

Posted 18 January 2013 - 07:58 AM #231

This code does not claim to fix the pause issue. Did you really get it ported from 10.0 and working on 10.1?


Well I took the code and patched it in, and then compiled CM 10.1 successfully. I then took the /system/framework/framework.jar and put it on my n7 running smoothrom latest and the tablet is working fine. So what does that patch do? I'm sorry to ask, I thought it solved the pausing issue! I can put the jar file somewhere if its useful

edit: never mind, I see its to do with hotplugging USB audio devices. Which I thought was the pause problem but it isnt.

Edited by b0bd, 18 January 2013 - 08:07 AM.

  • 0 Likes

OP Timur

Timur

Android Master

Posted 18 January 2013 - 09:03 AM #232

Sorry for misunderstanding - the freeze happened after deep sleep without slave devices attached. I did not try deep sleep with attached devices.


Alright, the number of slave devices attached is not related to this issue at all. Anyway, I think I was able to fix this problem, which indeed only affects the mobile use variant. I have placed a beta version of the USB Power Mgmt kernel for CM10.1 on Nexus 7 in my dropbox. You find the download link at the bottom of http://timur.mobi/files . Can you please test drive this version and let me know? Thank you. I will provide an update for JB 4.2.x shortly.
  • 0 Likes

jmcguire525

jmcguire525

Android Lover

  • 102 posts

Posted 18 January 2013 - 03:17 PM #233

Well I took the code and patched it in, and then compiled CM 10.1 successfully. I then took the /system/framework/framework.jar and put it on my n7 running smoothrom latest and the tablet is working fine. So what does that patch do? I'm sorry to ask, I thought it solved the pausing issue! I can put the jar file somewhere if its useful

edit: never mind, I see its to do with hotplugging USB audio devices. Which I thought was the pause problem but it isnt.


so you are still having to pause before losing power to get the dac to reconnect even with the hot plugging?
  • 0 Likes

OP Timur

Timur

Android Master

Posted 19 January 2013 - 03:27 AM #234

Hot-plugging will switch output channels, whenever a new audio device is plugged in. And again when this device is unplugged. The power loss situation is different. Your DAC will not get unplugged. It is still there, a registered audio device. It just won't work "properly". Our intent is not, to switch to another audio device. What we do want to do, is to make it impossible for apps (all apps) to send audio data continue sending audio using old data handles to the DAC while it is off when it restarts. We can do this, by requesting a temporary audio focus from the system. As if we are a new music app. This will pause the current music app. However, we will not use this audio focus to play any audio. This will be similar to what happens, when a call comes in, while you are listening to music on a phone. We may need a little dedicated Android service to do this, because it may be difficult to implement this inside the kernel.

Edit: This functionality is only relevant to users of the FI kernel.

Edited by Timur, 19 January 2013 - 04:53 AM.

  • 0 Likes

AnyHertz

AnyHertz

Member

  • 29 posts

Posted 19 January 2013 - 08:42 AM #235

Timur,
I tested your latest mobile beta and found no issues. Great work!
Will wait for stock mobile version.
  • 0 Likes

OP Timur

Timur

Android Master

Posted 19 January 2013 - 03:56 PM #236

Timur,
I tested your latest mobile beta and found no issues. Great work!
Will wait for stock mobile version.


Yes, the OTG-pull-while-in-deep-sleep-crash is definitely solved. Goodness. There is one smaller thing to do before I will post new releases of both mobile kernels in the coming week. Thank you for posting back.
  • 0 Likes

jmcguire525

jmcguire525

Android Lover

  • 102 posts

Posted 19 January 2013 - 06:02 PM #237

Hot-plugging will switch output channels, whenever a new audio device is plugged in. And again when this device is unplugged. The power loss situation is different. Your DAC will not get unplugged. It is still there, a registered audio device. It just won't work "properly". Our intent is not, to switch to another audio device. What we do want to do, is to make it impossible for apps (all apps) to send audio data continue sending audio using old data handles to the DAC while it is off when it restarts. We can do this, by requesting a temporary audio focus from the system. As if we are a new music app. This will pause the current music app. However, we will not use this audio focus to play any audio. This will be similar to what happens, when a call comes in, while you are listening to music on a phone. We may need a little dedicated Android service to do this, because it may be difficult to implement this inside the kernel.

Edit: This functionality is only relevant to users of the FI kernel.


Sorry its been a while since I tested it and it was hard since the UI kept crashing... I thought it would work similar to unplugging headphones, when the headphones are no longer detected music stops playing. If music stopped when the DAC was no longer detected it would solve part of the pausing issue.

JW, is the mic working for anyone when connected to a DAC, I haven't tested but I remember someone saying this was a problem?
  • 0 Likes

OP Timur

Timur

Android Master

Posted 19 January 2013 - 07:38 PM #238

I thought it would work similar to unplugging headphones, when the headphones are no longer detected music stops playing.


I only realized how you (and others) were thinking about this issue, when I read your comment #233. And b0bd's in #231. No, when a USB DAC is suddenly powered off, it does not "log out" and the host will keep it being registered. Which is good, IF the host does not try to continue it's old USB audio session on the DAC, when it becomes available again.

Hi @b0bd, still here? I think that Android's AudioManager.requestAudioFocus() feature is the key to solving the in-car use case. A small Android service is needed, to listen to ACTION_POWER_CONNECTED broadcasts. It should call requestAudioFocus(), whenever a power loss is reported. And abandonAudioFocus(), whenever power gain is reported. No root required. No patching of framework or system. Thoughts? I'm asking, because I think you went to more effort already, to solve this. More: http://stackoverflow...wide-in-android
  • 0 Likes

b0bd

b0bd

Member

  • 66 posts

Posted 20 January 2013 - 06:44 AM #239

I'm still here - sorry - I spent some time yesterday in the Jeep playing with the kernel and my new jar. I can confirm it def does not solve the audio pause issue. I also tried using Tasker to use its music player to play a ding sound on power loss, but that does not work either. The Tasker Music Player does not grab audio focus so this does not work.

Timur, I think you're right that we need to grab audio focus - I was already working on a HD Radio App that would have to do that anyway! I'm super busy with kid hockey but I'll see if I can put together something quickly that I can launch from Tasker to prove the concept.

I also want to see if you can tell me how to compile your kernel with FI settings - I need to patch the cdc-ncm.c file to recognize my t-mobile hotspot. My Jeep FI is a big project but will be super sweet if I can get it completed. I also need to make sure my usb rs232 dongles to control the HD Radio tuner are in there.

Edited by b0bd, 20 January 2013 - 07:33 AM.

  • 0 Likes

b0bd

b0bd

Member

  • 66 posts

Posted 20 January 2013 - 07:53 AM #240

I wrote a simple app - "grabfocus" and I think I have it working, well it worked 3 times in a row in the jeep - its a frigid 14 out so I didn't want to spend too much time on it.

If you guys want to try it out, install http://www.midml.com...b/grabfocus.apk

When you run the grabfocus app, it should stop all your music playing and then exit in 3 seconds! If that is working, do a "Load App" in your Tasker shutdown profile. We can get a lot fancier - for example we can say we want the focus temporarily (temporarily as in when there is no power to the tablet), then release audio focus on power up and it should allow whatever was playing to restart. But that's the future.

edit: now I think about it, "temporary focus" might not work too well, a streaming app might keep streaming in the expectation of getting the focus back quickly.

Edited by b0bd, 20 January 2013 - 08:06 AM.

  • 0 Likes