Initial import of wmtune-1.1c

premier dockable radio tuner

Submitted by:  Vladimir Popov <pva48@mail.ru>
This commit is contained in:
wilfried 2001-03-16 15:30:47 +00:00
parent 8afe213732
commit 63d91bee74
11 changed files with 622 additions and 0 deletions

44
audio/wmtune/Makefile Normal file
View File

@ -0,0 +1,44 @@
# $OpenBSD: Makefile,v 1.1.1.1 2001/03/16 15:30:47 wilfried Exp $
ONLY_FOR_ARCHS= i386
DISTNAME= wmtune-1.1c
CATEGORIES= audio x11 x11/windowmaker
NEED_VERSION= 1.348
HOMEPAGE= http://soren.org/linux/wmtune/
MAINTAINER= Vladimir Popov <pva48@mail.ru>
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
MASTER_SITES= ${HOMEPAGE}dl/
USE_X11= Yes
FLAVORS= aztech zoltrix radiotrack
FLAVOR?= aztech
.if ${FLAVOR:L} == "aztech"
CFLAGS+= -DAZTECH
.elif ${FLAVOR:L} == "zoltrix"
CFLAGS+= -DZOLTRIX
.elif ${FLAVOR:L} == "radiotrack"
CFLAGS+= -DRADIOTRACK
.else
.BEGIN:
@echo "Conflicting flavor: ${FLAVOR}"
@exit 1
.endif
WRKDIST= ${WRKDIR}/wmtune-1.0.1-combined/
BINMODE= 4555
post-extract:
@cp files/wmtune.1 ${WRKDIST}
.include <bsd.port.mk>

3
audio/wmtune/files/md5 Normal file
View File

@ -0,0 +1,3 @@
MD5 (wmtune-1.1c.tar.gz) = 9662231014d292a21d5d1f0bc9d30b11
RMD160 (wmtune-1.1c.tar.gz) = ec3620a69f327dd9cb1d7c4870456a0c889ddf6b
SHA1 (wmtune-1.1c.tar.gz) = 2d1e88d988384e6ca2c69626c60409d72aaa4ec1

View File

@ -0,0 +1,63 @@
.\" $OpenBSD: wmtune.1,v 1.1.1.1 2001/03/16 15:30:47 wilfried Exp $
.\"
.TH WMTune 1 "28 January 2001"
.SH NAME
.PP
\fBwmtune\fP \- premier dockable radio tuner
.SH SYNOPSIS
.PP
.B wmtune
[\fB-n\fP] [\fB-t\fP \fI<##:##>\fP] [\fB-p\fP \fI<##>\fP] [\fB-d\fP \fIdisplay\fP] [\fB-h\fP]
.br
.SH DESCRIPTION
.PP
\fBWMTune\fP is a WindowMaker dock.app that controls AIMS Lab Radio-Track, Zoltrix and Aztech/PackardBell FM radio tuner cards.
.PP
The + and - buttons are for FINE tuning.
.PP
The 2 buttons to the right of the FINE tuning buttons are the SCAN buttons.
.PP
The 2 SCAN buttons also double as VOLUME UP/DOWN when using the RIGHT mouse button.
.PP
In the bottom left there is a small two digit box in which the currently selected preset will be shown. The < and > arrow buttons to the left of the box allow to switch between presets easily and quickly.
.PP
To the right of the above described things there is yet another button with a miniature ON/OFF logo. This is used to turn your radio card on/off.
.PP
The button with the inscribed letter "A" allows you to control the internal alarm clock/delay timer. Upon pressing the "A" button you will be allowed to set the timer/delay to a time you wish the radio to turn on / off (depending on the current state of
the radio) automatically.
.PP
After pressing the "A" button the first time you may set the now displayed clock type panel to the desired setting using the SCAN buttons to set your timer in the 24hour format. (be aware in this state other buttons cease to work) You must press the A
button again at which point the indicator light will turn on and the alarm will be set. Lastly, pressing the "A" button once more, will disengance the timer.
.SH OPTIONS
.B
.IP "\-n"
Turn radio on initially on startup.
.B
.IP "\-t \fI<##:##>\fP"
Set timer on startup, military time.
.B
.IP "-p \fI<##>\fP"
Set startup preset # listed in wmtunerc file.
.B
.IP "\-d \fIdisplay\fP"
Selects target display.
.B
.IP "\-h"
Display help screen.
.SH EXAMPLES
.PP
wmtune -n -p 5
.br
wmtune -p 2 -t 14:35
.br
wmtune -n -t 00:00
.SH FILES
.PP
/etc/wmtunerc global configuration file
.br
~/.wmtunerc
.SH AUTHORS
.PP
WMTune written by soren <soren@leiden.org>
.br
The manpage written by Vladimir Popov <pva48@mail.ru>

View File

@ -0,0 +1,36 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2001/03/16 15:30:48 wilfried Exp $
--- Makefile.orig Mon Mar 1 12:01:17 1999
+++ Makefile Fri Mar 16 16:26:23 2001
@@ -1,21 +1,22 @@
-RADIOCARD = ZOLTRIX # Can be RADIOTRACK, ZOLTRIX, KERNEL
-INCDIR = -I/usr/X11R6/include
-LIBDIR = -L/usr/X11R6/lib
-LIBS = -lXpm -lXext -lX11
+CFLAGS+= -I${X11BASE}/include
+LIBDIR = -L${X11BASE}/lib
+LIBS = -lXpm -lXext -lX11 -li386 # For OpenBSD/i386
OBJS = src/wmtune.o \
src/wmgeneral/wmgeneral.o \
-.c.o:
- cc -c -O2 -Wall -D$(shell echo `uname -s`) $< -o $*.o $(INCDIR) -D$(RADIOCARD)
-
all: wmtune
+.c.o:
+ cc $(CFLAGS) -c $< -o $@
+
wmtune: $(OBJS)
- cc -o wmtune $^ $(LIBDIR) $(LIBS)
+ cc -o wmtune $(OBJS) $(LIBDIR) $(LIBS)
install:: all
- install -s -m 4755 -o root wmtune /usr/X11R6/bin
- install -m 0644 -o root -g root sample.wmtunerc /etc/wmtunerc
+ ${BSD_INSTALL_PROGRAM} wmtune ${PREFIX}/bin
+ ${BSD_INSTALL_MAN} wmtune.1 ${PREFIX}/man/man1
+ ${BSD_INSTALL_DATA_DIR} ${PREFIX}/share/examples/wmtune
+ ${BSD_INSTALL_DATA} sample.wmtunerc ${PREFIX}/share/examples/wmtune
clean:
for i in $(OBJS) ; do \

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-sample_wmtunerc,v 1.1.1.1 2001/03/16 15:30:48 wilfried Exp $
--- sample.wmtunerc.orig Wed Feb 2 18:05:36 2000
+++ sample.wmtunerc Wed Feb 2 18:07:14 2000
@@ -3,6 +3,7 @@
0x20c # hex IO address of your radio card, most likely 0x30f or 0x20f
# for zoltrix card 0x20c or 0x30c
+ # for aztech card 0x350 or 0x358
# note: presets can be as long as 000.000 and will still be used; yet display
# up to the 100th will be trucated.

View File

@ -0,0 +1,336 @@
$OpenBSD: patch-src_wmtune_c,v 1.1.1.1 2001/03/16 15:30:48 wilfried Exp $
--- src/wmtune.c.orig Sat Sep 11 11:49:24 1999
+++ src/wmtune.c Tue Jan 30 22:19:45 2001
@@ -18,27 +18,24 @@
****************************************************************
*/
-#if !defined Linux
-# if (defined NetBSD || defined OpenBSD)
-# warning Compiling for NetBSD/OpenBSD using /dev/io style IO.
-# include <i386/pio.h>
-# else
-# if defined FreeBSD
-# warning Compiling for FreeBSD using /dev/io style IO.
-# include <machine/cpufunc.h>
-# endif
-# endif
-#else
-# warning Compiling for Linux using ioperm/iopl style IO.
-# include <asm/io.h>
-#endif
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
+#ifdef linux
+#warning Compiling for Linux using ioperm/iopl style IO.
+#include <asm/io.h>
+#elif (defined __NetBSD__ || defined __OpenBSD__)
+#include <machine/pio.h>
+#include <machine/sysarch.h>
+#elif defined __FreeBSD__
+#warning Compiling for FreeBSD using /dev/io style IO.
+#include <machine/cpufunc.h>
+#endif
+
#include <X11/xpm.h>
#include <time.h>
@@ -55,7 +52,10 @@
#define OFF 0
#define TRUE 1
#define FALSE 0
+
+#ifdef RADIOTRACK
#define FCODE(f) ((int)(((float)(f)-88.0)*40)+0xf6c)
+#endif
/* #define RADIOTRACK */
/* #define KERNEL */
@@ -68,17 +68,19 @@
#include <linux/ioctl.h>
#endif
-#if (defined FreeBSD || defined NetBSD || defined OpenBSD)
- #define OUTW(word,port) outw(port,word)
- #define OUTB(byte,port) outb(port,byte)
-#else
+#ifdef linux
#define OUTW(word,port) outw(word,port)
#define OUTB(byte,port) outb(byte,port)
+#else
+ #define OUTW(word,port) outw(port,word)
+ #define OUTB(byte,port) outb(port,byte)
#endif
// Data Types
-#if (defined FreeBSD || defined NetBSD || defined OpenBSD)
+#if (defined __FreeBSD__ || defined __NetBSD__)
int fpiopl;
+#elif defined __OpenBSD__
+ unsigned long iomap[32];
#endif
unsigned int max_presets;
@@ -127,7 +129,6 @@ void VolumeUp(void);
void VolumeDown(void);
void TuneUp(void);
void TuneDown(void);
-void RadioOut(int, int);
void PresetHandler(int);
void ScanUp(void);
void ScanDown(void);
@@ -139,10 +140,16 @@ int TestTune(void);
void TestFreq(void);
#ifdef ZOLTRIX
void tuneFreq(double freq,int fast);
+#elif defined RADIOTRACK
+void RadioOut(int, int);
+#elif defined AZTECH
+void Change_Frequency(unsigned long);
+void send_zero(void);
+void send_one(void);
#endif
// Main
-void main(int argc,char *argv[])
+int main(int argc,char *argv[])
{
myname = argv[0];
ParseCMDLine(argc,argv);
@@ -214,13 +221,18 @@ while (1)
break;
case DestroyNotify:
XCloseDisplay(display);
- #if (defined FreeBSD || defined NetBSD || defined OpenBSD)
+ #if (defined __FreeBSD__ || defined __NetBSD__)
close(fpiopl);
+ #elif defined __OpenBSD__
+ memset(iomap, 0xFFFF, sizeof(iomap));
+ i386_set_ioperm(iomap);
#else
#ifdef RADIOTRACK
ioperm(rport,2,0);
#elif defined ZOLTRIX
ioperm(rport,4,0);
+ #elif defined AZTECH
+ ioperm(rport,1,0);
#endif
#endif
exit(0);
@@ -434,8 +446,8 @@ while (1)
usleep(5000);
if (alarm_state == ON)
{
- current_time = time(0);
- time_struct = localtime(&current_time);
+ current_time = time(NULL);
+ time_struct = localtime((time_t *)&current_time);
if(hour == time_struct->tm_hour);
{
if (minute == time_struct->tm_min)
@@ -455,11 +467,14 @@ while (1)
}
}
} // while
+
+return 0;
} // main
void RadioOn(void)
{
radio_status = ON;
+ if ( volume == 0 ) volume = 1;
copyXPMArea(93, 90, 13, 5, 44, 9);
RedrawWindowXYWH(44, 9, 13, 5); // Mhz/Khz
copyXPMArea(96, 79, 11, 7, 45, 22);
@@ -503,6 +518,8 @@ void FastFreqUpdate(void)
unsigned long xl_freq = (unsigned long)(freqf*100*get_freq_fact(fd));
ioctl (fd, VIDIOCSFREQ, &xl_freq);
close (fd);
+#elif defined AZTECH
+ Change_Frequency(freqf*100);
#endif
}
@@ -683,23 +700,35 @@ void ScanDown(void)
void CheckIOPerms(void)
{
- #if (defined FreeBSD || defined NetBSD || defined OpenBSD)
+#if (defined __FreeBSD__ || defined __NetBSD__) /* Platform dependent */
if ((fpiopl = open( "/dev/io", O_RDONLY ) < 0) )
- {
- fprintf(stderr, "Failed to gain IO privledges. Am I setuid root? Is /dev/io accessable by me?\n");
- exit(1);
- }
- #else
-#ifdef RADIOTRACK
+#elif defined linux
+#ifdef RADIOTRACK /* Card dependent for linux */
if (ioperm(rport,2,1) < 0)
#elif defined ZOLTRIX
if (ioperm(rport,4,0xFFFF) < 0)
-#endif
+#elif defined AZTECH
+ if (ioperm(rport,1,1) < 0)
+#endif /* Card dependent for linux */
+#elif defined __OpenBSD__
+ int offset;
+ unsigned long mask;
+ offset = rport/32;
+#ifdef RADIOTRACK /* Card dependent for OpenBSD */
+ mask = 0x03 << rport%32;
+#elif defined ZOLTRIX
+ mask = 0x0F << rport%32;
+#elif defined AZTECH
+ mask = 0x01 << rport%32;
+#endif /* Card dependent for OpenBSD */
+ memset(iomap, 0xFFFF, sizeof(iomap));
+ iomap[offset] ^= mask;
+ if ( i386_set_ioperm(iomap) < 0 )
+#endif /* Platform dependent */
{
- fprintf(stderr, "Failed to gain IO privledges. Am I setuid root?\n");
+ fprintf(stderr, "wmtune: Failed to gain IO privledges: %s\n", strerror(errno));
exit(1);
}
- #endif
}
void ParseCMDLine(int argc,char *argv[])
@@ -827,6 +856,8 @@ void RadioOff(void)
cardWrite(0);
cardWrite(0);
cardRead(3);
+#elif defined AZTECH
+ OUTB(0, rport);
#elif defined KERNEL
struct video_audio va;
int fd = open ("/dev/radio", O_RDONLY);
@@ -854,6 +885,8 @@ void TuneRadio(void)
OUTB(0xc8,rport);
#elif defined ZOLTRIX
tuneFreq(freqf,0);
+#elif defined AZTECH
+ Change_Frequency(freqf*100);
#elif defined KERNEL
int fd = open ("/dev/radio", O_RDONLY);
unsigned long xl_freq = (unsigned long)(freqf*100*get_freq_fact(fd));
@@ -862,6 +895,7 @@ void TuneRadio(void)
#endif
}
+#ifdef RADIOTRACK
void RadioOut(int v,int n)
{
while (n--)
@@ -883,6 +917,7 @@ void RadioOut(int v,int n)
v>>=1;
}
}
+#endif /* RADIOTRACK */
void ButtonDown(int button)
{
@@ -1016,6 +1051,15 @@ void VolumeUp(void)
cardWrite(volume);
usleep(10000);
cardRead(2);
+#elif defined AZTECH
+ if (volume < 5) {
+ switch (volume) {
+ case 0: volume = 1; break;
+ case 1: volume = 4; break;
+ case 4: volume = 5; break;
+ }
+ OUTB(volume, rport);
+ }
#elif defined KERNEL
if (volume < 10) {
struct video_audio va;
@@ -1041,6 +1085,15 @@ void VolumeDown(void)
cardWrite(volume);
usleep(10000);
cardRead(2);
+#elif defined AZTECH
+ if (volume > 0) {
+ switch (volume) {
+ case 5: volume = 4; break;
+ case 4: volume = 1; break;
+ case 1: volume = 0; break;
+ }
+ OUTB(volume, rport);
+ }
#elif defined KERNEL
if (volume > 0) {
struct video_audio va;
@@ -1144,6 +1197,13 @@ int TestTune(void)
if ((x1 == x2) && (x1 == 0xdf))
return 1;
else return 0;
+#elif defined AZTECH
+ int res = inb(rport) & 3;
+ switch ( res ) {
+ case 2:
+ case 1: return 2;
+ case 0: return 1;
+ }
#elif defined KERNEL
struct video_tuner v;
int fd = open ("/dev/radio", O_RDONLY);
@@ -1213,3 +1273,49 @@ int ParseRCFile(char *filename)
fclose(fp);
return 0;
}
+
+#ifdef AZTECH
+void
+Change_Frequency(unsigned long frequency) {
+ int i;
+
+ frequency += 1070;
+ frequency /= 5;
+
+ send_zero();
+
+ for ( i = 0; i < 16; i++ )
+ if ( frequency & (1 << i) )
+ send_one();
+ else
+ send_zero();
+
+ send_one();
+ send_one();
+ send_zero();
+ send_zero();
+ send_one();
+ send_zero();
+ send_one();
+
+ OUTB(0x80+0x40+volume, rport);
+ OUTB(0x80+0x40+volume, rport);
+}
+
+void
+send_zero(void) {
+ OUTB(0x02+volume, rport);
+ OUTB(0x02+volume, rport);
+ OUTB(0x40+0x02+volume, rport);
+ OUTB(0x40+0x02+volume, rport);
+}
+
+void
+send_one(void) {
+ OUTB(0x80+0x02+volume, rport);
+ OUTB(0x80+0x02+volume, rport);
+ OUTB(0x80+0x40+0x02+volume, rport);
+ OUTB(0x80+0x40+0x02+volume, rport);
+}
+
+#endif /* AZTECH */

1
audio/wmtune/pkg/COMMENT Normal file
View File

@ -0,0 +1 @@
premier dockable radio tuner

View File

@ -0,0 +1,51 @@
#!/bin/sh
# $OpenBSD: DEINSTALL,v 1.1.1.1 2001/03/16 15:30:47 wilfried Exp $
#
# De-installation setup of wmtune
# exit on errors, use a sane path and install prefix
#
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
CONFIG_FILE=${SYSCONFDIR}/wmtunerc
# Function: tell the user what they need to do to delete the port completely
#
do_notice()
{
echo
echo "+---------------"
echo "| To completely deinstall the $1 package you need to perform"
echo "| these steps as root:"
echo "|"
echo "| rm -f ${CONFIG_FILE}"
echo "|"
echo "| Do not do this if you plan on re-installing $1"
echo "| at some future time."
echo "+---------------"
echo
}
# Verify proper execution
#
if [ $# -ne 2 ]; then
echo "usage: $0 distname DEINSTALL" >&2
exit 1
fi
# Verify/process the command
#
case $2 in
DEINSTALL)
if [ -f ${CONFIG_FILE} ]; then
do_notice "$1"
fi
;;
*)
echo "usage: $0 distname DEINSTALL" >&2
exit 1
;;
esac
exit 0

4
audio/wmtune/pkg/DESCR Normal file
View File

@ -0,0 +1,4 @@
WMTune is a WindowMaker dock.app that controls AIMS Lab Radio-Track
Zoltrix and Aztech/PackardBell FM radio tuner cards.
WWW: ${HOMEPAGE}

68
audio/wmtune/pkg/INSTALL Normal file
View File

@ -0,0 +1,68 @@
#!/bin/sh
# $OpenBSD: INSTALL,v 1.1.1.1 2001/03/16 15:30:47 wilfried Exp $
#
# Pre/post-installation setup of wmtune
# exit on errors, use a sane path and install prefix
#
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=${PKG_PREFIX:-/usr/local}
CONFIG_FILE=${SYSCONFDIR}/wmtunerc
SAMPLE_CONFIG_DIR=$PREFIX/share/examples/wmtune
# Function: tell the user what they need to do to use the port just installed
#
do_notice()
{
echo
echo "+---------------"
echo "| The existing $1 configuration file, ${CONFIG_FILE},"
echo "| has NOT been changed. You may want to compare it to the"
echo "| current sample file in ${SAMPLE_CONFIG_DIR}"
echo "| and update your configuration as needed."
echo "+---------------"
echo
}
# Function: install configuration files
#
do_install()
{
install -o root -g wheel ${SAMPLE_CONFIG_DIR}/sample.wmtunerc ${CONFIG_FILE}
echo
echo "+---------------"
echo "| The $1 configuration file, ${CONFIG_FILE},"
echo "| has been installed. Please view this file and change"
echo "| the configuration to meet your needs"
echo "+---------------"
echo
}
# Verify proper execution
#
if [ $# -ne 2 ]; then
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
fi
# Verify/process the command
#
case $2 in
PRE-INSTALL)
: nothing to pre-install for this port
;;
POST-INSTALL)
if [ -f ${CONFIG_FILE} ]; then
do_notice "$1"
else
do_install "$1"
fi
;;
*)
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
;;
esac
exit 0

5
audio/wmtune/pkg/PLIST Normal file
View File

@ -0,0 +1,5 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2001/03/16 15:30:47 wilfried Exp $
bin/wmtune
man/man1/wmtune.1
share/examples/wmtune/sample.wmtunerc
@dirrm share/examples/wmtune