As part of my workout regimen, I tend to prefer machines at the Gym that use this StarTrac system to dump data snapshots of my performance (heart rate, speed, calorie burn rate, etc.) to a binary file. In a future project, I plan to decode this file and perhaps do something with the data, but in the meantime, I’m trying to recreate the uploader function used by the eFitness website the rec center has contracted with for handling this data. That uploader is written in .NET, and takes advantage of some P/Invoke calls unique to Windows to detect when new removable media is added.
Luckily, the Web Service the website uses has a public WSDL, and it’s a pretty straightforward SOAP web service. However, this post isn’t about all that. When collecting StarTrac data, I plug a simple USB thumb drive to a box attached to the excercise machine, it updates a file on the drive every 15 seconds. The path on the drive is easy enough to know (same folder, easy pattern to file names), but how do I detect when the user has attached the device? And where Linux mounted it?
The answer, as with just about anything communication related these days on Linux, is dbus. However, even knowing that you can get that information doesn’t do much for the how. Which is why dbus-monitor is so important. Running dbus-monitor, watching the session-bus (I assume the user is logged in, since I’m using desktopcouch to store data), and on GNOME, the interesting block was this:
This data came in on interface org.gtk.Private.RemoteVolumeMonitor, member MountAdded. I’ll cover in a snippet below (which I plan to contribute to python-snippets). There is one problem I need to solve here. This will provide me with every new mount, not just new USB thumb drives. Now, I could parse the third member of that struct, but that’s gtk sensitive data. It’s possible to change, and would make the code potentially harder to post to KDE or others. Perhaps that last hex value string has the information I need, but I really have no idea. I don’t see anything obviously useful in any of the other sets of member data that I feel I could trust…
However, listening for this event is easy:
import dbus
import dbus.glib # Provides the required Main Loop
sessionbus = dbus.SessionBus()
self.sessionbus.add_signal_reciever(signal_name="MountAdded",
dbus_interface="org.gtk.Private.RemoteVolumeMonitor",
path="/org/gtk/Private/RemoteVolumeMonitor,
bus_name=None,
handler_function=mountDetected)
def mountDetected(sender, mount_id, data):
print "New drive mounted at %s" % data[4][7:]
I probably don’t need to put the Interface and the Path, but I’m a total newbie to dbus, so I did for completeness. And my only issue is that I will see CD’s mounted using this as well, but I suppose I just have to hope they don’t have the folder I’m looking for…but hopefully I can find a better way, even if it involved looking at multiple dbus events and do some internal correlation.
My recent Dell Mini 10 purchase came with a Broadcom BCM4312 Wifi interface. And it worked great…with the Ubuntu 8.04 install that was stock. That wasn’t going to work for me. I wanted the (the Alpha) 10.04 install. Shortly after upgrading, however, my Wifi stopped working entirely. So, I found this bug, happy the problem wasn’t only me. Hell, for a while, I had to use NDISwrapper to use Wifi at all,.
Eventually, I downloaded the compat-wireless package from Linux Wireless, and started running my wireless interface in PIO mode, which worked okay. I could get on the wifi at a handful of places I really needed it (home, office), but not much else. It was a challenge. Hell, I had trouble on our enterprise Wifi, which uses the same SSID across our entire campus. I could get on at a small handful of locations, but not others. No idea why.
Eventually, I was getting fed up with this, so I hit up the Ubuntu forums, and finally found the answer that stabilized my Wifi experience. I had to create a b43.conf file in my /etc/modprobe.d folder, with the following:
options b43 pio=1 qos=0
Apparently the QOS code was occasionally forcing me to have to take my wireless down and reboot the interface in order to use it. Since that change, my wifi has been almost seamless (I still get intermittent disconnects, but they come right back up, that is either the sign of a hacking attempt, or misproperly configured Wifi, I’m leaning toward the latter). It’s been great. And, it seems that in a forthcoming Ubuntu Kernel, the bug should be fixed for real, which I’m really looking forward to. I (and many others) wish that this had been resolved prior to Ubuntu 10.04 shipping, but with any luck, this won’t be a regression for 10.10 and beyond.
Ubuntu 10.04 becomes final today, and this weekend, many an installfest is going to be started around it. If you’re in the Seatlle, WA area, the Washington Loco Team will be having a gathering this evening. Regrettably, in my own area, there are no events that I’m aware of, though I’ve been running with the Lynx for months now. It’s a good release, despite all the drama about themes, and other decisions. Of course, themes can be replaced, buttons can be moved, and if you dislike some of the new defaults (which I do take issue with some), then you can always change them back (though, admittedly, moving the window buttons is harder than it should be). For me, the buttons being moved is a problem, if for no other reason than the fact that I have to sit in front of a Windows box eight hours a day.
What I appreciate most, is that Canonical, and the rest of the Ubuntu Community are still trying to focus hard on supporting newer, or non-technical users. As part of this, the Ubuntu Manual team has put together a new manual, Getting Started with Ubuntu 10.04. If the manual has any weakness, it’s being too thorough. I have no idea how many users that would try to install Ubuntu couldn’t download and create an install disc, or wouldn’t be trying Ubuntu without the encouragement of a friend who does know. But that’s neither here nor there, I suppose. It’s a good book, with a ton of useful information for someone who is new to Linux, or computing in general.
Now, there are a few things that they haven’t addressed, that are covered fairly well in this video about Linux things that still suck, some of which Ubuntu may well address by 10.10. I’m hoping Audio gets worked out. I bought Shadowgrounds: Survivor a short while ago, but for some reason, the audio plays around 30 seconds later than the action happens on screen. Which is…not ideal. I’ve got a support request into LGP, and I hope that they’re making some progress, because I’m stumped. Anyway, that’s a general complaint, as audio issues are unfortunately common throughout the Linux world today.
One of my favorite features in the new release is the Ubuntu One Music Store, which integrates directly into Rhythmbox (and a Banshee plugin is underway), and it’ll sync directly to your Ubuntu One account, allowing your music to follow you, and not be lost in the case of catastrophic computer failure. It’s almost perfect, almost because I can’t use the payment method I’d prefer, but that’s a fairly small thing. This is likely to replace my use of Amazon’s MP3 store, if for no other reason than even if I didn’t use U1 to store my files, I can download from the provider 3 times, instead of Amazon’s 1.
With the official release complete, I might be able to convince my wife to let me upgrade her laptop now…
Flash has always been one of those necessary evils of the ‘net. Early on, it was far more evil, as we’d have tons of websites built entirely on flash, which were enormous in the days of 56k. Not that you don’t still see a lot of Flash, and pretty shitty Flash, but these days, Flash is mostly used in places where it really adds something, like video playback, or certain types of applications.
When Flash finally came to Linux, it was a really big deal for those of us who were using the platform as our only OS. Finally, there was nary a site on the ‘net that was inaccessible on our platform of choice. However, for me (and some others) the joy was fairly short lived. 64-bit processors were just around the corner, and with them 64-bit Linuxes.
Now, there is probably no good reason for me to want or use a 64-bit Linux, at least not until I get that 8 GiB of RAM I’ve been eying, but that’s starting to change (this seems to be driven largely by Microsoft finally starting to push 64-bit more seriously with Windows). Ubuntu has been really good to me, as far as running 64-bit, but Flash was always a problem.
See, Ubuntu insisted on including a 64-bit build of Firefox, but no 32-bit build. And you couldn’t load a 32-bit plugin into the 64-bit build. Enter nspluginwrapper, a project which allowed the loading of 32-bit code into that 64-bit image. Unfortunately, it was flaky, and didn’t work very well. YouTube would often crash my browser, sometimes the Flash simply wouldn’t appear.
So, you’ll imagine my surprise (and glee) when I read on Steven Harms’ blog that 64-bit Builds of Flash for Linux were available. Not only that, but Flash player 10, which means the Linux version (finally) hit almost the same time as Mac/Windows.
Installation is simple, just make sure the 32-bit version isn’t installed, and drop the contents of the tarball from Adobe into /usr/lib/mozilla/plugins. You might have to restart Firefox, but I didn’t, and it just worked. Thank You Adobe.
Finally, I can go back to watching videos of funny cats.