Page 11 of 14

Posted: Thu Sep 04, 2008 7:32 pm
by linuxsense
I figured I would add this for some other blokes future use...

To compile xlib_shm on my 64 bit Ubuntu 8.04 system I changed the Makefile to:

Code: Select all

X11PREFIX=/usr/X11R6

all: xlib_shm

xlib_shm.o: xlib_shm.c
	gcc -c xlib_shm.c -I$(X11PREFIX)/include -I/usr/lib64 -Wall

xlib_shm: xlib_shm.o
	gcc xlib_shm.o -L$(X11PREFIX)/lib -I/usr/lib64 -lGL -lX11 -lmysqlclient -Wall,-rpath=$(X11PREFIX)/lib -o xlib_shm

clean: 
	rm -f *.o *.core xlib_shm
I also changed the shared key default in xlib_shm.c to use 0x7a6d0000 instead of the default of 0x7a6d2000.

After those changes a 'make clean' followed by a 'make all' gets it built. Thanks to maciekc for this great tool.

Posted: Sat Sep 20, 2008 10:42 pm
by craver84
I'm using xlib_shm-gl with ZM 1.23.3 on my ubuntu 8.04 and it works great!

this is my command:
sudo xlib_shm-gl -m1 -m2 -m3 -k 0x7a6d0000

There is a problem I don't know how to solve it:
when I change the zm run state (restart, stop and start, or custom states) xlib_shm freezes and I can't close it by clicking on the X or mouse right click and close.

I need to change zm state using crontab during the day, so I'm tring to resolve this bug. can you help me? Thanks

Posted: Sat Sep 20, 2008 10:56 pm
by craver84
Ok, I resolved in this way, but it isn't the best way

crontab -e

Code: Select all

# m h  dom mon dow   command
00 22 * * * sudo /usr/bin/zmpkg.pl modect
00 22 * * * sudo killall -v xlib_shm-gl
00 22 * * * sudo xlib_shm-gl -m1 -m3 -m4 -k 0x7a6d0000

00 08 * * * sudo /usr/bin/zmpkg.pl monitor
00 08 * * * sudo killall -v xlib_shm-gl
00 08 * * * sudo xlib_shm-gl -m1 -m3 -m4 -k 0x7a6d0000

question

Posted: Wed Oct 22, 2008 5:57 pm
by spookyspy
Works fine real low cpu compared to http.

But how come that it has to be root to run the program?
Is that a ZM protection or is there a way to chmod a file to make it work?

gr,
Willem

Re: question

Posted: Wed Oct 22, 2008 10:30 pm
by linuxsense
spookyspy wrote:Works fine real low cpu compared to http.

But how come that it has to be root to run the program?
Is that a ZM protection or is there a way to chmod a file to make it work?

gr,
Willem
You can run it via sudo, here is a little script I use to launch two viewers for my 'daytime' ZM profile:

Code: Select all

#!/bin/bash

# driveway
kdesudo "/home/dave/bin/xlib_shm -m7 -c 1 -w 320 -h 240" &

# the rest
kdesudo "/home/dave/bin/xlib_shm -m10 -m9 -m8 -m14 -w 640 -h 480" &
Something like that can be run by a normal user.

Posted: Thu Oct 23, 2008 7:12 pm
by 00goat
Having trouble compiling on xubuntu 6.06 (bluecherry) and zm 1.22.3. Using non-gl version due to intel integrated video. Tried .6.3, rolled back to .6.2 thinking it might be more suited to zm 1.22.2.

Code: Select all


~/Desktop/xlib_shm-0.6.2$ make
gcc -c xlib_shm.c -I/usr/X11R6/include
xlib_shm.c: In function ‘GetPortId’:
xlib_shm.c:182: warning: pointer targets in passing argument 3 of ‘XvQueryAdaptors’ differ in signedness
xlib_shm.c: In function ‘loadzmconfig’:
xlib_shm.c:234: warning: incompatible implicit declaration of built-in function ‘strcspn’
xlib_shm.c:238: warning: incompatible implicit declaration of built-in function ‘strspn’
xlib_shm.c:245: warning: incompatible implicit declaration of built-in function ‘strlen’
xlib_shm.c:253: warning: incompatible implicit declaration of built-in function ‘strchr’
xlib_shm.c:277: warning: incompatible implicit declaration of built-in function ‘strncpy’
xlib_shm.c: In function ‘main’:
xlib_shm.c:549: warning: pointer targets in passing argument 4 of ‘XvCreateImage’ differ in signedness
xlib_shm.c:636: warning: pointer targets in passing argument 6 of ‘XCreateImage’ differ in signedness
xlib_shm.c:763: warning: pointer targets in passing argument 6 of ‘XCreateImage’ differ in signedness
xlib_shm.c:873: warning: pointer targets in passing argument 6 of ‘XCreateImage’ differ in signedness
gcc xlib_shm.o -L/usr/X11R6/lib -lXv -lXext -lX11 -lmysqlclient -Wl,-rpath=/usr/X11R6/lib -o xlib_shm

Any thoughts? I've improved slightly from previous errors by upgrading some X11 libs, but it's still not quite there.

Thanks

Re: question

Posted: Thu Oct 30, 2008 8:33 am
by maciekc
spookyspy wrote:Works fine real low cpu compared to http.

But how come that it has to be root to run the program?
Is that a ZM protection or is there a way to chmod a file to make it work?

gr,
Willem
You can run it as the user which zm is running without problems.

Posted: Thu Oct 30, 2008 6:13 pm
by 00goat
I did eventually get it working, and I'm quite pleased with the app. Are there any plans for further development of this? It seems like it would be a very useful component to add to the core app.

Posted: Fri Oct 31, 2008 7:19 am
by maciekc
00goat wrote:I did eventually get it working, and I'm quite pleased with the app. Are there any plans for further development of this? It seems like it would be a very useful component to add to the core app.
Unfortunately I don't have much time for that.
It was written just because of my customer wishes.
I got all they needed and the development has stopped.
It should be completely rewritten in cpp to add some new features.
It would be great if someone can continue this project. Probably I won't. I just don't have time for it. Of course if there is some volunteer I will be happy to explain how it works.

Posted: Fri Oct 31, 2008 8:06 pm
by Lee Sharp
maciekc wrote:
00goat wrote:I did eventually get it working, and I'm quite pleased with the app. Are there any plans for further development of this? It seems like it would be a very useful component to add to the core app.
Unfortunately I don't have much time for that.
It was written just because of my customer wishes.
I got all they needed and the development has stopped.
It should be completely rewritten in cpp to add some new features.
It would be great if someone can continue this project. Probably I won't. I just don't have time for it. Of course if there is some volunteer I will be happy to explain how it works.
If someone does want to pick it up, and can do a few things for me, we may be able to help support the project. Things like web space, dev boxes, and perhaps even laughably small amounts of cash. :D

Posted: Wed Dec 03, 2008 3:01 pm
by gola10
Found on xlib_shm-0.6.3-gl.tar.bz2 a script called start_monitor
-------------- script --------------------------
#!/bin/bash
RUN="./xlib_shm -m1 -b2"
PID=`pidof xlib_shm`

while :
do
PREV_CPU=`cat /proc/$PID/stat 2> /dev/null | cut -f14 -d" "`
sleep 2
CURR_CPU=`cat /proc/$PID/stat 2> /dev/null | cut -f14 -d" "`
if [ -z $CURR_CPU ]
then
PREV_CPU=0
CURR_CPU=0
fi
if [ $PREV_CPU = $CURR_CPU ]
then
PID=`pidof xlib_shm`
if [ -n "$PID" ]
then
kill -9 $PID
fi
$RUN &
PID=`pidof xlib_shm`
fi
done
-----------------------------------------------------

I has seen that this script keeps xlib_shm running for ever. I has been rebooting the computer to stop it. I am sure there is another way to stop it but have no idea about script programming .
What i really need is to start and stop it by pressing the same keyboard key. I has found the way on KDE to assign a key to a script so this part is solved.
Now, how do i modify this script so that if running, it will stop (by pressing the key) and if not runnjing, it will start (by pressing the key the same key)

Posted: Mon Dec 08, 2008 9:16 pm
by 50cc
Brilliant!!! :D

Downloaded and compiled it into our Ubuntu 8.04 server. Works excellently!

Posted a howto on my new network admin blog:
http://selfmadenetadmin.blogspot.com/20 ... iewer.html

Posted: Tue Dec 09, 2008 5:34 pm
by Lee Sharp
There are debs out, and they work well. However, you need to set the shared memory key manually for 1.23 as they were compiled for 1.22. Go to http://packages.medianix.net/pool/main/x/ to find them.

Launch with commands like;
xlib_shm -m1 -m2 -m3 -m4 -k 0x7a6d0000
or
xlib_shm -m1 -m2 -m3 -m4 -m5 -m6 -m7 -m8 -c3 -k 0x7a6d0000

it works on a headless server?

Posted: Tue Dec 30, 2008 10:23 pm
by utasc
as title i have zm 1.23.3 on a ubuntu 8.04 headless server.
can i view remotely my cam exporting dislpay on other linux box?

regards

Posted: Wed Dec 31, 2008 8:29 pm
by jameswilson
not with shared mem viewer.
You may be able to use shared mem viewer on the headless box (would require x) and use x forwarding to another box