From: Adrian K. <ad...@dr...> - 2010-06-16 12:05:18
|
Hi! I was tired of powercycling my DICE device each time it crashed. I noticed that FFADO is complaining about ISO channel registers not being clean (0xFFFFFFFFUL), because they actually contained a sane value. ;) Same holds true for the device owner register, FFADO expects the device to be unoccupied, but that's a little bit too strict, because there's another "good" case: if the current owner is us, because we were running before and just crashed on the software side. No need to abort everything in this case. Last but not least: GLOBAL_ENABLE usually is true when jackd has crashed. In this state, we cannot (or at least the current code says so) switch sample rates and the lot. Consequently, I set GLOBAL_ENABLE to false when restarting the device to re-enable all those functions. Long story short: with the following patch, I'm able to restart jackd after a crash without powercycling the device. ffado-test BusReset never worked for me, so I had serious motivation to address this issue. ;) It's a quick and dirty hack, but I'm posting it anyway so you can test your DICE devices if it breaks something. Perhaps it even works for you and would save you some powercycles in the future. In any case, please report back and discuss, so we could come up with a decent patch (without ifdefs and proper output). Cheerio Index: src/dice/dice_avdevice.cpp =================================================================== --- src/dice/dice_avdevice.cpp (revision 1856) +++ src/dice/dice_avdevice.cpp (working copy) @@ -1149,7 +1149,7 @@ return false; } - if (result != DICE_OWNER_NO_OWNER) { + if (result != DICE_OWNER_NO_OWNER && result != swap_value) { debugWarning("Could not register ourselves as device owner, unexpected register value: 0x%016"PRIX64"\n", result); return false; } @@ -1304,9 +1304,22 @@ } if(reg_isoch != 0xFFFFFFFFUL) { debugError("ISO_CHANNEL register != 0xFFFFFFFF (=0x%08"PRIX32") for ATX %d\n", reg_isoch, n); + /* The ISO channel has already been registered, probably + * because the device was running before and jackd just + * crashed. Let's simply reuse the previously selected + * ISO channel. + * + * FIXME: try to unregister the channel register and + * return to a clean state + */ + deallocateIsoChannel(isochannel); +#if 1 + p->setChannel(reg_isoch); + isochannel=reg_isoch; +#else p->setChannel(-1); - deallocateIsoChannel(isochannel); return false; +#endif } // write value of ISO_CHANNEL register @@ -1355,9 +1368,22 @@ } if(reg_isoch != 0xFFFFFFFFUL) { debugError("ISO_CHANNEL register != 0xFFFFFFFF (=0x%08"PRIX32") for ARX %d\n", reg_isoch, n); + /* The ISO channel has already been registered, probably + * because the device was running before and jackd just + * crashed. Let's simply reuse the previously selected + * ISO channel. + * + * FIXME: try to unregister the channel register and + * return to a clean state + */ + deallocateIsoChannel(isochannel); +#if 1 + p->setChannel(reg_isoch); + isochannel=reg_isoch; +#else p->setChannel(-1); - deallocateIsoChannel(isochannel); return false; +#endif } // write value of ISO_CHANNEL register @@ -1690,6 +1716,18 @@ } } + // FIXME: after a crash, the device might still be streaming. We + // simply force a stop now (unless in snoopMode) to return to a + // clean state. + bool snoopMode = false; + if(!getOption("snoopMode", snoopMode)) { + debugWarning("Could not retrieve snoopMode parameter, defauling to false\n"); + } + + if (!snoopMode) { + disableIsoStreaming(); + } + debugOutput(DEBUG_LEVEL_VERBOSE,"DICE Parameter Space info:\n"); debugOutput(DEBUG_LEVEL_VERBOSE," Global : offset=%04X size=%04d\n", m_global_reg_offset, m_global_reg_size); debugOutput(DEBUG_LEVEL_VERBOSE," TX : offset=%04X size=%04d\n", m_tx_reg_offset, m_tx_reg_size); -- mail: ad...@th... http://adi.thur.de PGP/GPG: key via keyserver |
From: Adrian K. <ad...@dr...> - 2010-06-16 12:09:37
|
On Wed, Jun 16, 2010 at 01:45:58PM +0200, Adrian Knoth wrote: > It's a quick and dirty hack, but I'm posting it anyway so you can test > your DICE devices if it breaks something. Perhaps it even works for you > and would save you some powercycles in the future. In any case, please Addition: For testing purpose, killall -9 jackd was handy to simulate an unclean shutdown. -- mail: ad...@th... http://adi.thur.de PGP/GPG: key via keyserver |