#27982 - 12/03/2001 11:40
Empeg boot up menus?
|
carpal tunnel
Registered: 20/12/1999
Posts: 31602
Loc: Seattle, WA
|
I'm running a program called "Selecter" at boot-up. Depending on which button I press, It sends an IOCTL to RJlov's volume adjustment kernel. I can choose to turn voladj on and off, and choose between two different degrees of compression.
The only problem with "Selecter" is that there's no on-screen feedback, you just have to know what buttons to press and when.
I saw some other programs at the owner's meet which did boot-up selections, and they had great on-screen displays. Were any of these capable of sending an IOCTL? Can anyone help me set up one of these to replace Selecter in my init?
Note: I'm not sure how selecter communicates with the kernel, other than to know that it uses an IOCTL. I don't even know what an IOCTL is (perhaps it's the linux equivalent of a DDE message?), or what information is contained in the message from selecter. ___________ Tony Fabris
|
Top
|
|
|
|
#27983 - 12/03/2001 16:16
Re: Empeg boot up menus?
[Re: tfabris]
|
carpal tunnel
Registered: 25/06/1999
Posts: 2993
Loc: Wareham, Dorset, UK
|
An Ioctl() is a "catch all" function built into a device driver for a device in a UNIX system.
Normally, each device driver that sits under the kernel has a defined set of functions that are callable by the kernel to do standard operations (read(), write(), open(), close(), etc.). This is pretty much the case with device drivers on all OSs I've worked on. However, your brand-spanking new "Whizz-O" device may just have some whacky new feature you want to use that doesn't fall under one of the standard DD function calls - for example, the "Jello Squirt" function, and the "Select Jello Colour" function won't sit easily under a read() or write() function, since it will have undesirable (and probably unexpected) results when the kernel wants to send the "Whizz-O" a file to write, for example.
So what you do is build the function you need under the Ioctl(), one layer deeper. To call the "Select Jello Colour" feature of the device, you call IOCTL( Device, Function, NewColour) (where Device = "Whizz-O", and Function = "Select Jello Colour"), then to make it squirt the Green Jello (NewColour was, of course = "Green" in this case ) you then call IOCTL( Device, Function, NULL) (where Function = "Squirt").
So there you go, IOCTLs in a nutshell. Clear as Mud? Good. There will be a test at the end of class. One of the few remaining Mk1 owners... #00015
_________________________
One of the few remaining Mk1 owners... #00015
|
Top
|
|
|
|
#27984 - 12/03/2001 16:25
Re: Empeg boot up menus?
[Re: schofiel]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31602
Loc: Seattle, WA
|
Thanks for the lesson. Now, do any of those nifty menu programs I saw at the meet do this? ___________ Tony Fabris
|
Top
|
|
|
|
#27985 - 12/03/2001 17:08
Re: Empeg boot up menus?
[Re: tfabris]
|
carpal tunnel
Registered: 08/06/1999
Posts: 7868
|
The one I use, and I believe the other popular one both can call any program on the empeg. So in theory, even if they can't do the necessary call on their own, they can call a program that can do it for you.
Most of my menu items call scripts to do a few functions.
|
Top
|
|
|
|
#27986 - 12/03/2001 17:24
Re: Empeg boot up menus?
[Re: drakino]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31602
Loc: Seattle, WA
|
Most of my menu items call scripts to do a few functions.
So can I send an ioctl from a script? ___________ Tony Fabris
|
Top
|
|
|
|
#27987 - 12/03/2001 18:00
Re: Empeg boot up menus?
[Re: tfabris]
|
carpal tunnel
Registered: 08/06/1999
Posts: 7868
|
Looking into it (I have never used them, my programming hasn't gotten to that point yet), you need a program to do it, as ioctl is a function. So, a quick program to run an ioctl with parameters passed from the shell, and you could use any menu program you want.
(Searching google for ioctl turns up plents of references to the man page on it).
|
Top
|
|
|
|
#27988 - 13/03/2001 00:43
Re: Empeg boot up menus?
[Re: tfabris]
|
old hand
Registered: 12/08/2000
Posts: 702
Loc: Netherlands
|
Tony,
If you give me the source of selector, I can generate a simple executable which will generate the ioctl.
Look here for blitmenu, which is a scrolling menu-selector executing shell-scripts. Frank van Gestel
_________________________
Frank van Gestel
|
Top
|
|
|
|
#27989 - 13/03/2001 10:23
Re: Empeg boot up menus?
[Re: fvgestel]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31602
Loc: Seattle, WA
|
Unfortunately, I only got the binary of selecter. I don't know where it came from. I'll direct Richard here to this thread and see if we can get help from him. ___________ Tony Fabris
|
Top
|
|
|
|
#27990 - 13/03/2001 14:44
Re: Empeg boot up menus?
[Re: tfabris]
|
member
Registered: 16/12/1999
Posts: 188
Loc: Melbourne, Australia
|
I'm sorry, I haven't really had time to be keeping up with the messages here lately.
I shall attempt to attach a file! Hm, it's actually a .c file, but apparently that's not allowed. I'll try again.
Attachments
27223-selecter.txt (162 downloads)
|
Top
|
|
|
|
#27991 - 13/03/2001 15:19
Re: Empeg boot up menus?
[Re: rjlov]
|
old hand
Registered: 12/08/2000
Posts: 702
Loc: Netherlands
|
I also started compiling something. Look at at the attachment
Frank van Gestel
Attachments
27236-voladj.zip (26 downloads)
_________________________
Frank van Gestel
|
Top
|
|
|
|
#27992 - 13/03/2001 16:02
Re: Empeg boot up menus?
[Re: fvgestel]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31602
Loc: Seattle, WA
|
Thanks! Working on getting it integrated now.
My only question is what the default parameters to voladj are. Guess I can dig that out of Richard's sources. ___________ Tony Fabris
|
Top
|
|
|
|
#27993 - 13/03/2001 16:52
Re: Empeg boot up menus?
[Re: fvgestel]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31602
Loc: Seattle, WA
|
Me and Drakino are having problems getting it to work.
It won't take the number of params you specified, and it segfaults when I give it four parameters instead of five.
Also, somehow it seems to have screwed up selecter, I don't know how. From now on, when I run selecter, it returns a -1 error whenever I try to use it. I'm confused. ___________ Tony Fabris
|
Top
|
|
|
|
#27994 - 13/03/2001 16:56
Re: Empeg boot up menus?
[Re: tfabris]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31602
Loc: Seattle, WA
|
Okay, the messed-up selecter thing is my fault. Still, Drakino and I are suspicious that the argument count test is wrong. We're investigating. ___________ Tony Fabris
|
Top
|
|
|
|
#27995 - 13/03/2001 17:00
Re: Empeg boot up menus?
[Re: tfabris]
|
old hand
Registered: 12/08/2000
Posts: 702
Loc: Netherlands
|
Stupid mistake on my side. new version in attachment.
And before you ask, I've also placed a blitmenu executable in the blitmenu.tgz file
Frank van Gestel
Attachments
27244-voladj.zip (28 downloads)
_________________________
Frank van Gestel
|
Top
|
|
|
|
#27996 - 13/03/2001 17:01
Re: Empeg boot up menus?
[Re: fvgestel]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31602
Loc: Seattle, WA
|
THANKS!
Okay, trying again. Still not sure what some of the parameters should be, but I'll play with those. ___________ Tony Fabris
|
Top
|
|
|
|
#27997 - 13/03/2001 17:29
Re: Empeg boot up menus?
[Re: fvgestel]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31602
Loc: Seattle, WA
|
Thanks, Frank and Richard!
I've got it working, both Voladj and Blitmenu. I will also try "Picker" and see if I like that one more or less than Blitmenu.
My only remaining question is what the parameters should be to match what Selecter used to do. Right now, my config is:
Volume Adjust On Normal:
/drive0/var/voladj 131072 3277 65536 30 80
Volume Adjust On Maximum:
/drive0/var/voladj 131072 10000 65536 30 80
Volume Adjust Off:
/drive0/var/voladj 131072 0 65536 30 80
I have no idea if the first and third parameters are correct, they were educated guesses based on lines referring to "2 << 16" and "1 << 16" that Drakino pointed out in Richard's source code.
Also, selecter had the advantage of remembering what to do across reboots (if you didn't hit a key, it would do whatever the last thing was). The combination of voladj/blitmenu doesn't seem to do this. I don't know how selecter did it in the first place, so I don't know if it's possible to do it with voladj/blitmenu. ___________ Tony Fabris
|
Top
|
|
|
|
#27998 - 13/03/2001 19:40
Re: Empeg boot up menus?
[Re: tfabris]
|
member
Registered: 16/12/1999
Posts: 188
Loc: Melbourne, Australia
|
I'd forgotten half of this myself. I was looking at the code, and at first it looked like I had made the exact parameters dependent upon an internal constant in the kernel, but then I discovered that I had been slightly more intelligent than I had remembered.
Anyway....
The first parameter is the "factor per second". This is then shifted left 16 bits and expressed as an int. So to make voladj turn up the volume so that the output is increased by a factor of two every second, you set this to (2 << 16).
Weird things can happen if you set this very high or very low, but it should be OK to give it sensible values.
The second parameter is the minimum volume. It attempts to make this the quietest thing you hear. The units are sample magnitudes. If you set this to 0, then none of the other parameters should have any effect. If you set it to (1<<15)-1 then in theory everything should be the same volume, but more likely is that my log routines would get confused. Best to stick with numbers less than 30000, I think.
The third parameter is the "headroom". This attempts to reduce the number of times that a hasty volume correction is needed to prevent clipping. This is a fraction between 0 and 1, shifted left 16 bits and converted to an int. Mind you, it is currently ignored by the ioctl handling code, so changing it currently has no effect. To be nice, you should probably set this to 1 << 16.
The fourth parameter (real_silence) is the sample magnitude below which we assume that there is no listenable music present, so we gradually turn the volume back down.
The fifth parameter (fake_silence) is the sample magnitude that will get mapped to minvol. This must be greater than real_silence. Hm, I'll have to enforce that in the next version of my kernel patch, I think.
If your samples are between real_silence and fake_silence, then they are treated as if they were of magnitude fake_silence.
With respect to the timeout, selecter was not very smart. Basically, it would wait for 5 seconds, and if you didn't press anything, it would just leave the parameters as they were. So when you rebooted, it was _not_ using the value from before, it was actually using the default value that the kernel initialised. :)
Richard.
|
Top
|
|
|
|
#27999 - 13/03/2001 19:52
Re: Empeg boot up menus?
[Re: rjlov]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31602
Loc: Seattle, WA
|
Okay, with regards to the values that are left-shifted... Do you pass the little values via ioctl ("2") or the after-shift values via ioctl ("20000" hex)?
If it's the "little" values, my parameters are way too huge. ___________ Tony Fabris
|
Top
|
|
|
|
#28000 - 13/03/2001 20:04
Re: Empeg boot up menus?
[Re: tfabris]
|
member
Registered: 16/12/1999
Posts: 188
Loc: Melbourne, Australia
|
Pass in the left shifted values (0x20000 for the first parameter). In an attempt to make it a bit easier to remember, sample magnitudes are just raw, and (possibly) fractional values are expressed as fixed point, with 16 bits to the right of the point.
Richard.
|
Top
|
|
|
|
#28001 - 13/03/2001 20:31
Re: Empeg boot up menus?
[Re: rjlov]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31602
Loc: Seattle, WA
|
Ah, so my parameters were correct, then?
Normal: 131072 3277 65536 30 80
Max: 131072 10000 65536 30 80
Off: 131072 0 65536 30 80
?
(Frank- your command-line program wants them in decimal, right?)
___________ Tony Fabris
|
Top
|
|
|
|
#28002 - 14/03/2001 14:45
Re: Empeg boot up menus?
[Re: tfabris]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31602
Loc: Seattle, WA
|
Thanks everyone for all your help on this. I'm now able to use either Frank's "Blitmenu" or Rex Perkins' "Picker" to select the staus of the volume adjustment kernel. For my purposes, Picker is the software I'll be using to do the actual selecting, but I'm still using Frank's Getkey and of course Frank's Voladj ioctl sender in the process. Frank, you're amazing, whipping up that little program for us so quickly. Thanks again.
I'm now working on making a little .zip file that includes a "for dummies" instruction set for anyone who wants to try this.
I have a question, though:
One of the files I'm including will be a replacement init. I'd like to have the replacement init include "displayserver -noauth" by default. If I do this, will it lock up a player that doesn't include displayserver? Or will it just print an error to the console and keep going? ___________ Tony Fabris
|
Top
|
|
|
|
#28003 - 14/03/2001 14:58
Re: Empeg boot up menus?
[Re: tfabris]
|
old hand
Registered: 12/01/2000
Posts: 1079
Loc: Dallas, TX
|
I have wanted to try the voladj for a long time but haven't because I thought it would be too difficult to install. I would really appreciate any directions you could give.
Thanks
Sean
|
Top
|
|
|
|
#28004 - 14/03/2001 14:59
Re: Empeg boot up menus?
[Re: tfabris]
|
carpal tunnel
Registered: 08/06/1999
Posts: 7868
|
One of the files I'm including will be a replacement init. I'd like to have the replacement init include "displayserver -noauth" by default. If I do this, will it lock up a player that doesn't include displayserver? Or will it just print an error to the console and keep going?
It will just print an error and keep going. Or you could do the trick others use in the init and see if it exists before running it.
[ -e /usr/local/displayserver/displayserver ] && /usr/local/displayserver/displayserver -noauth
|
Top
|
|
|
|
#28005 - 14/03/2001 15:09
Re: Empeg boot up menus?
[Re: Terminator]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31602
Loc: Seattle, WA
|
I have wanted to try the voladj for a long time but haven't because I thought it would be too difficult to install. I would really appreciate any directions you could give.
Installing voladj is easy. Just use my Logo Editor to install the proper version of The Volkadj Kernel, and you're done.
This makes it be on all the time, though. Personally, I leave it on 99 percent of the time and it works great. So that might be enough for you.
But if you want the option to turn it on and off from the front panel, it gets more complicated. That's the document I'm preparing right now, so be patient for it. ___________ Tony Fabris
|
Top
|
|
|
|
#28006 - 14/03/2001 17:42
Re: Empeg boot up menus?
[Re: tfabris]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31602
Loc: Seattle, WA
|
Okay, who wants to be a guinea pig for my "Picker and Voladj for dummies" file?
I need people with the following qualifications:
- Mark 1 or Mark 2 (I want to test both).
- Single-drive or dual drive (I want to test both, on both 1&2 platforms).
- With or without Displayserver installed (I want to test both).
- Willing to possibly have your player become inoperable, requiring a re-application of one of the ".upgrade" files to fix it.
- Novices with the bash prompt.
Who wants the file? Gimme your email address.
Thanks again to Rex K. Perkins, Frank Van Gestel, and Richard Lovejoy for making their software and information publicly availble so I could assemble this. ___________ Tony Fabris
|
Top
|
|
|
|
#28007 - 14/03/2001 23:14
Re: Empeg boot up menus?
[Re: tfabris]
|
old hand
Registered: 12/01/2000
Posts: 1079
Loc: Dallas, TX
|
Ok ill give it a try. I sent you my email address.
Sean
|
Top
|
|
|
|
#28008 - 15/03/2001 02:39
Re: Empeg boot up menus?
[Re: tfabris]
|
member
Registered: 29/08/2000
Posts: 153
Loc: Berkshire, UK
|
Me too: Mark 2, single drive, without displayserver, and I know *nothing* about bash prompts...
I'll email you my address.
Cheers,
Bryan.
Mark 2 #080000515
12GB Green (was Blue)
...but I've only got 1GB left to fill!
_________________________
Bryan.
|
Top
|
|
|
|
#28009 - 15/03/2001 11:55
Re: Empeg boot up menus?
[Re: tfabris]
|
pooh-bah
Registered: 02/06/2000
Posts: 1996
Loc: Gothenburg, Sweden
|
Can't claim to be unfamiliar with the bash prompt, but I could have
someone else do the actual install if you need a tester with a 2 disk
MkI w/o displayserver (which, IIRC, is only available for MkII's - or
have I missed something?)
/Michael
_________________________
/Michael
|
Top
|
|
|
|
#28010 - 15/03/2001 17:32
Re: Empeg boot up menus?
[Re: tfabris]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31602
Loc: Seattle, WA
|
Anyone with a dual-drive Mark1 want to try it out? I want to make sure my init works on a dual-drive Mark1:
#!/bin/sh
PATH=.:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/empeg/bin
PS1=empeg:\\w\\$
/bin/mount -n -o nocheck,rw /proc
/bin/mount -n -o nocheck,ro /dev/hda4 /drive0
/bin/mount -n -o nocheck,ro /dev/hdc4 /drive1
cd /usr/local/displayserver
./displayserver -noauth
while [ 1 ] ; do
/drive0/var/pick_list
echo "Press q now to terminate to a shell prompt."
echo
/drive0/var/getkey q && /bin/bash
echo Running Player...
/empeg/bin/player
done ___________ Tony Fabris
|
Top
|
|
|
|
#28011 - 16/03/2001 03:30
Re: Empeg boot up menus?
[Re: tfabris]
|
pooh-bah
Registered: 02/06/2000
Posts: 1996
Loc: Gothenburg, Sweden
|
I have a dual drive MkI - works great!
Great work putting this all together Tony!
/Michael
_________________________
/Michael
|
Top
|
|
|
|
|
|