Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Sunday, December 22, 2013

using your HitBox or other Toodles Cthulhu input device on Linux

I'm something of a fighting games enthusiast, and I've been getting a bit more into it in recent months.

For the discerning player, there are all kinds of interesting input devices ("fightsticks") on offer these days -- you can buy them from big companies like MadCatz or Hori or Capcom, or from a more boutique outfit, or you can do a custom one -- parts are available for building your own or modding existing sticks. There are robust online communities around the whole enterprise, and at least two online stores for buying parts. Fascinating!

I got really excited about, and went ahead and bought, the HitBox fight stick. It's unusual in that it has no joystick; you input directions with buttons. With some practice, you can get really crisp, precise input, which is pretty important in fighting games. It took some getting used to, but now I'm a big fan -- playing games feels like typing, and my thumbs don't get sore.

The HitBox I got is supposed to work both PS3 and PC. It took a small amount of fiddling to make it go on Linux, but it works great now. This approach will probably also work for other devices based on the Toodles Cthulhu PCB.

the problem: the stick seems to immediately disappear...

So here's the problem: when I plugged in my HitBox on USB, it seemed as though it wasn't detected.
I checked dmesg, though, and it turned out that it was detected by the kernel, but then it immediately disconnected itself.

Mysterious shell script from the Internet to the rescue!

Then I found this thread and this shell script. The script apparently convinces the PCB not to disconnect by reading from it as soon as it's connected (the theory is that the PCB tries switching into XBox 360 mode? Unclear...), and it detects the stick by watching /dev/input/by-id.

Unfortunately, the HitBox had a different device name from the one in that original shell script, so I had to figure out where exactly it was showing up in /dev/input/by-id.

Here's an updated version that works with my HitBox.

Finding the filename for the /dev entry for the HitBox was slightly tricky, because how do you discover the filename of a very fleeting file? It disappears as soon as the PCB decides it should disconnect! Here's the command I used:
$ until ls /dev/input/by-id | grep -m 1 Toodles; do : sleep 0.2 ; done
And that helpfully output:
/dev/input/by-id/usb-Toodles_2008_HitBox_Edition_Cthulhu+-event-joystick
which I popped into that earlier script, and everything worked! And now: my (weird) fightstick works whether I'm playing on the PS3 or on a SNES emulator on my computer!

Watch for unnervingly accurate dragon punches and electric wind god fists.

Saturday, June 30, 2012

happy hardware review: usb wireless adapter from ThinkPenguin

I'm in Mountain View for the summer, working on Google Translate for another internship with that company that I seem to work for fairly often. Hooray!

Unfortunately, my laptop's built-in wireless card really doesn't agree with the apartment complex's wireless. So I ordered a little USB stick wireless adapter from ThinkPenguin, and it came pretty quickly, and I plugged it in (and told wicd to look at wlan1 instead of wlan0), and it just worked! Now my wireless connection is pretty fast, and doesn't drop every five minutes! (unlike before; it was a serious pain.)

Particularly, I got this one. Their other products may also be lovely. Thanks, ThinkPenguin!

Wednesday, November 30, 2011

securing your MoinMoin wiki

I really like MoinMoin; it's straightforward, it's Pythonic, it's got WikiWords. Great! I've been keeping a bunch of notes on one.

The IU Computational Linguistics group had an aging MoinMoin too, but most of the edits and new accounts were spam. I suspect the edits were being done by humans too, because they were pretty good at fitting into the markup of existing pages.

We replaced it with a new install (here it is) and make it a bit more secure. We disallowed anonymous edits, and made it so that you can't just arbitrarily create accounts, which took a code change. I added the "if not request.user.isSuperUser() ..." block (suggested here) to MoinMoin/action/newaccount.py. The rest of the changes described on that page aren't necessary -- just make it refuse new account requests.

Then it occurred to me: spammers have probably been trying to spam my personal wiki too! I checked: there were about a hundred spam accounts; a new one every day or two. My Moin was allowing arbitrary account creation, but they were all useless because only I could edit pages!

So in the interest of discouraging future webcrap, let me issue a warning: CyrilleVincent, SabaFaulkner, CasinoBonus, life insurance quotes, and ChickyBowen -- I'm coming for you. And you'd best sleep with one eye open, paydayloansuk214. If that's your real name.

Thursday, March 24, 2011

did you know: F-Spot can export to picasa, flickr, etc!

If you're using Picasa Web Albums, and you're on Linux (maybe a small audience for this post), you don't have to manually upload your files on the web interface or use the Picasa client. The Picasa client is OK, I guess, but it's actually a thinly veiled Windows app bundled with a version of Wine. It's not all that snappy, and it doesn't feel like the rest of the apps on the Linux desktop, and it's not open source.

But! F-Spot is native, and well-integrated with Gnome, and Free Software... and it can very easily upload your photos to picasaweb, or other online photo-hosting places. That's pretty rad.

Wednesday, May 26, 2010

quick commandline trick: find files that you can write to

Here's a trick I found useful today:
find . -writable -type f

find (rtfm) can do all kinds of crazy things. What this does is list out all the files under the current directory that aren't directories, and that you have write access to. Useful for Perforce users -- in p4, if a file is writable, either you're editing it in a change list, or you just accidentally made it writable and you should be editing it in a change list.

Saturday, May 01, 2010

nice wireless card for Ubuntu: TP-Link TL-WN651G

I just got my TP-Link TL-WN651G wireless card, popped it in the computer, and it Just Worked. (Ubuntu Karmic, 9.10).

It uses the Atheros chipset (Atheros AR5001X+), and Ubuntu figures it right out, with the ath5k wireless driver.

So if you're looking for an inexpensive PCI wireless card that you can use on Linux without using a binary blob and ndiswrapper, this is a good choice!

Hooray :)

Wednesday, November 04, 2009

Lenovo: you have to buy Windows, As Per Policy

I got a pretty quick response from the Lenovo sales people -- complete with verbiage at the bottom emphasizing how the email was confidential and legally privileged, and any retransmission, dissemination, or other public use is strictly prohibited. They should have put the EULA for the email at the top, before I scrolled down! I might not have agreed to read the email! Geez, or worse, what if somebody accidentally read it over my shoulder in a coffee shop!

Anyway, they said:
We do not have option to sell any unit without operating system as per policy.

So I guess I won't buy a ThinkPad. I'm just not willing to pay The Microsoft Tax when I'm not going to use Windows.

Sunday, October 25, 2009

trying to buy a ThinkPad without paying for Windows

I got that Dell Mini 12 some time ago, and honestly it's been a pain. It's a good-looking machine, and the keyboard and screen are nice, but the Poulsbo chipset just has terrible Linux support. Like every third time I get an update, something breaks, and I haven't been able to make it suspend/resume reliably in months -- oh, and X just broke again. What I really want is a little ThinkPad.

So I just sent this email to Lenovo:
Hey, good evening,

I'd love to purchase a ThinkPad X200. I haven't found the option on your website, though, for how I can buy one without Windows? Could you point me to that link?

I'm simply not going to use Windows; I would install Linux on it as soon as I get the machine anyway, and I don't want to pay for software I won't use.

So if you can sell me a ThinkPad with no Windows, that would be fantastic, and I'll be really happy and gladly give you money and say nice things about your company.

Thanks very much!

--
-- Alex Rudnick
We'll see what they say! I might just buy the laptop anyway, not agree to the Windows EULA, and then go through the hullabaloo to refund it.

Saturday, August 08, 2009

goto: a utility for bash

Do you ever find yourself, while using bash, wanting to get to a particular file that you know is way down in a big tree of files -- maybe a big Java source tree, or some other nested file structure? You know you want Foo.java, but is it in src/com/foocorp/package/a/b/c, or maybe somewhere else?

Announcing goto, a bash utility which solves just that problem! Now you can just say:

you@computer:~/project$ goto Foo.java
you@computer:~/project/src/com/foocorp/whatever/path/to$ vim Foo.java


... instead of whatever business you were going to do with locate or find or your IDE, or just manually sifting for it.

Here's the README. Comments, complaints, and patches welcome! (and if you find this useful, I'd be really pleased if you'd let me know!)

Friday, August 07, 2009

More Ubuntu: getting the NetworkManager Applet back

Ubuntu comes with this really great network selection applet that sits on your gnome panel. It's called the NetworkManager applet, and it looks and acts more or less like the analogous dropdown menu on Mac OS X. Unfortunately, if you remove it from your panel, it's unintuitive how to get it back.

Maybe you accidentally removed it, and then, after some research, tried "nm-applet" from the command line, messed with the Network Monitor and the Network Connections preference page, and even tried editing nm-system-settings.conf.

What you really want to do is right click on your panel, click Add to Panel, and select Notification Area. Why the nice NetworkManager Applet and battery status applet both live in the Notification Area remains a mystery.

Like so:

Thursday, July 09, 2009

Why your Ubuntu Netbook Remix windows are maximized all the time

I was curious why my windows were all immediately getting maximized on my new kinda-netbook Dell Mini 12, running UNR (with the "Classic Desktop" mode). It's the sort of behavior you can imagine wanting -- with a small screen, maybe you do want to maximize everything? But I wanted to turn it off.

This thread has the answer!

UNR comes with a program called "Maximus", which was in my Startup Applications. To make the behavior go away, just go to System > Preferences > Startup Applications and remove Maximus from that list. Problem solved!

Seems odd that this is a process running in the background, instead of, say, a window manager setting.

Monday, June 01, 2009

back from Google I/O, got a new laptop!

I can speak for myself, at least, in saying that it felt pretty darn good to be on the GWT team for Google I/O. The Google Wave demo at the keynote got a standing ovation, and they made a pretty big deal about how they used GWT and it was a wonderful tool for their work. Pretty fantastic. A standing ovation at a tech conference. Totally electric.

Anyway! I got back, and my Dell Mini 12 with Ubuntu preinstalled had arrived! It's really pretty. The keyboard is a little more cramped than I'd expected (especially with the punctuation keys) but it's got a nice clicky feel. I'm not super-impressed with the Ubuntu version Dell shipped -- it's a specialized distribution of Hardy (last year's version) with some Dell and Yahoo-specific goodies. But the built-in camera and suspend/resume work beautifully! And no Microsoft tax! Not bad, really!

I'm probably about to install a fresh new (9.04) Ubuntu Netbook Remix on it.

Update! There's a bit of a funky driver issue with running the stock Ubuntu instead of the one Dell provides, but it's very surmountable. Here's how to install Ubuntu "Jaunty" on your Dell Mini 12.

Wednesday, February 11, 2009

HOWTO not get "/usr/bin/env: bad interpreter"

If you get this:

bash: ./my-script.py: /usr/bin/env: bad interpreter: Permission denied

The partition your script lives on may be mounted with the "user" option set. "user" implies "noexec" (see the manpage for "mount"), which is going to keep you from running executables. And while running a binary executable from this kind of partition fails more clearly, trying to run a script with a shebang gives you this more confusing error message.

To fix! Add "exec" after your "user" flag in /etc/fstab. (again, see "man mount").

Sunday, November 23, 2008

Fixing your Ubuntu suspend/resume problems

After some recent update, my Ubuntu box (currently "Intrepid Ibex") started having a problem where the networking wouldn't come back up when waking from suspend mode. My machine uses the "forcedeth" ethernet driver (quite a name \m/ ).

The fix! Mentioned tersely over here, and slightly more clearly over here, all I had to do was create a file /etc/pm/config.d/01-modules that contains this line:

SUSPEND_MODULES="forcedeth"

Apparently you can name the file something else, as long as it's in the same directory, but this one worked for me. And of course, if you're having trouble with a different driver, change "forcedeth" to the right module name.

It's 2008 -- why is power management still tricky on Linux? Users (like your non-technical family members) should never have to do this sort of thing.

Thursday, October 09, 2008

Debian on the OLPC

I should go to bed, but I'm having so much fun setting up Debian on my XO laptop.

It was super-easy getting it installed (instructions here); you use the same command for updating to a new version of the standard olpc software and for installing Debian. Or Edubuntu, apparently.

For extra disk space, I blew away the default Sugar/Fedora install -- it's pretty easy to get back to a fresh state, just in case I want to set that up again later.

In 472 megs, I have the base Debian, X.org, subversion, vim, fluxbox, mzscheme, and the Glasgow Haskell Compiler, the install for which pulled in gcc, so was big.

Tuesday, February 26, 2008

Today's viewing: Linus on git.

Not too many months ago, Linus gave a talk at Google about git, the distributed version control system he built for use in managing the Linux kernel. He spoke, in typical non-diplomatic Linus style, about why everybody should switch to git and why CVS, Subversion, Perforce, and non-distributed source control in general is broken.

"There's a few of them in the room, I suspect -- you're stupid!"
-- Linus calls out the svn developers on hand

The Linux kernel team had previously been using the proprietary BitKeeper, which a number of kernel developers (including Alan Cox, with his Mighty Unix Beard) chose not to use. Before that, source control for the kernel was handled by sending patches around -- preferable to using centralized source control, according to Linus.

So let it be known that I haven't actually /used/ git yet, or in fact any distributed source control system -- but I like the idea so far. In this post, I'll outline the reasons Linus lays out for why we should be using git.

First off, the distributed nature of git also has performance and convenience benefits, from the simple fact that it doesn't need to make network roundtrips. Having your own repository on the local machine means that you're always set to go, even if the network is slow or unavailable.

Secondly, traditional source control makes branching and merging branches hard (Linus points out that many real-live software developers have never done it), so you don't want to commit your work until it's ready to be seen by others -- this means that you can't do much version control during the actual code-writing process. Contrastingly, in distributed source control, every checkout acts as its own branch, so each developer has at least one. This has the benefit that you can commit to your own repository whenever you want -- and then back up to previous versions whenever you like.

Centralized approaches to source control are particular drag when people are depending on your committed code as correct, or at least non-breaking -- you're not allowed to commit until your changes are ready for the rest of the team. As a project gets bigger, the associated test suite (hopefully) does as well, eventually leading to a pretty involved testing procedure that developers are supposed to complete before committing. And as Linus puts it, "... people make one-liner changes and ignore the test suite, because they know that those one-liners can't /possibly/, /possibly/ break." And then these breaking changes get pushed out to the rest of the team. The alternative approach, with git, is that you commit to your own version of the repository whenever you want, and when you're ready, your teammates can pull from you -- but in the mean time, you get all the benefits of having your own branch(es).

Thirdly -- social benefits! In his development process, Linus only pulls code from ten or fifteen other developers, whom he trusts to have filtered "up" appropriate changes from the people that they interact with. As he puts it, "if you have determined that somebody else is smarter than you -- go for it!" So the Linux kernel source control process mirrors the social networks of trust that make the whole thing happen. In the end, a lot of people end up only looking at the Linus branch, the defacto "official" one.

This dodges the social issue of giving out commit access to the central repository. Traditionally when managing a project, you create this class of people who are "ostensibly not morons", and typically, you make that group of people too small. Distributed model makes this go away, because everybody has his own branch. And if you happen to do good work in your own branch, then people start pulling from you! "That alone means that every single open-source project should use nothing but a distributed model."

So. That's what Linus said. Will everyone switch to git or some other distributed source control? We'll find out. Adoption would certainly be helped out if major project-hosting sites like Sourceforge or Google Code added git support. But sort of the point of the distributed model is that there's no one central hosting point...

Maybe I'll try it out. I'll let you know.

Monday, February 26, 2007

Ripping DVDs with Free Software!

Just today, a friend of mine needed a copy of a DVD that she could take around with her on a hard drive. So I thought, "well, I'll just take the disk image of it..."

But Apple's DVD player won't play DRM'd disk images, of course.

However! Here's a very nice howto for some very friendly software for Linux, Mac OS X, and BeOS (I know you've all got BeBoxes out there) that'll make video files from your DVDs, no sweat. Super-easy to use. Your mom could do it.

Thanks for the link, Cory Doctorow!

programmable tab completion: you may already have it!

Not long ago, I was doing some mundane upgrade task on the Ubuntu box on my desk. I'd switched out monitors and video cards, and I wanted to make it reconfigure X.org. I type out "dpkg-reconfigure x..." (details are orthogonal, I suppose). But the amazing thing was, I hit tab out of habit, and bash magically filled in the name of the package and some other options, appropriate for the context!

It turns out that this is a feature known as Programmable Completion, available in modern versions of bash and enabled by default in Ubuntu! Who knew?

For example, the Ubuntu version of the programmable completion only fills in ".java" files when you're issuing a "javac" command, and it auto-completes class names (but not .class files) when you're trying to run a Java program from the command line. Flippin' sweet.