The Joy of Wireless Networking with Linux

I just bought a cheap D-Link DWL-G120 “AirPlus” wireless adapter which connects to the PC via USB. I was hoping to either set it in AP (“Master”) mode and use it as an access point (so I can connect to my server from my MacBook wirelessly) or, failing that, in Ad-hoc mode; however, it seems that the prism (p54usb) driver in linux supports neither mode. Not that this is actually documented anywhere or anything, no, that would be too helpful! You can actually set Ad-hoc mode using iwconfig, but then trying to bring up the interface (with “ifconfig wlan0 up”) generates:

SIOCSIFFLAGS: Operation not supported

Needless to say, that’s not very helpful, and there’s no dmesg output which gives any clue as to what the problem is. Your humble narrator spent several hours sifting through kernel source code before he discovered where the problem was (drivers/net/wireless/p54/p54common.c, p54_add_interface() method refuses anything but managed mode; no trivial fix).

I found a patch which apparently adds support for both Master and Ad-hoc modes, and though I managed to apply it against my 2.6.26.3 kernel tree, it doesn’t work and caused a kernel panic when I was messing around with it (so, yeah, not good really). It didn’t apply cleanly so though I assume that there might be some kernel tree out there with working Master mode for the p54, but if there is I can’t find it. The patch doesn’t seem to be applied in the wireless-next tree. Looks like I’ll just have to find a wireless router for the time being.

Links:

http://wireless.kernel.org/en/users/Drivers/p54 (yeah, ok, here it says that only Station mode (= Managed mode) works).

Edit 2008-09-01: Hmm. I now have a linksys router running (as an AP) and still can’t connect to it using the D-Link. Can’t be bothered to debug it just now, but I suspect the driver just Does Not Work at all (though it can list various networks it finds on the airwaves, so it works partially at least).

Advertisements

Apple Sues Again

A while ago I wrote an entry saying how Psystar, which appears to be a Florida-based company, has begun producing Mac clones which can run Mac OS X. These clones were never sanctioned by Apple, and there was some speculation at the time that Apple would fire its legal cannons at some point.

It seems that time has now come.

It will be interesting to see how this plays out. From what I can gather, Apple are arguing that trademark infringements have occurred and weakened Apple’s name. Without knowing much detail, this sounds pretty weak. On the other hand, Apple has a lot of money and a lot of lawyers. Also, as I’ve discussed previously, Apple software EULAs often specifically state that you may not use their software on non-Apple hardware – a term which may or may not be enforcable in the courts.

Only time will tell.

2008-8-7: Psystar has countersued Apple, for anticompetitive business practices.

Hardware that Works with Linux

It’s sometimes surprisingly difficult to find out whether hardware will work with Linux. Partly, this is because a piece of hardware often consists internally of chips manufactured by someone other than the hardware itself, and it’s the chips which you must have drivers for. For instance, I have a Leadtek TV tuner card (PCI) and the chips onboard it are a couple of Connexant chips plus a Philips (tuner) chip. This is one of the few products I have seen which actually lists the chips on the box, however. Finding out what chips a product uses can be difficult in itself. Often the easiest way (for PCI cards) is to plug the card in and use “lspci” or equivalent to find out what’s on it, but by that stage you’ve already laid down your cash for the product.

Even knowing the chips and knowing that there is a linux driver for them doesn’t always tell you how well your device will be supported. The aforementioned TV tuner card required that I add a subsystem ID to the driver and recompile the kernel. Once I’d done that, it worked fine (well, it received digital TV fine; I never tried analog. I also got the remote to work fairly easily).

I bought a new (external) ADSL/2/2+ modem recently, an “OpenNetworks iConnectAccess621”. It has a single ethernet port as well as a USB port. I wondered if I would be able to talk to the modem via the USB port and thereby free up two ethernet ports – one on the PC and one on the modem. As it turned out, the iConnectAccess621 use a Texas Instruments (TI) chip, and I could talk to it using the “RNDIS” driver in Linux (RNDIS apparently is a badly-documented Microsoft-developed protocol for ethernet-over-USB); however, restarting the computer seemed to lock up the connection (couldn’t talk to the modem anymore) until I also power-cycled the modem. I partly blame the modem and partly blame Linux’s USB implementation (which seemed to have a lot of trouble dealing with the resulting situation on the USB bus; kept on giving error messages and took ages to boot).

Continue reading

The Alternative Mac?

Recently I wrote a post about Apple’s EULA for various of their software products requiring that the software only be installed and run on Apple-manufactured hardware. Just recently, a company called Psystar Corporation (yeah, I don’t know how to pronounce it either) made an interesting announcement: they are producing Mac-compatible PCs which can run OS X. Not only that, but they’re willing to sell you OS X Leopard pre-installed on the machines.

I wonder what Apple’s response to this will be. Apple are fairly litigous and I will think they will probably try for an injunction if they think they have any chance of succeeding. Of course, they might decide they don’t. I’ve already said that I think the terms of the EULA are anti-competitive and should be illegal; now, we might find out what the courts think (or at least, whether Apple believes its own terms are enforcable. If it doesn’t, that certainly leads to the question of why they inclue these terms in the first place…).

Edit 17/04/08: You might want to be careful before you give this company any money. See what OSNews says.

The Illegal use of Safari

As this Slashdot story says, Apple’s “Safari for Windows” according to it’s EULA could only be installed on Apple-manufactured hardware. Which is, needless to say, pretty stupid. I understand the issue has been resolved now (i.e. Apple have changed the license) but the fact it happened in the first place is just hilarious.

Now as companies go, Apple is a real bastard anway. I mean, they have attempted to sue people left right and center for just discussing products that they might (or might not) be going to release; they don’t have a public bug database (and they seem to ignore some bug reports); they don’t let users know what is going on with their development plans (Java 6, anyone?); they release software as a “beta” which expires and actually refuses to continue working once the final product is released even though getting that requires you upgrade to a whole new operating system version (Boot Camp – and yeah, I know the license for the beta said that this would happen all along, but it’s still rubbish. As far as I know not even Microsoft uses these “What I giveth I also taketh away” tactics). Apple is also a control freak – why can’t I transfer songs from one computer to another via my iPod? Because the software won’t let me, and that’s the only reason. Despite all this many people pay good money for Apple products, that is, they actually pay money to be shafted by Apple. I myself have paid more for Apple hardware and software than I have for PCs, primarily because I would rather be reamed by Apple than use Windows (and I do, occasionally, still need to use commercial software which isn’t available for Linux or BSD).

But I’m going off on a tangent. The real issue is software licensing, and what a pile of droppings it normally is (what other product imposes conditions on you after you’ve already paid for it and taken it home from the shop?). A lot of it is questionable in terms of legality anyway (as far as I understand, copyright is about the conditions under which you can duplicate or reproduce copyrighted works, not what you do with them afterwards, even though many software licenses try to limit use in various ways). The really annoying thing is that you’ve really got no recourse if you don’t like the terms of the license, other than not to use the software (or to ignore the license, which might be illegal). The “must be used on Apple hardware” term is a perfect example of a potentially very annoying (to the user) condition which doesn’t actually seem to benefit Apple in any real way.

I can see what benefit Apple thinks it’s getting from terms such as this (which I think it’s safe to assume is a boilerplate term used in a lot of Apple software licenses) – they’re trying to increase hardware sales. If you want to use OS X, you have to buy a Mac to legally do so. This sort of license condition is, however, anti-competitive. It makes non-Apple hardware less useful because you’re not allowed to run OS X on it, even if the hardware is perfectly capable of doing so from a technical perspective. I can understand that Apple don’t want to provide technical support in that case but they shouldn’t be trying to make it actually illegal to install their software on any machine you like.

CUPS and unhelpful error messages

I’m currently trying to set up my HP PSC 1410 printer with CUPS. For a bit I was getting this message, when I tried to print a web page via the CUPS web interface:

Error: Unsupported format ‘application/postscript’!

Well, it turns out the problem was I needed to update my ghostscript version to one that included the “pstoraster” filter (specifically, GNU ghostscript 8.60, though I assume GPL ghostscript 8.60/8.61 would be fine also. Let’s not get started on the ridiculous number of ghostscript variants; I’ll save that for another day). I could have been saved quite some time if this had been made more clear by the error message. How about something like:

Unsupported format ‘application/postscript’: Could not find “pstoraster” filter specified in /etc/cups/mime.convs file

That would be much more helpful! Yes, I understand it might not be meaningful for a casual PC user but then the original message is not helpful in that case anyway. Oh, and it gets rid of that annoying exclamation mark.

Still haven’t got the printer working though; now it just starts a whole bunch of processes (foomatic-rip, gs) which all just seem to hang.

Update: Ok ,several hours later I have got it working. It was permissions; I had to modify udev rules so that the usb device nodes were created with the right group and permissions. Incidentally, hplip (HP’s software) includes a udev rules file but it’s outdated (uses SYSFS instead of ATTR) and insecure (sets mode 0666 instead of 0660). I don’t know why the driver doesn’t try and open the device before running ghostscript and all that stuff.

Oh, and CUPS has a weird problem when you have only a single remote printer, and no local printers. For some reason, when I try and modify a class, the remote printer doesn’t come up in the list. I could add the remote printer to the class via the command line, however.

Things not to do in an open-source project

After years of building packages for my box, I’ve encountered several very annoying tendencies. In no specific order:

1. From a library, don’t print output to stdout or stderr, or any other arbitrary file or stream. All error messages should be returned to the application which can then decide what to do with them. It’s also wrong to require an “error handler” to be established. The way that an error is handled often depends on the circumstances of the call to the function in which the error was detected. There’s nothing worse than application which spews out meaningless dribble from one or more of its libraries.

2. Not allow “make DESTDIR=/some/directory install” to alter the installation location.Using something other than DESTDIR should be avoided (it’s a de-facto standard) and if it’s not documented, that’s even worse. (INSTALL_PREFIX is sometimes used instead. Anything else is definitely out).

3. Use a funky build system which doesn’t allow “make DESTDIR=…” or equivalent. Makefiles are ugly but they can do the job. Most “better makes” are actually really crap.

Continue reading