EmpWake - An Alarm Clock for Your Empeg

Posted by: tonyc

EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 01:37

I did one of my famous marathon programming sessions this evening and the result is an early but functional release of EmpWake, which is my attempt at an alarm clock app. It binds to the Hijack menu and all that happy stuff. I guarantee it has bugs and it's very limited by the fact that I can't save state between reboots (so your alarm time won't be saved) but it's functional, at least for me.

There are config.ini parameters to set the defaults for what FID gets played when the alarm goes off and what the default alarm time is set to. Read my Empeg page for details

http://www.personal.psu.edu/users/a/m/amc156/empeg.html

I'm happy to hear any comments or suggestions.
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 11:05

Just fixed a bug where it wouldn't play while in standby mode. It's up on my page.

Hopefully Mr. Hijack will think about adding that disk-writing feature so I can save time/FID selections between reboots...
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 11:05

I havent tested it yet, but it looks like youhave enough in there right now to make it useful. I keep my alarm set for the same time during the week, so using the config for this is fine. Woohoo!

What if you don't want to pick a specific FID to start with? Will it work with your current playlist? If it were to play a FID only once I'd be nervous that I wouldn't get up, but that can always be solved by using repeat (which I just started dong after reading some of TonyF's messages).

When you're satisfied that you've cleaned up your source and put in whatever other goodies you have planned, PLEASE consider adding support for the phone mute line. I think I mentioned to you before I want to wire that up in my custom box as a snooze button (having a config.ini definition for default snooze time would be cool - normally 9 minutes on my Sony alarm I think).

Damn, now I've either got to start/finish my box or set up some total frankenstein temporary table-top hack to use this. I think I'm gonna go our to Walmart this afternoon to look at a few parts.

Bruno
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 11:09

Well let me know how/if it works for you.

I could make it work with the current playlist but I didn't think that was quite as useful. If I was listening to Enya before I went to bed, I think I would want something a little more energetic to wake me up. But having it use the current playlist is no problem, I'll add that in for the next version.

I don't know how I would go about using the phone mute line... Snooze button? Wow. I'm not sure I want to get that complicated with this. I really want to put my energy into the lyrics thing in the future. But if you can show me documentation or any other code where people have used the mute line, I'll see what I can do. Not sure I'll be able to test it here, though.
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 11:46

I hope someone chimes in with quick instructions on how you can sense that mute line. Method of operation would just be that you pause or otherwise mute the audio for the specified amount of time.

The only reason I mentioned current play list was because you could set up a list beforehand. I would probably leave it on some random list most of the time, but it would be nice to select a specific album, etc. This way you don't need any kind of interface or prefs of your own. You're just controlling on/off of the player.

It would be really neat if you'd hijacked the entire display to show the time (alternate display in your app I suppose). Of course this can be simulated by using the empeg's clock visual. I suppose if you release the source code, someone else can take over and add any features you don't feel like adding yourself. With Mark's wish for being able to use the serial commands to control the FIDs, this can work very well with more hacking. Damn, I'm gonna have to run out and buy a small 2 ch. amplifier and see what kind of small cheap speakers I can find. Otherwise I suppose I can test it on my home system (not ideal for daily alarm clock use )

Bruno

Bruno
Posted by: bonzi

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 13:00

Thanks for this cool little app. I am currently rummaging through my empeg constructing a playlist that starts gently but becomes very energetic within 10 minutes.
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 13:08

Yeah an actual clock display would be pretty slick. I could even have it as a fulltime clock display in a corner of the screen or something since we don't really get it very easily with the player. I can do that as well as a fullscreen clokc, but there are issues with the knob being bound to my app and not the player. I'll come up with something.
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 13:11

Thanks for this cool little app. I am currently rummaging through my empeg constructing a playlist that starts gently but becomes very energetic within 10 minutes.

Glad you find it useful. Let me know if you run into any problems. One thing I'm not sure of is how accurate the timing is... Like, I just have a detached thread sleep for the number of seconds until the alarm should go off. It should be accurate but I wouldn't use this as your only alarm clock until you're sure it's working right.
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 13:36

I'm starting empwake with Bitt's preinit.d and it seems to be starting fine.

First (only) bug (or "feature" that causes hang ) Pressing a button to bring up Hijack's "Clock" causes a hang if your interface is active.

I still have to see if this next one is something I've missed...

It doesn't seem to read from the config settings for me right now. So the active state isn't set and neither is the time (reads all 0's). If I manually set the alarm it will go off (a few seconds late) but will jump to some random tune while also choosing to play the entire player (tested by presetting to a single song or a small list before the alarm goes off and leave it in pause)

Also, the time displayed is always "Timezone-offset" hours from actual time. I'm using the Hijack time offset adjustment in the config to get Hijack to show the correct time. I guess you'll need such an offset option if you're not going to use Hijack's.

For now I've removed Hijack's time offset and have changed over to using GMT with the player. So my player clock always matches up with the time the kernel gets. It would be nice if you could read the current time details from wherever the player stores its settings, each time your menu pops up.

One suggestion... In your time setting, would you make it so that it wraps around the time? So going backwards from 00 will get me to 59. That'll make setting a lot faster.

[edit] Some other weirdness... On first entering your menu, it will sometimes skip over the "Time" item when I rotate the knob (and I'm rotating it very carefully by a single click). This instance it also took a long time for your interface to pop up. The screen stayed blank for some 2 seconds after clicking empwake in Hijack's menu.

Bruno
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 13:50

First (only) bug (or "feature" that causes hang ) Pressing a button to bring up Hijack's "Clock" causes a hang if your interface is active.

Hmm, I'll have to wait until Mark shows up to comment on that one. My guess is it has something to do with the fact that I'm using the overlay rather than full screen?

It doesn't seem to read from the config settings for me right now. So the active state isn't set and neither is the time (reads all 0's). If I manually set the alarm it will go off (a few seconds late) but will jump to some random tune while also choosing to play the entire player (tested by presetting to a single song or a small list before the alarm goes off and leave it in pause)

I need to see your config.ini and your serial output when you start EmpWake to figure this one out. Like I said in my disclaimer, my parsing and bounds checking is really lax right now.

What do you mean by a few seconds late? It takes a few seconds to load any playlist or song... Is that all you're talking about? You should hear some disk access right at the exact second (or close to it) that the alarm goes off, then the player has to load the playlist like it normally would.

For now I've removed Hijack's time offset and have changed over to using GMT with the player. So my player clock always matches up with the time the kernel gets. It would be nice if you could read the current time details from wherever the player stores its settings, each time your menu pops up.

Hmm I've never used any kind of time zone stuff before so I'm not sure how to correct this. I'm just calling localtime() right now.

It would be nice if you could read the current time details from wherever the player stores its settings, each time your menu pops up.

Yeah I just don't know where that is. Anyone else?

[edit] Some other weirdness... On first entering your menu, it will sometimes skip over the "Time" item when I rotate the knob (and I'm rotating it very carefully by a single click). This instance it also took a long time for your interface to pop up. The screen stayed blank for some 2 seconds after clicking empwake in Hijack's menu.

Well first the slowness in starting is something I've seen in the Viewer app as well. I think it has to do with the fact that the player is using realtime scheduling and unless user apps also do this (which means they'll steal CPU away from the player) those apps can get almost no CPU time if the player decides to do stuff. I think what's happening is the player's loading its cache or reading from disk and the user app therefore gets very little CPU.

I could tell EmpWake to use realtime scheduling (I did this with EmpTriv with some success) but then it's stealing CPU away from the player and if it gets really busy it could cause music to skip. I don't think an alarm clock is important enough to do that.

Now, as to the skipping over a menu option, I think what's probably happening there is you're accidentally sending a knob left or knob right code when you click the knob to start the program. Then you see the long pause, then it pops up and processes the knob left code which has been buffered. If that's not it, then I haven't seen the problem you're talking about.

One suggestion... In your time setting, would you make it so that it wraps around the time? So going backwards from 00 will get me to 59. That'll make setting a lot faster.

Sure, I can do that.
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 14:00

I've tried two variations with config.ini. I just copied your text and pasted it at the top of my ini file without success. And I've also tried it down near the bottom.

The problem with the skipping menu entry isn't when I first jump into your interface. It's only after rotating the knob. So it's not likely a queued up command. Doesn't happen all the time.

Here's my config in any case:

[empwake]
active=true
time=15:35:56
fid=1610
[synchronise]
seq_num=87
[tuner]
region=us
[controls]
stalk_side=none
[Options]
Name=Twisted Melon
[User Info]
Email=bruno@mypocket.com
Phone=519-927-7718
Name=Bruno Fernandes
[Network]
Gateway=0.0.0.0
Netmask=255.255.255.0
IPAddress=192.168.0.88
DHCP=1
[sense]
muteaction=1
mute=1
[power]
off_timeout=1800000
[display]
visual_names=1
caching=1
[aux]
source=
title=
artist=
[hush]
hushpercent=50
[volumecap]
enabled=0
[kenwood]
disabled=0
[ramp]
disabled=0
[wendy]
flag_amount=0
[custom]
wendy=
[searches]
amount=0
[menu]
quit=0
sort_playlist=0
[output]
notify=1

[hijack]
supress_notify=1

[ir_translate]
initial.H=Info

voldown=Clock
volup=Info

PopUp0=Mark,Visual+,Repeat,Swap,SelectMode
PopUp1=Genre,Year,Detail

b9460D.L=popup0 ;FM long
b9460D=artist ;FM

b9460C.L=popup1 ;AM long
b9460C=album ;AM

b94613=shuffle ;src

b9460B.L=Pause.L,null ;NextTrack long
b9460B=top ;NextTrack

b9460A.L=menu.L ;PrevTrack long
b9460A=menu ;PrevTrack

b94616=info ;att

b94614.L=NextTrack.L ;Volume+ long
b94614=NextTrack ;Volume+

b94615.L=PrevTrack.L ;Volume- long
b94615=PrevTrack ;Volume-

[VisualFavourites_AM]
count=0
[VisualFavourites_AUX]
count=0
[VisualFavourites_DSP]
count=0
[VisualFavourites_FM]
count=0
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 14:04

Oh, if you're going to touch the code to add something, I could really do with some way to cancel out without accepting changes. Using the cancel button on the remove and/or some face button would be cool with me. Right now all buttons except the knbox press drop down to the player. Likewise I'd love to be able to use empwake from the Rio remote without having to use the knob (this is less important than a cancel button for me though).

Seems that while not working completely as described for me yet, it does seem to work with randomizing the entire player as I was originally asking. Even if only by fluke.

Bruno
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 14:10

Hmm. I think the read of config.ini is failing completely but I don't have any debug output for that case right now. Is there *any* output on your serial port from Empwake when it starts?

Also, can you try running it from a regular shell prompt instead of from Bitt's preinit thing to see if there's something going on there?
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 14:14

Oh, if you're going to touch the code to add something, I could really do with some way to cancel out without accepting changes. Using the cancel button on the remove and/or some face button would be cool with me. Right now all buttons except the knbox press drop down to the player. Likewise I'd love to be able to use empwake from the Rio remote without having to use the knob (this is less important than a cancel button for me though).

Eh... I wanted to use as few buttons as possible. I kinda liked the idea of most of the button passing through to the player... I'll see what everyone else says. I don't think it's that difficult to click the button a couple times to accept the changes or to roll back to whatever time you really wanted. Does your current alarm clock have "undo" functionality?

Even if only by fluke.

No fluke. If config.ini doesn't work, I tell it to explicitly play the entire player. As of right now. That will be changed in the next release to just play whatever playlist is currently selected.
Posted by: jheathco

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 14:31

I'm up for making a little userland app that would sit in the corner of the screen and always display the date/time (maybe scrolling). But how would you get this to always be on display and still allow operation of other features on the empeg? Can you get a userland app to be activated on boot? It would be a hassle to always have to select it everytime from the hijack menu
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 14:36

But how would you get this to always be on display and still allow operation of other features on the empeg?

That's kinda what Mark's overlay functionality was made for. However there's a catch in that when the overlay app is running, it still has input focus. There seems to be no way to have the overlay apps "detach" so to speak so that you can then run other Hijack apps or whatever. I can unbind the buttons, but you can't then bring up the hijack menu or anything. This is kinda hard to explain, but I was hoping Mark might be able to find a way for multiple apps running in overlay mode, or for one of them to run "in the background" so to speak. Right now the on-screen clock I was talking about wouldn't work very well.
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 14:56

The reason I asked for a cancel method is because using the kob it's very easy for me to mess up the time. And no, my regular alarm clock doesn't have undo. It's a piece of crap. I also have to scroll through either the hour or minute UPWARDS only. And it doesn't play MP3s. Hence why I really want to use the empeg. Oh, and I also HATE radio (and buzzers).

Bruno
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 15:03

There's no output when I run it from shell (obviously). And if it doesn't start at init time, then how's it supposed to bind to hijack's menu?

If you can suggest anything else, let me know...

Bruno
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 15:07

There's no output when I run it from shell (obviously). And if it doesn't start at init time, then how's it supposed to bind to hijack's menu?

Apps can bind to Hijack at any time. Init has nothing to do with it.

I'm going to put a lot more debug stuff in the next release to tell me where it's choking on your config.ini. Is anyone else having this problem?
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 15:10

Oh, ok... Then when I run it from bash, it's not binding to Hijack.

This is bad news for me, but at the same time it gives me some extra time to hack together a better (half-usable) platform for actually having this thing firing off in the mornings.

Bruno
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 15:50

I don't know why it wouldn't be binding... I added a couple more debug statements, try with the new version that's on my page and let me know what you get on serial, if anything. I am checking all the return codes for binding to the menu, etc...
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 16:05

Cool, I like the new time interface! Less button pressing for small adjustments.

I found a couple of small graphical bugs with it though.
-Your seconds display is missing one veritcal row of shading on the right side when compared to minutes and hour
-When you highlight the seconds, the box is shift one pixel to the left of where it should be (you can see one blank column on the left)
-When you press the button to select the seconds adjustment, the right side of the highlight box disappears (again, because of the positioning of the box in the first place as mentioned above).

One small tweak to the interface... Can you make it so the box is restored after pressing the button? This way it's obvious that the button press took. (ie. Press button once, top and bottom of box go blank = input mode. Press button again, top and bottom come back=no longer in input mode). Oh, sorry two suggestions.. Would you put the colons back in there (somewhere) as well?

Ok, I'm going to check out the serial output now.

Bruno
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 16:13

Ok, the only output from empwake to serial is this:

EmpWake v0.97 running as pid 11
empwake: could not read config.ini

config.ini is there and is read by the player and by hijack. Set to 644 as usual as well. Same config I pasted into the other message.

And when I run it from the command line I get just the first line (showing PID). I also have to manually press return to get the prompt back (missing newline in output?) It still doesn't bind to the Hijack menu like this.

Bruno
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 16:17

Okay if that line is being printed, then this statement:

open( "/empeg/var/config.ini", O_RDONLY );

is returning -1 status. I can't think of any reason why that would happen if your config.ini is readable.
Posted by: wfaulk

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 16:31

IIRC, if he's using my preinit, then /empeg/var isn't mounted because it's actually on /drive0. Then again, I may be remembering totally incorrectly.
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 16:33

Okay run the attached empwake binary and tell me what it gives you. You should get an error number that I can use to tell what's going on.

Edit: The attachment didn't work. Use this link instead:

http://www.personal.psu.edu/users/a/m/amc156/empwake
Posted by: mlord

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 16:34

Perhaps the error messages should be changed to also dump out the "errno" value.. so we can see why something might be failing..

Cheers
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 16:35

Yeah I beat ya to that realization by about 30 seconds or so.
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 16:38

Hmmm that sounds about right. Argh... How am I going to handle that situation then?
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 16:41

Hey Mark, while you're here, any plans on getting that disk-writing feature into Hijack? That would let me save peoples' alarm clock settings...
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 16:43

errno 2

Bruno
Posted by: wfaulk

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 16:44

Putting your config file elsewhere would be an obvious solution.

You could also figure out how to wait for /drive0 to be mounted. If you figure it out, let me know, and I'll incorporate it into preinit so that folks in the future don't have to do the same thing.
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 16:46

Yup that's ENOENT, no such file or directory. That happens when you run it from the shell too? That means your /drive0 must not be mounted, which is strange, it should at least be mounted readable when you're in the shell unless you explicitly unmount it...

What the heck is going on here?
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 16:47

From the shell I don't get any error messages. But it doesn't seem like the app does anything because it isn't bound to Hijack.

Bruno
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 16:48

Putting your config file elsewhere would be an obvious solution.

Of course, but config.ini is the standard, and I like standards. Plus you can edit it from [j]?Emplode and such. I could just tell people to put options into a file in the same directory, but changing the defaults would be a pain.

I'm hoping that Mark decides to incorporate disk-writing into an upcoming hijack release, but he mentioned he's going to be busy for a while. For now I think I'm going to leave it in config.ini.

I guess I could just tell my program to sleep for 10 or 15 seconds to wait for everything else to load up, no? It's kind of a ghetto solution but it would work.

But Bruno said this was happening even from the shell, which is *really* confusing me. /drive0 should be there.
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 16:49

From the shell I don't get any error messages. But it doesn't seem like the app does anything because it isn't bound to Hijack.

No printf()'s or errors when run from shell? No idea what's going on there. I'll look at it.

Are you at least getting "EmpWake v0.97 running as pid" and then a pid? Does that pid appear in a "ps" listing?
Posted by: wfaulk

Re: EmpWake - An Alarm Clock for Your Empeg - 17/03/2002 16:53

Well, since config.ini must exist for the player to function properly, I see no problem with putting a stat() and an alarm() inside a loop waiting for it to exist.

Unless someone knows of a way of waiting on a filesystem to be mounted. getmntent() might be a good place to start, but, given that df, etc. don't work, getmntent() may not work, either.
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 18/03/2002 14:33

Hey would anyone care if I dropped the seconds from the alarm setting? I can't see any good reason why you'd need that much precision for an alarm clock. I'll leave the seconds display for the clock portion, but I don't think it should need to be specified. Comments?

Also, anyone think a "sleep" feature would be cool? Like here's what I was planning on:

1. It's late and you want to go to bed with some music. You queue up whatever playlist you want (yourself) and set a sleep timer (30 minutes, whatever.)
2. EmpWake puts your Empeg into standby when that time has elapsed.
3. If you've got an alarm set, it wakes you up with your alarm FID, or optionally just plays whatever song it was playing when it went into standby.

I was also planning on adding the ability to set the alarm volume so that you can go to bed with a nice soft volume and have it crank up for your alarm. Sound good?

No promises on when this stuff happens but these seem like useful ideas to me.

By the way, anyone made any progress on a nice InstallShield type thing for the Empeg? With the FTP server in Hijack this would seem really easy now... It's a pity that we're all writing these cool apps and the users who don't know their way around Linux are out of luck...
Posted by: wfaulk

Re: EmpWake - An Alarm Clock for Your Empeg - 18/03/2002 14:39

I would suggest that a nice option would be on alarm to be able to ramp the volume up slowly, so that it doesn't wake you with a start.
Posted by: genixia

Re: EmpWake - An Alarm Clock for Your Empeg - 18/03/2002 14:41

By the way, anyone made any progress on a nice InstallShield type thing for the Empeg? With the FTP server in Hijack this
would seem really easy now... It's a pity that we're all writing these cool apps and the users who don't know their way around
Linux are out of luck...


This sounds like a perfect job for JEmplode. JEmplode takes a tar ball checks it for validity (simple stupidity check to ensure that it is an empeg app tar ball, perhaps looking for a zero-length file .empegapp), and puts it on the empeg.

This would allow Windoze and *nix users to use it.
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 18/03/2002 14:59

This sounds like a perfect job for JEmplode. JEmplode takes a tar ball checks it for validity (simple stupidity check to ensure that it is an empeg app tar ball, perhaps looking for a zero-length file .empegapp), and puts it on the empeg.

You skipped a few steps...

1. Prompt the user for an install location.
2. Optionally, depending on how the developer has configured the install to run, or based on user's choice, add a shell script to wfaulk's preinit thing so that it gets run on startup.
3 Provide a UI for setting configuration defaults and writing them to either the app's own config file (we'd need a standard, the INI standard is fine by me) or editing the config.ini itself. For my alarm clock, the "InstallShield" would ask the user "would you like EmpWake to automatically enable the alarm on startup?" and this would correspond to "active=true" being added to the config.ini.

But yeah JEmplode would be a nice place for this. Mike's pretty busy these days though. I'm a Java programmer but mostly with servlets and such, I've never done any Java application programming to speak of.
Posted by: tms13

Re: EmpWake - An Alarm Clock for Your Empeg - 18/03/2002 15:01

In reply to:

config.ini must exist for the player to function properly




That's not true - unless it's changed since 1.03?
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 18/03/2002 15:01

I would suggest that a nice option would be on alarm to be able to ramp the volume up slowly, so that it doesn't wake you with a start.

Duly noted. I thought about that but not at the time I was writing that post. I figure one volume step for every 15 seconds should suffice. I'll probably add a "start volume" and "max volume" and have it step in between those two for wakeup.
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 18/03/2002 20:09

Since no one else has mentioned it, I agree with all the suggestions you've made. Go for it. I was going to ask you to consider removing the seconds as well. I can see their use, but it's extreme-niche at best. Makes it so you can store the alarm time in less space too. 2 vs 3 bytes (11bits vs.17bits minimal anyway).

Any more progress on the config.ini thing affecting me yesterday? Just wondering why Hijacks gets access to the config file without a problem and your app doesn't...

Bruno
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 18/03/2002 20:16

Any more progress on the config.ini thing affecting me yesterday? Just wondering why Hijacks gets access to the config file without a problem and your app doesn't...

Well, no. You didn't respond to my last message asking if you get *any* printf outputs when you run it from a shell. You should *at least* get "EmpWake running as pid" and, if it's not binding to hijack, some kind of error printout. Nobody else seems to have any problem running it from a regular shell.

As for running from the preinit thing, I don't know how I'll solve that. The easy solution is to have my own ini file that can be placed in the program's current directory, but I kinda liked the ability to edit config.ini via Emplode or similar.

Since it's a two minute hack, I can provide a command-line override to look for the empwake options in another file. So that should get us around the drive0/drive1 not mounted at boot problem. As for why you can't run it from the shell, I'm stumped, you really need to tell me more about what's going on there.
Posted by: mlord

Re: EmpWake - An Alarm Clock for Your Empeg - 18/03/2002 20:21

Why not just have it (1) try to open /empeg/var/config.ini, and (2) if that fails, sleep(2) and loop back to (1), repeating until it doesn't fail.

-ml
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 18/03/2002 20:25

Why not just have it (1) try to open /empeg/var/config.ini, and (2) if that fails, sleep(2) and loop back to (1), repeating until it doesn't fail.

That's what I mentioned doing earlier in the thread... But I thought there might be a way for the preinit thing to wait until the drives are mounted before doing its work. Then all apps started from preinit would have access to /drive0 and /drive1. That could be even more important if we want to install some userland apps on those drives, which people might want to do since (a) the root partition isn't that large and (b) it gets wiped when upgrades happen. There's really no standard for where to keep user apps (I've suggested the empty hda2, a nice 32MB partition that's not really used for anything else) but by default that partition isn't doing anything, so most users don't use it for anything.

I'll try implement the sleep thing in the next release. I haven't even tried Bitt's preinit thing yet but maybe now is a good time to try it out.
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 18/03/2002 20:32

I didn't see the message about the printfs until just now.

But, the answer is exactly the same as what I posted yesterday. I get the first line showing PID, but no error messages from the command line.

How do you have your own installation launching at startup? Let me know how you've got yours configured and I'll duplicate it and get back to you.

Bruno
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 18/03/2002 20:50

[How do you have your own installation launching at startup? Let me know how you've got yours configured and I'll duplicate it and get back to you.

I have been calling the "picker" app by rexkp (his server seems to be down right now) from Frank van Gestel's userinit. That allowed me to use front panel buttons to run various programs depending on what I needed. Empwake is one of those.

I just dropped in Bitt's preinit.d thing Try adding this line to the shell script that's calling EmpWake:


/bin/mount -n -o nocheck,ro /drive0
/usr/local/bin/empwake


.

The second line should point to wherever your EmpWake is. If you explicitly mount drive0 before EmpWake, you should be fine (I just tried it.)

I still have *no idea* why it's not running from your shell. I have error messages checking the return calls from virtually every Hijack ioctl. I'll try to add some more, but if you get this preinit thing working, you should be fine.
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 18/03/2002 21:10

After modifying the shell script to include the line you posted, my unit now takes about 20-25 seconds to boot. It sits there building the database... When it's done, empwake is not in the Hijack menu.

Looking through serial, it reports I have a database size mismatch error...

Do you have only a SINGLE drive system? Mounting /drive0 in the preinit with the above line, prevents the player from finding and mounting my second disk, causing the database error.

Ok, next suggestion?

Bruno
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 18/03/2002 21:14

After modifying the shell script to include the line you posted, my unit now takes about 20-25 seconds to boot. It sits there building the database... When it's done, empwake is not in the Hijack menu.

WTF??? No I have two drives but I don't have any problem with the 2nd drive mounting when I put that line in my shell script. I guess it's because my "init" calls a "userinit" shell script which takes care of mounting my drives before the player starts.

Mount both /drive0 and /drive1 and see if that helps. I never had any database rebuilding problems.

Even with that in mind, EmpWake should have bound to your Hijack menu. If it hasn't then something is really screwed up.
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 18/03/2002 21:25

Just let me know how to mount /drive1. You can't just mount it with the line you posted for /drive0. There's no /drive1 entry in /etc/fstab or /etc/mtab (error returned from mount).

Damn, hyperterminal is the poorest piece of crap excuse for a terminal to have ever been made. What a complete piece of junk. I wish for any of the terminals I used to use on the Amiga damn. Have to get back a simple nice VT100 term I was using a few years ago. Argh.

Bruno
Posted by: wfaulk

Re: EmpWake - An Alarm Clock for Your Empeg - 18/03/2002 21:38

CRT/SecureCRT are the best Win32 terminal emulators I've used, but they're not free. TeraTerm is free, and, while it's not the best thing available, it doesn't have most of the annoying quirks that HyperTerminal does. (Ever noticed that MS licensed HT from someone else? It isn't even just a PoS MS application.)
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 18/03/2002 21:55

Just let me know how to mount /drive1. You can't just mount it with the line you posted for /drive0. There's no /drive1 entry in /etc/fstab or /etc/mtab (error returned from mount).

Well put an entry there.

#
# /etc/fstab
#
# <device> <mountpoint> <filesystemtype> <options> <dump> <fsckorder>
/dev/hda5 / ext2 defaults,ro 1 1
/dev/hda4 /drive0 ext2 defaults,ro 1 1
/dev/hda2 /usr ext2 defaults,ro 1 1
/dev/hdc4 /drive1 ext2 defaults,ro 1 1
none /proc proc defaults


.
Then you should be able to mount it with that command. If that STILL fails, try this:


/bin/mount -n -o remount,nocheck,ro /dev/hdc4 /drive1

.
Note that drive1 might be hdb4 on yours, it's hdc4 on mine. If so, adjust accordingly.
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 18/03/2002 21:57

About 5 seconds after posting the message I was looking through my old backup drive copy and I found an archive with TeraTerm (first 2.0 version from 96). Runs fine and does what I need it to do. Phew. I'll try the latest version but I didn't feel like a 900KB download tonight. (Which reminds me, I have to install jemplode, my last 900KB download... )

Bruno
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 19/03/2002 19:43

So Bruno did this end up working out for you???
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 22/03/2002 18:26

Been away Tony, haven't had the time to check it out. Also didn't see your reply until just now. Which is weird because when I clicked on the thread it skipped to the bottom and I had to scroll back up manually...

If I don't still have a headache later tonight, I'll give it a shot. Otherwise I'll check it out this weekend. BTW, I don't grok manual drive mounting in linux, so that's for posting that entry. I haven't manually mounted a drive since using an Amiga (and that was a long time ago).

Bruno
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 22/03/2002 18:44

If I mount the drives in the preinit before, then booting happens properly, BUT, empwake does not bind to the hijack menu.

On the serial port, there is no error from empwake either. Just the single line saying was process ID it received when starting.

And, again, WITHOUT mounting the drives, I get errno2 (Can't readconfig.ini)

I'll ask again in case you missed it (and b/c I'm curious) - how does Hijack find and read the config file?

Next of course is why on earth we'd be getting different behaviour with basically the same hardware setup. Discounting drive startup times of course - maybe you can build a version with that delay to test for this...

On second thought, I just remembered that I aldo dont' get the program to bind when running it from the shell prompt myself. Argh. Very odd. Any more debug output you care to test with? Or some other sample program for testing puposes only?

Bruno
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 24/03/2002 21:59

I'll ask again in case you missed it (and b/c I'm curious) - how does Hijack find and read the config file?

Not sure what you're asking here. The drives are mounted at that point so Hijack has no problem. I have no idea why it's not binding to your Hijack menu and I'm out of ideas. I can try to stick some more trace debug lines in but I won't get to it for a few days as I just got back into town and have a lot of catching up to do in other areas. I'll let you know though.
Posted by: bonzi

Re: EmpWake - An Alarm Clock for Your Empeg - 03/04/2002 13:54

I finally got around to install empwake (after deciding on Tchaikovsky's 1812 Overture as the ideal wake-up tune), and I can't get it to work. I tried starting it manually and as 'M' script from preinit.d (that is, one of those starting only after config.ini is available). It starts, reports its PID and silently dies. There are no traces of it in Hijack menu. Any ideas? BTW, is FID in config.ini hex od decimal (I tried both)?
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 03/04/2002 14:29

1. FID should be in hex, with no leading 0x or anything like that. Just the same as the FID file's name.
2. I'm not sure why it's silently dying. I have debug prints if any of the hijack ioctl()'s return errors. However there are probably other places where it could die without warning, I will look into that. So far I have an odd scenario where a majority of people are telling me it works fine, but two people (yourself and Bruno) saying it silently dies. So there definitely is a problem.

I am insanely busy moving into a new apartment right now but the next version will definitely have more trace prints to try to see where this problem is. EmpWake is my #1 priority right now, with the lyrics, trivia game, and text-to-speech stuff way in the background... So I think you can expect an instrumented Empwake in the next week.
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 03/04/2002 14:30

Oh, the FID number should be the *0 fid (ASCII fid), not the *1 fid (mp3 file FID.) I am not sure what would happen if the *1 FID were specified... But I doubt that's the problem here.
Posted by: hybrid8

Re: EmpWake - An Alarm Clock for Your Empeg - 04/04/2002 19:52

Hmmmmm....

I'm going to go "play" with empwake again even though my eyes are burning out of their sockets.

BTW, good luck with your move. I'm looking at jumping into a house in a couple of months and have been busy getting my finances together. Been away from the BBS for a while too.

Glad to know empwake is at the top of your coding list. I'm sooooo anxious to start using it. I am so close to the point of throwing my alarm clock out the window. I'd start the carnage by strangling the morning radio "personalities" (they have no personality) if they were next to me.

Bruno
Posted by: tonyc

Re: EmpWake - An Alarm Clock for Your Empeg - 05/04/2002 09:31

Yeah, the move went pretty well. I'm now on cable modem service and it was activated within an hour of setting up my account! This is very new to me coming from the DSL world where you're lucky if you can connect within a month of placing your order. Goodbye, Earthlink!

As for EmpWake, I have a mid-term exam to work on this weekend but if I get that done early I hope to do some hacking. First thing I'll do is instrument the hell out of it to see why people are having problems. Then I'll drop in some features. Still missing the most important one (saving the alarm time between reboots) but it's still functional without that.

Once EmpWake is done, I think text-to-speech might crawl up to the top of the list. That was looking pretty promising the last time I played with it.