pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/sysutils/xenvstat Initial import of xenvstart-20041127...
details: https://anonhg.NetBSD.org/pkgsrc/rev/5713cdcc9258
branches: trunk
changeset: 486407:5713cdcc9258
user: xtraeme <xtraeme%pkgsrc.org@localhost>
date: Tue Dec 28 00:01:07 2004 +0000
description:
Initial import of xenvstart-20041127 from pkgsrc-wip, packaged/coded by
Rui-Xiang Guo <rxg%NetBSD.org@localhost>.
xenvstat displays sensor readings from any device which supports the
envsys(4) API in X11-based GUI.
diffstat:
sysutils/xenvstat/DESCR | 2 +
sysutils/xenvstat/Makefile | 32 +
sysutils/xenvstat/PLIST | 3 +
sysutils/xenvstat/files/Xenvstat | 35 +
sysutils/xenvstat/files/xenvstat.c | 839 +++++++++++++++++++++++++++++++++++++
5 files changed, 911 insertions(+), 0 deletions(-)
diffs (truncated from 931 to 300 lines):
diff -r 1105d805aedd -r 5713cdcc9258 sysutils/xenvstat/DESCR
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/xenvstat/DESCR Tue Dec 28 00:01:07 2004 +0000
@@ -0,0 +1,2 @@
+xenvstat displays sensor readings from any device which supports the
+envsys(4) API in X11-based GUI.
diff -r 1105d805aedd -r 5713cdcc9258 sysutils/xenvstat/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/xenvstat/Makefile Tue Dec 28 00:01:07 2004 +0000
@@ -0,0 +1,32 @@
+# $NetBSD: Makefile,v 1.1.1.1 2004/12/28 00:01:07 xtraeme Exp $
+
+DISTNAME= xenvstat-20041127
+CATEGORIES= sysutils
+MASTER_SITES= # empty
+DISTFILES= # empty
+
+MAINTAINER= rxg%NetBSD.org@localhost
+HOMEPAGE= http://www.NetBSD.org/
+COMMENT= X11-based display environmental sensor readings
+
+ONLY_FOR_PLATFORM= NetBSD-*-*
+
+NO_CONFIGURE= yes
+NO_CHECKSUM= yes
+USE_X11= yes
+USE_BUILDLINK3= yes
+
+LIBS= -lXmu -lXext -lXt -lX11 -lm
+
+do-extract:
+ @${CP} -Rp ${FILESDIR} ${WRKSRC}
+
+do-build:
+ ${CC} ${CFLAGS} ${LDFLAGS} -o ${WRKSRC}/xenvstat \
+ ${WRKSRC}/xenvstat.c ${LIBS}
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/xenvstat ${PREFIX}/bin/xenvstat
+ ${INSTALL_DATA} ${WRKSRC}/Xenvstat ${PREFIX}/lib/X11/app-defaults
+
+.include "../../mk/bsd.pkg.mk"
diff -r 1105d805aedd -r 5713cdcc9258 sysutils/xenvstat/PLIST
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/xenvstat/PLIST Tue Dec 28 00:01:07 2004 +0000
@@ -0,0 +1,3 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2004/12/28 00:01:07 xtraeme Exp $
+bin/xenvstat
+lib/X11/app-defaults/Xenvstat
diff -r 1105d805aedd -r 5713cdcc9258 sysutils/xenvstat/files/Xenvstat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/xenvstat/files/Xenvstat Tue Dec 28 00:01:07 2004 +0000
@@ -0,0 +1,35 @@
+!
+! Xenvstat resource file
+!
+Xenvstat*translations: #override \
+ <Configure>: repaint_proc()\n\
+ <Expose>: repaint_proc()\n\
+ <BtnUp>: repaint_proc()\n\
+ <Key>Q: quit_proc()
+! Add the followings to users default resources if one wishes
+Xenvstat*geometry: 100x140
+Xenvstat*font: -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*
+Xenvstat*count: 4
+Xenvstat*sec: 2
+Xenvstat*wsec: 180
+Xenvstat*tmin: 20.0
+Xenvstat*tmax: 60.0
+Xenvstat*vmin: 1.80
+Xenvstat*vmax: 2.20
+Xenvstat*tick: 3
+Xenvstat*cltcpu: red
+Xenvstat*cltmb: blue
+Xenvstat*cltcs: cyan
+Xenvstat*clfan1: gray
+Xenvstat*clfan2: pink
+Xenvstat*clvc: green
+Xenvstat*cmtcpu: CPU
+Xenvstat*cmtmb: MB
+Xenvstat*cmtcs: chip
+Xenvstat*cmfan1: fan1
+Xenvstat*cmfan2: fan2
+Xenvstat*cmvc: Vc
+Xenvstat*fahrn: False
+Xenvstat*label:
+Xenvstat*labelfont: -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*
+Xenvstat*labelcolor: black
diff -r 1105d805aedd -r 5713cdcc9258 sysutils/xenvstat/files/xenvstat.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/xenvstat/files/xenvstat.c Tue Dec 28 00:01:07 2004 +0000
@@ -0,0 +1,839 @@
+/*
+ * This code is derived from xmbmon.c written by Yoshifumi R. Shimizu.
+ *
+ * Copyright (c) 2004 Rui-Xiang Guo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <err.h>
+
+#include <sys/envsys.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+
+/* Fahrenheit flag used in get_values() */
+int fahrn_flag = 0;
+
+/* Label for showing or not showing a label */
+char *label;
+
+#define RES_NAME "xenvstat"
+
+#define DEFAULT_GEOMETRY "141x126"
+#define DEFAULT_FONT "-adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*"
+
+#define DEFAULT_LBFONT "-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*"
+#define DEFAULT_LBCOLOR "black"
+
+#define DEFAULT_COUNT "4"
+#define DEFAULT_SEC "2"
+#define DEFAULT_WSEC "180"
+#define DEFAULT_TMIN "20.0"
+#define DEFAULT_TMAX "60.0"
+#define DEFAULT_TMINF "50.0" /* for Fahrenheit */
+#define DEFAULT_TMAXF "130.0" /* for Fahrenheit */
+#define DEFAULT_VMIN "1.80"
+#define DEFAULT_VMAX "2.20"
+#define DEFAULT_TICK "3"
+
+#define DEFAULT_CLTCPU "red"
+#define DEFAULT_CLTMB "blue"
+#define DEFAULT_CLTCS "cyan"
+#define DEFAULT_CLFAN1 "gray"
+#define DEFAULT_CLFAN2 "pink"
+#define DEFAULT_CLVC "green"
+
+#define DEFAULT_CMTCPU "CPU"
+#define DEFAULT_CMTMB "MB"
+#define DEFAULT_CMTCS "chip"
+#define DEFAULT_CMFAN1 "fan1"
+#define DEFAULT_CMFAN2 "fan2"
+#define DEFAULT_CMVC "Vc "
+
+#define DEFAULT_FAHRN "False"
+
+/* global variables */
+
+/* temp1(CPU), temp2(MotherBoard), temp3(ChipSet), fan1, fan2, Vcore0 */
+#define NUM_DATA 6
+
+int nd = NUM_DATA;
+
+char *font;
+
+int width, height;
+
+int count, sec, wsec;
+int counter = 0;
+int npoints = 0;
+int range;
+
+unsigned long ms;
+
+float *fmean;
+
+float tmin, tmax, vmin, vmax;
+int tick;
+float sscl, htck;
+
+float cur_val[NUM_DATA] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
+char *l_color[NUM_DATA];
+unsigned long cpix[NUM_DATA], d_cpix[NUM_DATA];
+
+#define C_LBL 10
+
+char ctmin[C_LBL], ctmax[C_LBL];
+char cvmin[C_LBL], cvmax[C_LBL];
+
+char *c_rdv[NUM_DATA], *c_rdg[NUM_DATA];
+char *c_rdp[NUM_DATA] = {"%4.1f", "%4.1f", "%4.1f", "%4.0f", "%4.0f", "%4.2f"};
+
+char *lb_font, *lb_color;
+int h_lb = 0;
+
+float scale[NUM_DATA];
+float orign[NUM_DATA];
+int x_rdg[NUM_DATA], x_rdv[NUM_DATA], y_rdg, y_rdv;
+int cg_width[NUM_DATA], cv_width[NUM_DATA];
+int h_cm, x_cm, y_cm;
+unsigned long cpixlb, d_cpixlb;
+
+typedef struct ring_data { /* def. of ring-buffer */
+ float val;
+ struct ring_data *next;
+} ring_d;
+
+ring_d *rdp[NUM_DATA];
+ring_d *rdpw[NUM_DATA];
+
+int fd, ns;
+envsys_tre_data_t *etds;
+
+/* variables for X11 */
+
+Widget wgt;
+Display *disp;
+Window win;
+GC gct, gclb, gcl[NUM_DATA];
+XPoint *points;
+XFontStruct *fontstr;
+XFontStruct *lb_fontstr;
+
+/* functions */
+
+void usage(void);
+void get_res(void);
+void init_dt(void);
+void getWH(int *width, int *height);
+void repaint_proc(void);
+void quit_proc(void);
+void draw_values(void);
+int ColorPix(Display *, char *, unsigned long *);
+void alarm_handler(void);
+int num_sensors(void);
+int fill_sensors(void);
+void get_values(void);
+void calc_position(void);
+void calc_scale(void);
+
+/*---------- definitions of static data for X Toolkits ----------*/
+
+ static String fallback_resources[] = {
+ "*translations: #override \
+ <Configure>: repaint_proc()\\n\
+ <Expose>: repaint_proc()\\n\
+ <BtnUp>: repaint_proc()\\n\
+ <Key>Q: quit_proc()",
+ "*geometry: " DEFAULT_GEOMETRY,
+ "*font: " DEFAULT_FONT,
+ "*count: " DEFAULT_COUNT,
+ "*sec: " DEFAULT_SEC,
+ "*wsec: " DEFAULT_WSEC,
+ "*tmin: " DEFAULT_TMIN,
+ "*tmax: " DEFAULT_TMAX,
+ "*vmin: " DEFAULT_VMIN,
+ "*vmax: " DEFAULT_VMAX,
+ "*tick: " DEFAULT_TICK,
+ "*cltcpu: " DEFAULT_CLTCPU,
+ "*cltmb: " DEFAULT_CLTMB,
+ "*cltcs: " DEFAULT_CLTCS,
+ "*clfan1: " DEFAULT_CLFAN1,
+ "*clfan2: " DEFAULT_CLFAN2,
+ "*clvc: " DEFAULT_CLVC,
+ "*cmtcpu: " DEFAULT_CMTCPU,
+ "*cmtmb: " DEFAULT_CMTMB,
+ "*cmtcs: " DEFAULT_CMTCS,
+ "*cmfan1: " DEFAULT_CMFAN1,
+ "*cmfan2: " DEFAULT_CMFAN2,
+ "*cmvc: " DEFAULT_CMVC,
+ "*fahrn: " DEFAULT_FAHRN,
+ "*label: " ,
+ "*labelfont: " DEFAULT_LBFONT,
+ "*labelcolor: " DEFAULT_LBCOLOR,
+ NULL,
+ };
+
+ static XtActionsRec actions[] = {
+ {"repaint_proc", (XtActionProc) repaint_proc},
+ {"quit_proc", (XtActionProc) quit_proc},
+ };
Home |
Main Index |
Thread Index |
Old Index