Topic: cp feature request

I'm having the same problem with my chumbies (classic and 8), although it only happens every now and then.  I think it could be due to the occasional power dip on my local grid causing the chumbies to reboot.

To get around it, I've created a cron job that puts them back into night-mode immediately after rebooting between certain hours.  The only problem is that it sometimes (maybe 10% of the time) doesn't work :-(.

I'm guessing it's failing when the call to enter night mode is made before the control panel has finished loading.  I could add a 'sleep' delay to the bash script - or just run it one minute later - but I'm hoping for a cleaner solution.

Is there any way that I can determine (via my bash script) whether the chumbies actually are in night mode?  If I can get this information somehow, I'll instruct the cron job to rerun every minute until it succeeds.

Re: cp feature request

Well, the Control Panel does set a flag indicating that it's currently in night mode, however, unfortunately, it's set in /tmp, which does not survive a reboot.

I suppose you could set a cron job to copy /tmp/nightmode to /psp/nightmode and sync the file system.  In order to keep the wear on the Flash down, you could copy it only if it's different.

As to *when* to send a Control Panel event to go into night mode after boot, you could wait until /tmp/currentProfileID exists, that means the device has successfully authenticated and is, or about to be, playing widgets.

Re: cp feature request

What you've written (i.e. /tmp/nightmode and /tmp/currentProfileID) only seems to work on my chumby classic.  Neither of those files are created on my chumby 8.  Why is this the case, and are there any equivalents elsewhere?

If not, my original questions still stand: how can I determine when the chumby 8 is in night mode, and how will I know when its control panel has finished loading?  The 8 is right next to my bed, so I need to get this working on it.

Re: cp feature request

Let me take a look to see what it might take to add that functionality to the C8 Control Panel.

Re: cp feature request

Thanks, Duane: much appreciated.  Thanks also for getting the chumby service back online.  I look forward to your response in due course.

Re: cp feature request

Hi Duane,

Did you get a chance to add this functionality (i.e. /tmp/nightmode and /tmp/currentProfileID) to the C8 Control Panel yet?  I'm guessing it'll just be a matter of copying the code across from the classic.

This problem woke me up again last night, and I had to fumble around in the dark for the power button.  My classic seems to have gone on the blink lately, so I can't just replace the C8 with it in my room.

Re: cp feature request

Read my very first comment (24) to know why that won't work in my case.  No offence, but I'm really only hoping for replies from Duane on this matter.

Re: cp feature request

Sorry, I haven't gotten to that yet.

Re: cp feature request

diamaunt wrote:

*shrug* in my experience, and others, the c8 cp dies occasionally. are you certain that in these cases the machine has rebooted? have you checked it's uptime (which would not be reset on a cp dying)

The impression I got is that the other posters to this topic were facing this problem regularly.  It only happens to me every now and then, about as often as the power to my unit cycles my other devices.

Even if what you're saying is correct, the solution you've suggested is just a dodgy workaround.  The one I'm hoping Duane will port over from the classic is a nicer workaround and the code already exists.

Re: cp feature request

I liken this situation to marrying the first woman who throws herself at you.  Fools who rush in like this regret their decision when someone better comes along.

In the unlikely event that your dodgy workaround solves my problem, Duane would no longer have the motivation to (eventually) implement the better solution.

Re: cp feature request

Xavion wrote:

I liken this situation to marrying the first woman who throws herself at you.  Fools who rush in like this regret their decision when someone better comes along.

Although, perhaps the prudent person would at least date the first woman a few times, just in case she's not just the first but also the only one who's that keen...
Similarly, you could spend a bit of time with Diamaunt's solution, whilst still saving yourself for Duane's long term commitment wink

Re: cp feature request

I think that all of you are missing the obvious solution. Simply create an alarm/task for every minute that you sleep to put the device into night mode. At worst, you'll only face the bright screen for one minute.

or just buy a UPS.

Re: cp feature request

diamaunt wrote:

your rudeness notwithstanding, you claim that your chumby is rebooting in the middle of the night, you *guess* due to power cycling.
again, i ask, have you logged into it and checked uptime to verify that it has actually rebooted?
do you have other evidence that it's power losses that are causing it? rebooted computers, flashing alarm clo...
you know what? I don't care anymore.
wait and complain, and whatever else makes you happy.

I had a feeling you'd respond like that, and also that I'd feel compelled to reply.  It seems that you're mainly trying to save face, whereas I'm mainly trying to prevent Duane from thinking that your solution works for all.

If I'm awoken in the middle of the night, my primary concern is getting back to sleep ASAP.  The fastest way to achieve this is to hit the power button and shut-down the C8 altogether.  Navigating through the menu system to put it back into night-mode manually - so that I can analyse the uptime when I get up hours later - would only wake me up further.

Given that the problem occurs here very rarely, it might be some time before it happens again.  When it does, I will still want to shut the damn thing down as quickly as possible and get back to sleep.  So, I don't know that I'll ever be willing to get the information you're requesting.

If implemented correctly, the solution I've asked Duane to port over from the classic will work for everyone in this thread.  This is assuming that: the C8 control panel is automatically restarted after crashing; the "/tmp/nightmode" file is removed when this happens (i.e. because it's back in day-mode).

With this in mind, it doesn't really matter what's causing my C8 to drop out of night-mode.  However, I mentioned in an earlier post (34) my reasons for thinking that power cycling is probably to blame in my case.

I get the impression that Duane didn't need to read any of this because he knew it already.  That's probably why he has already agreed to accede to my request (at some stage).

This is why I wrote way back in post 31 that "I'm really only hoping for replies from Duane on this matter".  You say you don't care anymore; from my perspective, it would've been better if you never had.  Are you ready to quit now, or must we continue to waste each other's time?

nathanm wrote:

I think that all of you are missing the obvious solution. Simply create an alarm/task for every minute that you sleep to put the device into night mode. At worst, you'll only face the bright screen for one minute.
or just buy a UPS.

Good on you for thinking outside the box.  However, I can tell you that I've already tried forcing my C8 (back) into night-mode every minute via a cron job.  If it's already in night-mode, and is then instructed to go back into it again, this unfortunately causes the screen to flicker (back into day-mode) momentarily.  I wouldn't want this to be happening every minute throughout the night.

Regarding your other suggestion, I'd prefer not to have to fork out for a UPS for my bedroom :-).

Re: cp feature request

I've deployed C8 Control Panel 5.0.38b2, which adds the support for /tmp/nightmode and /tmp/currentProfileID

Note that the C8 CP does not necessarily start playing apps after boot, so the /tmp/currentProfileID file will be written with '0' when the CP has stabilized, and will rewrite it with the actual channel ID if/when the device actually starts playing apps.

You'll need to reboot your device to get the new CP.

Re: cp feature request

Hi Duane,

Thanks very much for looking into (and implementing) this as promised, especially considering that you've done so on a weekend!  I'll also take this opportunity to apologise if any of my other posts were at all inappropriate.

One thing I'm noticing is that "/tmp/nightmode" isn't updated when/after the CP is loaded.  If I put the C8 in night-mode, then kill the CP (via "killall chumbyflashplayer.x"), "/tmp/nightmode" still contains "1" after the CP automatically re-spawns.  Similarly, when the CP loads after a reboot, "/tmp/nightmode" doesn't exist until the C8 is sent into night-mode.

As written in my somewhat long-winded rant (above), creating "/tmp/nightmode" and setting it to "0" when/after the CP loads would also solve the case that "diamaunt" was referring to (in the other thread).  What do you think about this idea?

Re: cp feature request

If the file is missing, assume it's in day mode.  I'll see if I can get it created earlier in the startup process.

Re: cp feature request

Actually, "/tmp/nightmode" isn't created at all during the startup process.  It only gets created after I manually put the C8 into night-mode (either via the CP or Bash).

If the CP then crashes and re-spawns, "/tmp/nightmode" still contains "1" afterwards.  If you can force it to "0" whenever the CP loads, everyone in this thread will be happy!

Speaking of night-mode, it'd be really good to have its "crescent moon" icon (i.e. the one you push to start night-mode) shown on a couple of the other screens as well.

When playing apps, the black toolbar that comes up when you push the C8's menu button - I really think there needs to be a way to start night-mode from that toolbar.

Similarly, the "My Channels" window has the (alarm) bell icon but not the crescent moon icon.  I've wanted to start night-mode from that window many times in the past.

Re: cp feature request

OK, reboot the device to get a new CP (same version number) - it should be setting /tmp/nightmode to "0" when the CP is (re)launched.

Adding the nightmode icon to other screens will take a bit more examination.

Re: cp feature request

Cool, thanks for fixing that; everything looks to be in order now.  Are you able to backport this change to the classic's CP?  I don't even know if mine works anymore.  It got a bit waterlogged a few weeks ago, courtesy of a leaking laundry hose connector :-(.

Re: cp feature request

On the 3.5" devices, the /tmp/nightmode file indicates to the CP that it should go into night mode as soon as it can, so it should not reset it on restart.  I believe this functionality was added to support the backup alarm, which causes a CP restart.

Re: cp feature request

In that case, maybe a hybrid solution on both platforms would be best.  If "/tmp/nightmode" exists and is set to "1" when the CP loads, send the chumby into night-mode.  If it doesn't exist when the CP loads, create it and set it to "0".

This would prevent the other users in this thread from having to write a cron job at all.  The chumby would automatically be sent back into night-mode after the CP crashes and re-spawns.

It would also prevent Average Joe - who's not even aware of this thread - from being woken up in the middle of the night whenever his CP crashes.  However, more advanced users would still need to write a cron job if their version of this problem is caused by power cycling.

Re: cp feature request

I need to see what the implications are for the C8 CP which, rightly or wrongly, wasn't designed for this functionality.  There are some unusual timers and things that might interfere with putting the device into night mode automatically at startup.  We don't want it starting to play widgets in night mode, for instance, which I'm pretty sure it would do the way it's currently written.

This also doesn't solve the original problem of having /tmp/nightmode survive boot - I'd also need to think through the implications of moving that flag to /psp.

Re: cp feature request

No worries; take your time deciding.  You've solved my main problem already, anyway.  Thanks again for your efforts thus far.

Re: cp feature request

Bugger, I've just come across another strain of this problem.  I woke up during the night to see that my C8 had escaped night-mode, and the "Network Configuration" screen was displaying.

The C8 hadn't rebooted, as the uptime is currently at 2+ days.  I'm assuming my router and/or Internet connection simply went down for a while.  Is there any way that we can stop the C8 from coming out of night-mode in this case?

Re: cp feature request

stay in night mode, to see message, in the morning, tap screen....