Linux support for Genius WizardPen, Mousepen, UGEE, UC-Logic, DigiPro tablets

I noticed that today’s Woot was a DigiPro UC-Logic drawing tablet.  I happen to own a UC-Logic tablet: a “WP4158U 快速龙” made by Taiwanese company UGEE.  UC-Logic makes tablet technology for many different companies, and their USB interface is relatively standard and straightforward. (I naively tried reverse-engineering the USB communication for my tablet a couple years ago, and then didn’t know what to do with the results.)  All of the UC-Logic tablets, as well as Genius Wizardpens and even Aiptek tablets can be used in Linux with the “wizardpen” driver.

The basic instructions for setting up the wizardpen driver in Ubuntu can be found on the Ubuntu wiki. If you use Ubuntu, use the instructions on there to install the driver; otherwise, do what your distribution needs.  However, the instructions on there for configuring udev and X.org are a bit overcomplicated and unnecessary.  You don’t need to create udev rules.  Instead, in your xorg.conf, add something like

Section "InputDevice"
Identifier      "MyGenericTablet"
Option          "SendCoreEvents"        "true"
Driver          "wizardpen"
Option          "Name"        "Tablet WP5540U"
Option          "TopX"          "2199"    #Replace these numbers with
Option          "TopY"          "3598"    #numbers correct for your
Option          "BottomX"       "30325"   #own unique tablet by using
Option          "BottomY"       "29278"   #wizardpen-calibrate
Option          "MaxX"          "30325"
Option          "MaxY"          "29278"
EndSection 

Where the “Name” option is the name of your tablet.  You can find out the proper name of your tablet by running

$ cat /sys/bus/usb/devices/*/product

and looking for the line that would be your tablet.  Mine was simply called “TABLET DEVICE”, so that’s what I put in my config.  That way, X will now to use the wizardpen driver for the device that has that name, saving you the trouble of creating udev rules.

Next, don’t forget to add

InputDevice "MyGenericTablet" "AlwaysCore"

to your ServerLayout section.  Forgetting this little step will leave the configuration incomplete, and your tablet broken. After you restart X, start the GIMP, Inkscape, Krita, or whatever paint program you use.  Go into the configuration, into Extended Input Devices, and you should see a new entry that bears the name “MyGenericTablet” or whatever you called it.  You should be able to draw with pressure sensitivity with your fully-functional tablet.  However, one problem that might occur is that you get two separate cursors—your paint cursor and a regular mouse cursor—whose positions are not matched. This is because your tablet is being reported twice: once in /dev/input/mice, and once with the tablet driver.

To fix this, you need to replace “/dev/input/mice” with “/dev/input/mouse#” where “mouse#” is the entry for your mouse.  The way I found out which one was the right one was by running “$ sudo cat /dev/mouse1″, moving my mouse, and seeing if any gibberish appeared on the screen.  I did the same for mouse2, etc. until I found the right one.  However, if you do this, be aware that you may need to change this entry when you change to a new mouse, because X.org is not longer set up to use aggregated mouses.

Autodesk licensing issues?

Are you having problems with your 3ds Max or other Autodesk license?  Need to change your serial number to a new one?  Does the program keep giving you a license error when you try to activate?
To reset your serial number so that the program asks you for a new one, start up regedit.  Look in HKLM\SOFWARE\Autodesk\[program name]\[version number] and you’ll see two keys, an “h_register” and l_register.”  If you delete both and restart your program, it will ask you for a new serial number.
If it still fails, look in C:\Documents and Settings\All Users\Application Data\Autodesk\Software Licenses, and the *.dat file inside is your license file.  If you delete it or rename it to something safe (I would just add an underscore to the end), the program will restart the registration process without any erroneous information.  You might have to try this a couple times.

Working Wi-Fi on Macbooks with Ubuntu Linux

To use a MacBook’s Atheros wireless chipset on Linux, you need to use Ndiswrapper with the provided Boot Camp drivers.

  1. Get the wi-fi driver at makel.org. The one you’re looking for is drivers/Atheros/AtherosXPInstaller.exe.
  2. Install ndiswrapper from apt.
  3. Install unrar from apt.
  4. Extract the drivers with “$ unrar x AtherosXPInstaller.exe
  5. Install the drivers with “$ ndiswrapper -i net5416.inf
  6. $ sudo modprobe ndiswrapper
  7. $ sudo echo >> /etc/modules “ndiswrapper”
  8. Delete the temporary files
  9. The wireless should start working immediately.

Dual-booting Windows and Leopard with Kalyway

(not for public use)

Here’s my plan:

  1. Windows partition (NTFS), about 40 GB or more
  2. Mac partition (HFS+), about 20 GB or more
  3. Data partition (preferably FAT32), the rest of the drive

The data partition is for all the documents and music and stuff, so it can be shared by both operating systems. The reason for using FAT32 is that Mac can read, but not write to NTFS partitions (unless you install MacFUSE with the NTFS-3G driver, remount your drives, and remember to always dismount your drives before you shutdown).

Alternatively, if you don’t want three partitions:

  1. Windows partition (NTFS) the rest of the drive
  2. Mac partition, about 20 GB or more

This is for one drive. If you have another hard drive that you can wipe and dedicate to Mac, you can completely skip partitioning and save some work.

  1. First, boot to the Ubuntu disc. When it starts, go to System → Administration → Disk Partition tool (or run gparted from a console).
  2. Decide on your plan of action. What the computer probably has right now is one large NTFS partition. Choose one of the plans listed above, or create your own if you want to boot more operating systems. Remember that you can only create four “primary” partitions. If you need more, you would have to create a “logical” partition (which counts as one primary partition) that can be further divided into smaller partitions. It is recommended that you always put operating systems on primary partitions.
  3. Partition the drive.
    1. Shrink the NTFS partition to make room for the other partitions. You must have plenty of free space on your hard drive for this.
    2. Depending on your plan, create one or more new partitions to take up the freed space. However, GParted cannot create HFS+ partitions that Mac uses. So, for the Mac partition, just create a partition that’s the right size and format it as FAT32 or anything else. Don’t try creating an HFS partition.
    3. Commit your changes.
    4. Exit GParted.
    5. (Optional. I think you can do without, but this is how I did it.) Start cfdisk. Go to Programs → Accessories → Terminal and run “cfdisk.” If cfdisk is not installed, run “sudo apt-get install cfdisk.”
    6. Cfdisk is a text-based program. The left and right arrow keys choose the actions at the bottom, and the up and down keys choose the listed partitions. What you want to do is manually set the identifier for the partition you made for Mac to “AF.”
  4. Reboot into the Mac DVD.
  5. This is Kalyway’s Leopard install DVD for great justice.
  6. Before you follow the wizard, start Disk Utility. Reformat the partition you made for Mac into an HFS+ partition. Don’t touch anything else.
  7. Now you can follow the wizard. Make sure that on the last screen, you click the “Customize…” button. Choose only the drivers that you need. The most important one is NVInject for your video card, and the standard one should work. Only choose other drivers if they match your motherboard’s stuff. In the KOOLSTUFF list, I recommend downloading Adium and things like that after you install Leopard.
  8. Install.
  9. Enjoy???
  10. When you boot your computer, it should now boot into the Darwin bootloader, which should let you choose which OS to boot to. Don’t ever use the partitioner in Windows again. It will change your boot so that it only boots to Windows. Making a backup of your MBR is not a bad idea.
  11. Download important things like Adium, VLC, and Firefox.
  12. In iTunes, if you’re sharing music, it might be a good idea to tell iTunes not to copy everything to your Music folder. Alternatively, you can get Songbird.
  13. If your video resolution is still bad (1024×768 or worse) and you can’t set it higher, that probably means you don’t have the right video drivers. This can be confirmed by looking in the System Profiler. Get the latest NVInject and install it.
  14. If you have no sound (e.g. music won’t play in iTunes), you might need the AppleHDA patcher and the corresponding Linux codec dump (there is a link to some on the AppleHDA patcher page).
  15. When stuck, look on the OSXProject Wiki’s Hardware Compatibility List for your motherboard.

Alternative instructions.

  1. Buy a Mac.
  2. Enjoy???

Constructor Chaining in Java

When you have a class that extends another class in Java, initializing that child class will first call the parent’s initializer, and then the child’s. So if you have:

public class Base {
    public Base() {
        System.out.print("Base  ");
    }
}
public class Derived extends Base {
    public Derived() {
        System.out.print("Derived");
    }
}

The code Derived d1 = new Derived(); will print Base Derived.

4 Ways to Disable Autoplay in Windows XP

Autoplay can helpfully automatically do things when you insert a disc, but it can get your computer rootkitted or just be plain annoying. If you want to turn it off, there are several ways of doing it.

  1. To disable autorun just temporarily, hold down the Shift key as you insert a CD.
  2. Go into Device Manager (Control Panel→System→Hardware→Device Manager), select your disc drive, go into its properties, and uncheck “Auto Insert Notification.”
  3. If the last step doesn’t work (you don’t see such a checkbox), try downloading Tweak UI, a useful tool from Microsoft for manipulating many Windows settings. In the disc drive settings (My Computer→Autoplay→Drives), uncheck the letters for which you do not want Autoplay on.
  4. If you don’t wish to download and install Tweak UI, you can use the Group Policy Editor on Windows XP Pro (this tool is slightly dangerous if used incorrectly).  Run “gpedit.msc” and navigate to the System templates folder (Computer Configuration→Administrative Templates→System) and open up the “Turn off Autoplay” template.  Change it from “Not Configured” to “Enabled,” which should turn off AutoPlay.

Playing ASS/SSA with Fontconfig in MPlayer on Windows

MPlayer has support for many file formats, most importantly Matroska (.mkv) containers which are common for watching anime. Often, subbers will use custom, nice-looking fonts that they embed into the Matroska containers. However, to use these fonts, MPlayer relies on Fontconfig. Without Fontconfig, MPlayer can’t use custom fonts.

First of all, you don’t have Fontconfig on your Windows system. You’ll need the Cygwin version of Fontconfig, that you can get through Cygwin’s installer. (I will omit the details in this write-up.)

The configuration files that come with Cygwin Fontconfig don’t work. You’ll have to edit /etc/fonts/font.conf and manually add your Windows font directory to the list.

Second of all, most MPlayer builds for Windows are not compiled with Fontconfig support. Short of compiling it yourself, you can find fresh builds that do have Fontconfig support at this binary build website.

Again, you might have to edit the fonts.conf in your mplayer/mplayer directory. You might have to run MPlayer from the directory that it’s in for it to work. If Fontconfig has a problem, MPlayer will only say something like “MPlayer interrupted by signal 11 in module: filter_video.” To confirm that Fontconfig is the problem, run MPlayer with Fontconfig off and see if it works.

Edit: The easiest way to get nice subtitle support is to use the actively developed CCCP Alternative MPlayer Build, that requires only a couple external DLLs (included).

HP dv6605 dv6000 XP drivers

I got a new HP dv6605 Pavilion laptop, but it came with Vista. I reimaged it with XP MCE from an older Pavilion onto it, only to find out that none of my drivers worked.

HP doesn’t provide XP drivers for this laptop – only Vista drivers. There are three main things that need drivers: the video card (nVidia GeForce Go 7150M), the chipset (nForce 650M), and wireless adapter (Broadcom something-or-other). I’ve got all but the wireless working so far (I’ll try that next).
For the video card, theoretically any new ForceWare driver release should work because nVidia uses a unified driver architecture (UDA), but the ForceWare installers are picky about which cards they’ll install for. I used the 156.65 drivers from laptopvideo2go.com. Newer drivers will probably work if you get modified INFs.

Edit:  Newer video card drivers don’t work, at least for me.  I tried a couple drivers from the 16x.xx series and it only made Windows unbootable.
The nForce chipset, which includes Ethernet and stuff, was trickier. Somebody reported limited success with using Vista drivers from HP in XP, but Ethernet didn’t work. I found out that nForce drivers from Acer worked for my HP laptop, including ethernet.

For sound, the Conexant HD Audio is the same as HP’s other models. I was able to go into Device Manager and install the driver by choosing to select for a list. The Conexant HD Audio driver was under “Sound … controllers,” “Conexant,” “Conexant HD Audio.” It was in the list probably because it was leftover from my last laptop. You can also try downloading the driver from HP’s website – try searching for the “dv6110us” model and getting drivers from there. The audio instantly worked after installing the driver.
When I tackle the Broadcom wireless, I’ll update this.

Edit: I got my wi-fi working using the Broadcom drivers from the Acer website mentioned above (link again). They’ll be named “Broadcom Wireless LAN Driver 4.100.15.7_Negative_Foxconn” when you install it. There’s an interesting side effect to these drivers: the light by the wi-fi switch will be orange when it is off, slowly blink blue and orange when it’s on but not connected, and rapidly blink when data is transmitted.

LaTeX MLA Style With Title Page

So I was typesetting one day…

… and my English teacher wanted us to use a title page on our essay. I was using the mla-paper package in LaTeX, but that package only allowed for a standard MLA paper with the heading on the first page. I needed a title page, and so I hacked mla.sty into mlawithtitle.sty which has a title page instead. It’s not a very pretty hack, but it allows for a separate title page and that’s what matters to me.
Get it at http://files.aztekera.com/schoolwork/mlawithtitle.sty.

Usage notes are in the file itself.