usb modeswitch / huwaei e392 / raspberry pi / raspbian

With the most recent updates to raspbian (Wheezy) I found that USB modeswitch was no longer switching my Huwaei mobile dongle from usb-storage mode to modem mode. Rather problematic when your endpoint is on a boat and you are trying to connect to it remotely.

After much digging around I think it might be to do with how the kernel usb-storage handles the device. Aferr much mucking around, and this post on stackoverflow , I sussed out that by adding the -I flag I could get the switch to happen as expected. The -I flag sets InquireDevice, so you can make the change more permanent by editing /etc/usb_modeswitch.d/12d1:151a to the following:

# Huawei E392u-12

TargetVendor=  0x12d1
TargetProduct= 0x151b
InquireDevice= 0


This now works reliably over reboots for bringing the device into modem mode.

published 2014.06.04 updated 2017.06.26

For the hate of spam...

I've had to implement comment moderation on the website, it seems like mentioning 'cinema','film','video' and 'baby' is all too much for some [insert string of expletives] spammer and they have decided to try and use this to promote porn. So I've upped the spam checking, and put some moderation in place for anything that doesn't seem that spammy.

The best filters are human. 

[WOW this post managed to get hit with spam within seconds of it being posted...]


After 10 years of my website I wanted to get a better idea of how I had been using and posting, and changing this site. so I have plotted all of my posts on a timeline to get a bettter understanding of it. it is a bit slow to render, and it will get slower, but I like it as a relative view of myself over time.

Next task is to make my CMS work better with the iPhone.

Working round email from Hotmail/Live/MSN failing to be delivered.

Microsoft delivering to A record for webserver not MX record

Over the past month I've had an increasing number of complaints from people I work with about emails being bounced. The problem was intermittent, most email was getting to them, but some wouldn't.

I used to manage all email through my servers, but have slowly been moving it off to Google Apps for domains for each client, which made this quite difficult to debug: no server logs to check through, and every time I asked for a bounce message to be forwarded the message was minimal - no details, just saying "Email could not be delivered"

Initially I thought that PEBKAC as I could see nothing wrong with email configuration, and it seemed unlikely that google were randomly bouncing email or unable to handle high mail loads (though possible, no one was complaining of this elsewhere).

Then it dawned on me, the majority of senders appeared to be having problems from Hotmail/MSN/Live mail... so I jumped into my Hotmail account and started sending some tests. And things became muddier:

It seemed the email was bounced to one domain handled by a single Google Apps account, but not on another handled by the same account. And it turns out that why I wasn't getting a full error message when asked for them from the senders is because Hotmail puts the error message in an attachment - not very handy for forwarding.

Looking at the details of the error message the error was being generated by vchkpw part of Vpopmail, which I know from experience is part of my mail install - Qmail Toaster - and Google don't use. So the email was being rejected by a server other than Google, quite possibly my server.

I checked the MX records for the domains - all correct, all point to googles servers. Very odd. Also odd that this had only started happening recently on domains that had been moved a year ago.

I thought, maybe they are delivering to the old mail server, so I went and checked the logs there. No sign of attempted delivery there. Most odd.

Then I remember, I'd recently set up a mail server on the system that handles the websites for these systems. Primarily for handling mailing lists it doesn't handle user accounts. I checked into the log files, and there are loads of attempts to deliver to email addresses from hotmail/msn/live and the odd one from BT Internet.

So, Microsoft are attempting to deliver email to the Web server rather than the listed MX servers. Well done Microsoft! I don't know _why_ they are doing this, but a quick hack - binding the Qmail SMTP server to a different IP address to the web server - seems to have resolved the problem. Because Hotmail can't find anything running on port 25 of the web server it must decide that it really has to send to the MX server.

Most odd, most annoying, and really bad that I have to work round a problem with an different email sender. Microsoft once again failing to work by the agreed standards of the internet. Yet another reason to not use Microsoft.

Red5 debian/ubuntu package problems

In case anyone has problems installing Red5 0.9.0 RC1 from the debian package, specifically if the package installs OK, but it doesn't run when /etc/init.d/red5 is executed, and you get this error when you run /usr/lib/red5/

Exception in thread "main" java.lang.NoClassDefFoundError: org/red5/server/Bootstrap
Caused by: java.lang.ClassNotFoundException: org.red5.server.Bootstrap
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClassInternal(
Could not find the main class: org.red5.server.Bootstrap. Program will exit.

Just copy the boot.jar from the generic .zip distribution into /usr/lib/red5/ and all will be well.

published 2009.10.25 updated 2017.06.26

Video Vest

Someone banging a big drum.

Just testing that I've managed to reinstall ffmpeg on this server correctly. I hope so after all the rigmarol. Oh, better check flvtool2 as well. hmm.

published 2009.07.28 updated 2017.06.26

Installing ffmpeg-php on OS X against Apache2/PHP5 from MacPorts

[Edit 2011/09/09] ffmpeg-php is long out of date and doesn't compile with later versions off ffmpeg: try this php version instead: , works with very few changes to code - I had to change new ffmpeg_movie() to new FFmpegMovie() 

This is more for my own benefit that anyone elses, so when I inevitably have to recompile in future I don't have to do all this rediscovery again (Yes, I have done this before and forgotten how I did it the first time). However, I thought i'd hack it into some sort of tutorial (expression used lightly).

Asusming you have Apache 2/PHP5 and FFMPEG installed from MacPorts *, and you are reasonably comfortable with the terminal. This is pretty much 'by the book' for the instructions from ffmpeg, save for a few little glitches with the configure script.

Grab the latest ffmpeg-php tarball from here and, open terminal, cd to the download directory and decompress it:

tar xvjf ffmpeg-php-0.6.0.tbz2

change to the resultant directory

cd ffmpeg-php-0.6.0/

run your _port_ version of phpize


now, the first gotcha, you need to run a custome configure line to make sure that the make finds the correct ffmpeg install, and the correct include dirs. Do this:

CFLAGS=-I/opt/local/include ./configure --with-ffmpeg=/opt/local --enable-gd --enable-skip-gd-check

That 'CFLAGS=-I/opt/local/include' part sets and environment variable called CFLAGS to have the value -I/opt/local/include which is a C compiler flag to tell it to search for include files in '/opt/local/include'. We set that, then run the ./configure script which takes that information, and the parameters '--with-ffmpeg=/opt/local --enable-gd --enable-skip-gd-check' to build an appropriate makefile.

Without passing the --with-ffmpeg=/opt/local the configure script will fail with: configure: error: ffmpeg headers not found. Make sure ffmpeg is compiled as shared libraries using the --enable-shared option. If you have got ffmpeg installed correctly (and please make sure you do!) then this means it can't be found, so you need to tell it where it is. Of course you may have installed ffmpeg differently so you can change this appropriately.

The --enable-gd flags force ffmpeg-php to enable gd extensions (so you can export an image in GD format for processing with PHP's GD libraries) and the --enable-skip-gd-check makes it take your word for it that GD is installed, which it was in my case, but I had to force the issue. Sometimes us mere mortals know best.

Without passing the CFLAGS=-I/opt/local/include the make script will generate a message along the lines of error: libavutil/avutil.h: No such file or directory letting you know that the compiler can't fine an include file, and so you need to give it a base include path. Again if your ffmpeg install is not from macports you'll need to change this appropriately.

Now do a simple:


Which will compile our module. Normally now we'd type 'make install' and the module would be installed, but no such luck here. For some reason the configure script insists on installing in /usr/lib/php/extensions/... wherease the rest of our extensions are in /opt/local/lib/php/extensions/... however, to work out _where_ we want to install to we still need to run 'make install' (but not as root - we want the install to fail)

make install

With a bit of luck this will return an error (call that luck?) something along the lines of

cp: /usr/lib/php/extensions/no-debug-non-zts-20060613/#INST@69638#: Permission denied

the bit you are looking for is the equivalent to 'no-debug-non-zts-20060613' as you need this to install in the correct path, which shouldbe '/opt/local/lib/php/extensions/no-debug-non-zts-20060613/' (though you may need to change that last bit, obviously) We now enter:

sudo cp modules/ /opt/local/lib/php/extensions/no-debug-non-zts-20060613/

To copy the php module to our appropriate include directory. You'll need to enter your password to do the copy. Not quite there yet... now you need to add the extension to your php.ini file. By default this is /opt/local/etc/php5/php.ini but if you want to check:

/opt/local/bin/php -r "phpinfo();" | grep "Configuration File"

Will tell you for sure. Open up the file in your favourite text editor (textmate or vim for me) and search for the heading " Dynamic Extensions" in the config file. if it's not there don't worry, I'm just trying to be neat. You neeed to enter, under the rest of your extensions:


then save the file. Now, to check it has installed into php:

/opt/local/bin/php -r "phpinfo();" | grep "ffmpeg"

should give you something along the lines of :

ffmpeg-php version => 0.6.0-svn
ffmpeg-php built on => Jul 21 2009 09:30:03
ffmpeg-php gd support => disabled
ffmpeg libavcodec version => Lavc52.20.0
ffmpeg libavformat version => Lavf52.31.0
ffmpeg swscaler version => SwS1.7.1
ffmpeg.allow_persistent => 0 => 0
ffmpeg.show_warnings => 0 => 0

If so you can now restart apache and start playing with it.

apachectl restart

Hope that helps someone else...

Please note that I'm by no means an expert on this and so can't help you get it working if there are all sorts of other issues, that said leave a comment below listing your problem and I'll see what I can do.

* quick run through, YMMV , check out appropriate variants should you need to:

sudo port install apache2
sudo port install php5
sudo port install ffmpeg +shared

Also, look here for information on install ffmpeg from ports, and here for information on apache2/php5/mysql from ports, which both looks reasonably informative, but I've not bothered to use instead just bludgeoning on and doing it myself previously.

Ayurvedic Me

Ayurvedic Me

Ayurvedic Me

I've been slowly working on the design and identity for Angie's Ayurveda Practice over the last few months - amongst everything else - and have just put up the start of her website.

Simplicity is order of the day, keeping everything clean and minimal, maybe too minimal at the moment, but there is more to come in the days, weeks, months and years that follow.

show menu