Nicolas314

All my geeky stuff ends up here. Mostly Unix-related

Posts Tagged ‘junior

Debian upgrades on Junior

leave a comment »

Junior runs Debian. Debian gets upgraded, so Junior gets upgraded.

Unfortunately this upgrade comes with a kernel upgrade, requiring re-compilation of all specific drivers: sis7019 for sound, ndiswrapper for WiFi and the webcam-specific drivers. I tried to install Debian packages from testing but could not get anything so I tried manual re-compilation. This failed miserably because the kernel headers have changed in some incompatible way. Time for me to Google my way out of this and I could finally get anything back to a usable state.

I am getting quite annoyed by the regular changes in kernel interfaces. There must be other ways of maintaining a kernel without requiring every driver writer to maintain their code for each new release, especially for a piece of software that is 15 years old now.

Advertisements

Written by nicolas314

Tuesday 29 January 2008 at 10:56 pm

Posted in junior

Tagged with , ,

Junior webcam support

leave a comment »

Just for fun: I have added a webcam to Junior. A USB webcam, the kind you can find for 20€ in any computer store out there. I bought one without checking for Linux support beforehand and was lucky enough to get one that is supported. For what it’s worth: the webcam is sold as Hercules Delux webcam. The package said it supports 1.3 Mpix images but that is a lie: the captor is 640×480, that is 300 kpix and they have software to interpolate (extrapolate) to larger images under Windows. Oh well… Next time I will check before going to the store.

Anyway: I needed to compile and install an extra driver to support this camera. The driver is called ov51x-jpeg and it can be found here:

http://www.rastageeks.org/ov51x-jpeg/index.php/Main_Page

Once the driver is loaded into the kernel, you get new devices corresponding to video and audio inputs (this webcam comes equipped with a microphone): /dev/video0 and /dev/dsp1. To check everything is working smoothly, I started up VLC (VideoLAN Client), chose “Open Capture Device” and provided these device names. Video is really smooth on this webcam and sound is working as expected.

Now I have video and sound acquisition capabilities on Junior, which finally enables me to implement a simple but powerful alarm system in my house. What I want is:

– A system running full-time when I am not home
– Keep acquiring images from the cam until some movement is detected
– As soon as something is detected, send the images to me by e-mail and send me an alert by SMS

I should also be able to log into Junior and listen to the audio flux remotely, and why not get the video flux too. I did not get to this last part yet but the rest is pretty easy.

You want to have a look at Motion, a pure command-line motion detector. This utility can be configured to take any kind of action upon detecting movement in a video feed, which is exactly what I want, and it is available from the Debian repositories. It took me a while to understand the configuration file and get it right but once put together it works really nice.

The last part I needed to solve was sending an alert over SMS. Un-surprisingly, there are still no SMS-brokers out there offering SMS sending services for free. You need to register and pay for these, and this is not cheap. I guess this is a good thing in the end to avoid spam on mobile phones in general. I checked out my phone subscription and found out that my provider also offers a Webmail that can be connected to my mobile phone: whenever I receive an e-mail at that address, they send an alert by SMS to my mobile phone containing the e-mail Subject line, and this is free of charge. There we are! The final algorithm can be summarized as:

– Run motion on Junior
– Whenever movement is detected, send the images by e-mail to me, and send an SMS alert to the e-mail account associated to my mobile subscription.

Since I do not want to be flooded with false SMS alarms, I limited the system to sending only one per day. This should be enough. Now I need to find a way to deactivate the alarm system when I come home, otherwise the alarm will trigger every day.

Yet another simple but nice project. Not sure it will ever be useful, I just wanted to know if it could be done!

Written by nicolas314

Sunday 12 August 2007 at 1:17 pm

Posted in junior

Tagged with , , ,

Junior as syslog archiver

with 2 comments

Idea

You have a Junior box or equivalent sitting at the heart of your home network and want to use it as a network syslog archiver for all of your machines.

Aim

All Unix machines on your network store their syslog messages locally and also send them to Junior through UDP packets, where they are stored in separate files for each machine.

Solution

install syslog-ng

The default Debian syslog has the capability to log network-based syslog messages coming from other machines on the same subnet (-r option). Unfortunately, syslog cannot be easily configured to store logs separately
for each machine, so everything ends up in the same files, mixing information from all hosts as well as local messages. This can get quite confusing.

Enters syslog-ng: this new generation brings a lot of useful features, among which the capability to do much better filtering on incoming messages and how to store them. The procedure to install it is as follows:


apt-get install syslog-ng

This will install syslog-ng and remove syslog.

For this example I assume we have a machine on the local network called ‘billy’ at address 192.168.1.10. Modify your /etc/syslog-ng/syslog-ng.conf configuration file as follows:

Add a UDP listener by un-commenting udp() in the source list:

source s_all {
# message generated by Syslog-NG
internal();
# standard Linux log source (this is the default place for the syslog()
# function to send logs to)
unix-stream("/dev/log");
# messages from the kernel
file("/proc/kmsg" log_prefix("kernel: "));
# use the following line if you want to receive remote UDP logging messages
# (this is equivalent to the "-r" syslogd flag)
udp();
};

Add another destination for log files generated by billy:

destination df_billy { file("/var/log/billy/messages.log"); };

Add a filter based on IP:

# all messages from billy
filter f_billy { netmask("192.168.1.10/32"); };

There are probably better ways to do filtering than providing a static IP address. Bear with me, I did not want to get any deeper into syslog-ng documentation since this fits the bill.

Add a rule to combine filter and output directory:

# Billy logs
log {
source(s_all);
filter(f_billy);
destination(df_billy);
};

On billy, make sure syslogd is started with option -R x.x.x.x where the latter is the IP address of your syslog archive box.

You should now get messages logged in /var/log/billy/messages.log.

Written by nicolas314

Tuesday 31 July 2007 at 1:31 pm

Posted in Uncategorized

Tagged with , , ,

Wake-on-LAN

with 5 comments

Looking through the BIOS for Junior, I could find no option to activate Wake-on-LAN. The way to achieve that is actually to configure the Ethernet chip directly. Under Debian, this is done with:
# ethtool -s eth0 wol g

The ‘g’ option for wake-on-lan (wol) actually specifies that you want to wake up on magic packets, but there are other interesting options if you want to wake up on other network events. Read the documentation for ethtool.

One important point: this setting only survives until the next boot. If you want to make it persistent, create a file called e.g. wol in /etc/network/if-up.d with the following contents:

#!/bin/bash
if [ "$IFACE" == "eth0" ]; then
ethtool -s eth0 wol g
fi

Make the file executable by chmod +x wol

I can now wake Junior from another Linux machine on the same subnet using tools like wakeonlan or etherwake. The former does not need root privileges to perform, which is safer.

Written by nicolas314

Sunday 1 July 2007 at 11:30 pm

Posted in junior

Tagged with , , , ,

Bricked… and back

leave a comment »

I bricked Junior by mistake.

The little box only has 128 MBytes of RAM which very soon become insufficient, even when running limited pure-network processes. Adding up swap on a Compact Flash is not a good idea, so I was desperately trying to squeeze the last Megs of RAM from the box. I did something stupid and disabled shared video memory in the BIOS. This bricked the box: no boot, no video, no response to keyboard inputs.

Do not disable shared video memory on these boxes!

To unbrick the box: remove the 4 bottom screws. Remove also the screws on the video plug on the back (one on each side), and the screw on the wireless antenna if you have one. Now you should be able to move the parts but be really gentle. Slide out the grey cover, starting from the back, and you should now also be able to remove the bottom part of the box. The upper part stays soldered to the CPU so do not even try to remove it by force.

If you examine carefully the top part you should see the battery. You will not be able to get to it, but you can see where it is soldered because there are two plugs coming out on the other side. Short-circuit these two plugs with a paper-clip, keep it for several seconds. Try booting the box again, just plugging in a screen and keyboard, and see if you got it back. If you did not, short-circuit the plugs again for more seconds.

Re-build the box when you are done.

I guess I will have to make do with 128 Megs. Re-compiling the kernel may not be such a bad idea after all…

Written by nicolas314

Sunday 1 July 2007 at 12:31 am

Posted in junior

Tagged with , ,

Junior working with WPA

leave a comment »

Junior is now working with WPA-based wireless. Hoping it might be useful to somebody else, this here retraces the steps I had to take to make it work.

There are basically two ways you can control the VT6655-based card provided with Norhtec Microclient Jr: through a native Linux driver, or through an encapsulation of Windows drivers achieved by a piece of software called ndiswrapper.

Browsing the VIA web site for drivers only provided a native driver for other versions of the kernel (mostly Fedora). Since the kernel API has changed in between, there is no way to make these work on a Debian Etch kernel (2.6.18-4-486). Going beyond that means pressuring VIA into either releasing the driver sources or releasing a binary version for this very kernel, an effort which would have to be repeated every time the kernel is upgraded to a non-compatible version (i.e. every new release). Forget it.

The other way proved to be the right one.

Through trial and failure, I found out that the default ndiswrapper version available on Debian corresponds to version 1.28, which is kind of late considering the latest version is 1.47. Many bugs corrections have happened in between and some of them are actually related to the VT6655 chip, so you definitely want to install it from the sources. As a side note, the Debian version is anyway only released through sources, you have to follow a non-obvious procedure to install it. A search on your favorite Search Engine for “debian install ndiswrapper” should yield results.

To install from sources: get the tar file from sourceforge. Untar it, cd into the directory you just decompressed and type make to build it. Change user to root and make install should install it all.

Now you have a kernel module that can encapsulate Windows drivers, but you still need to get the drivers. I cannot unfortunately host binary files on this site but you should be able to find them on Norhtec’s web site:

(URL soon published here)

Get the file, unzip it somewhere and cd into the directory. Now ask ndiswrapper to wrap it up with:

ndiswrapper -i VNWL.inf

Once the driver is available, type ndiswrapper -l to check it is actually there:

# ndiswrapper -l
vnwl : driver installed device (1106:3253) present

Now you can load the module into the kernel. Still as root:


# modprobe ndiswrapper

A quick look at kernel logs with dmesg should tell you about the driver being correctly loaded:


ndiswrapper version 1.47 loaded (smp=no)
ndiswrapper: driver vnwl (VNT,01/18/2005,1.30.00.0164) loaded
ndiswrapper: using IRQ 5wlan0: ethernet device xx:xx:xx:xx:xx:xx using NDIS driver:vnwl,
version: 0x1001e, NDIS version: 0x500, vendor:'VIA Networking Solomon Wireless LAN Adapter',
1106:3253.5.confwlan0: encryption modes supported: WEP; TKIPwith WPA, WPA2, WPA2PSK;
AES/CCMP with WPA, WPA2, WPA2PSK

Now you have a working wireless device in your box. You need to declare a new section in the /etc/network/interfaces file. First something like:


auto wlan0
iface wlan0 inet dhcp

Comment out the first line (auto wlan0) if you do not want the wireless interface to be brought up when you boot.

Now you can bring it up and scan wireless networks with:


# ifconfig wlan0 up
# iwlist wlan0 scanning
[...]

At that point you should be able to connect to your wireless network if it is unencrypted. Do not forget to put the correct settings on your access point for MAC address filtering if you use some, and temporarily deactivate encryption.

Now you want WPA, which is provided on Linux through wpa_supplicant. I juggled with a number of versions and compiling the beast from the sources is definitely not the easiest thing I have tried. Good news: the default Etch version works just fine (0.5.5-2). Install it:


# apt-get install wpasupplicant

An excellent point for the Debian package maintainer: wpa_supplicant has been integrated with the network scripts so that it can be controlled from the /etc/network/interfaces file. This is what my file looks like:


iface wlan0 inet dhcp
wpa-ssid MyAccessPoint
wpa-driver wext
wpa-psk 01234567890abcdef...
wpa-key-mgmt WPA-PSK
wpa-group TKIP

Several points:
– Replace MyAccessPoint by your access point’s name
IMPORTANT: specify wext for the driver to be used, not ndiswrapper.
– Replace the key by yours
– I used the most basic WPA settings here. Compare to the settings on your access point.
– You can also use anonymous access points, but I am not sure how they would be declared in this file.
– These settings are for a DHCP server. For static addresses, see the documentation.

All these options and more are described here:
README.modes

That should be all. If your interface is still up, bring it down (ifconfig wlan0 down) and up again:


ifup wlan0

You should see some messages about the DHCP request and finally a success message showing the address you got.

I cannot thank enough the Norhtec guys for their incredible support in my search of the working driver. Junior has just gone one step beyond in terms of capabilities!

Written by nicolas314

Monday 25 June 2007 at 11:28 pm

Posted in junior

Tagged with , , ,

Hunting for a VIA VT6655 driver

leave a comment »

I would like to get Junior to work with wireless, and unfortunately all I can do with the ndiswrapper driver is no crypto or WEP-only. This does not fit the bill: I need to connect to WPA-protected networks with this box.

There are two ways out of this: find a Windows driver that supports WPA correctly with ndiswrapper and wpa_supplicant, or push the guys at VIA to re-compile a driver for the kernel I use (Debian Etch). I asked on the dedicated VIA forums and got no reply so far. Check out the Linux Arena on the following page:

http://forums.viaarena.com/

There is no emergency since the box is currently wired to the network, but enhancing it to support wireless would boost even more its capabilities. I have a project to link to several of my neighbors over Wi-Fi in our own private network and junior would be perfect to take care of the link.

On a side note, I have hooked in a 40Gb USB drive to Junior and they match perfectly. Only USB 1.1 is supported, which makes data exchange a little slow but largely sufficient to serve files over a network. Now I can leave Junior awake at night to download 700-Mb blocks over the Net! With a little bit of scripting it should even be able to start downloads on its own.

Written by nicolas314

Sunday 24 June 2007 at 11:52 am

Posted in junior

Tagged with , ,