Categories

Pirate Rename – Get a nicely named serial device

Posted on Wednesday, January 27th, 2010 in Bus Pirate by Ian

Tired of the /dev/tty.usbserial-XXXXXXXX address of the Bus Pirate? Piotr developed a utility to edit the EEROM in the FTDI chip on the Bus Pirate, this gives your Bus Pirate a consistent name on MacOSX. Grab the utility here, and follow this how-to submitted by Piotr. Thanks for the tip!

If you have a few FTDI USB devices in your system it might be confusing which /dev/tty.usbserial-XXXXXXXX points to the correct device, as the default isn’t very meaningful. Luckily with MacOSX and the FTDI USB to serial drivers there’s an easy way to change that!

The FT232R uses an internal EEPROM memory to store chip configuration. Programming it lets you change values such as PID, VID, Required Current, CBUS pins config, … and USB device description, which is what we want to change.

By default your Bus Pirate is detected as FTDI, FT232R USB UART with some random serial number like A600blSc. We can change it to anything, up to 46 ASCII characters, and get our device named the way we want. There are Windows tools for this available on FTDI Chip site, but there was none for MacOSX. Since playing with the EEPROM can render your FT232R useless, or at least make you unsolder it, I thought a simple tool which won’t let you break the device would be useful.

That’s why I wrote the Pirate Rename utility. It uses a modified open source library called libftdi-1.0 to talk to the FTDI chip and libusb-1.0.0. They are both embedded in the application bundle so you don’t need to worry about it.

I had to modify libftdi as the default EEPROM routines broke my device! I was lucky to restore it with Linux as neither Windows (BSOD) or MacOSX (Kernel Panic) wanted to talk to it anymore. I wanted to notify libftdi project owner about it, but I gave up when I found out all email addresses are available for spam bots when you sign up for their mailing list. I will try to contact him directly.

Here is a short tutorial how to change your device’s name and description with PirateRename

1. Start the application – As it says in the information box you will need to unload the FTDI kernel extension before you continue. To unload the FTDIUSBSerialDriver.kext open your favourite terminal application and enter “sudo kextunload /System/Library/Extensions/FTDIUSBSerialDriver.kext”. PirateRename will execute “/usr/sbin/kextstat | grep FTDI” to check if the extension was unloaded when you click “Refresh list”.

2. Refresh list will enumerate all FTDI compatible devices and let you choose the one you want to rename. As mentioned above it will also make sure the kernel extension is unloaded.

3. Choose the device if there is more than one and hit ‘Read’ button to read current EEPROM information.

4. You can now either modify the strings yourself or hit the ‘Suggest’ button to insert predefined configuration. If you decide to enter details yourself please remember that the total number of characters for Manufacturer, Description and Serial Number must not exceed 46. It will not let you program the EEPROM if you go above this limit.

5a. When you are ready to program the device please click ‘Write’. When you do that you will be asked if you want to save RAW EEPROM backup. I strongly suggest you do that in case anything should go wrong. This is not likely to happen as I have tested it with multiple devices and no problems were encountered, but still it’s always better to have something to come back to.

5b. Successful write operation is confirmed with the following message box.

6. You can now close the PirateRename application and reconnect your device. When you do that, please go to System Profiler -» Hardware -» USB and you should see a similar entry.

7. You can now load the kernel extension back with “sudo kextload /System/Library/Extensions/FTDIUSBSerialDriver.kext” and start using your Bus Pirate with your new serial device “/dev/tty.usbserial-PirateV3” or any other name you picked!

This entry was posted on Wednesday, January 27th, 2010 at 12:16 pm and is filed under Bus Pirate. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

15 Responses to “Pirate Rename – Get a nicely named serial device”

  1. Gatsu says:

    This is cool as it looks like it works on all the other FTDI UART chips I have. I just renamed my Sparkfun FTDI Breakout and XBee USB Explorer with it!

  2. pppd says:

    It does work with all FT232R powered devices, so feel free to rename all you want :)

  3. pppd says:

    The Mac application uses two libraries released under the LGPL license (libftdi-1.0 & libusb-1.0), I have released its source code on my web page. You can find it in the Downloads section.

    The Windows version uses FTDI drivers so the source code is not there, but if you’re interested please let me know and I will make it available as well.

  4. Josh says:

    Getting a crash on OS X, here. Doesn’t want to open. 10.5.8

    • pppd says:

      Hello Josh,

      Just to clear it up.. was it a crash or it just didn’t start? I am pretty sure the library is embedded correctly. I have tested it with a few friends ( clean install 10.5.5 and 10.6). Can you please use Terminal, go inside the application bundle PirateRename.app/Contents/MacOS and check “otool -F PirateRename”?

      Thanks,
      Piotr

  5. Josh says:

    Fixed it. I had to manually install libusb. Looks like it isn’t properly embedded int the app bundle.

  6. Josh says:

    …and even then, it is shoddy whether or not the device will be picked up with the new serial or a random number such as 00002326

  7. Josh says:

    Oooook. Final comment, I promise. If you rename your FTDI chip in Windows, it won’t prevent a serial name longer than is acceptable. So renamed it with a name a bit too long and, back in OSX, it shows up as 00002326.

    When renamed in the GUI, it presents the red shaded box reminding you of the length of the name. At which point, I gave it a shorter name and all is well in the world.

    Thanks for the tool!

  8. Mudo says:

    Hi!
    I could unzip it!!!

    Any clue?

  9. Mudo says:

    It crash. “How to” about libusb.dylib will be appreciated.

  10. Mudo says:

    It seems that only works in snow leopard and need to fix something wrong with kext files…

  11. David says:

    has anybody some experience with renaming chips under linux? cli would kick ass

  12. Curtman says:

    @David: You can do this in Linux with some udev configuration described here:

    http://hintshop.ludvig.co.nz/show/persistent-names-usb-serial-devices/

    They show an example where you get the serial number of the FTDI chip from dmesg after plugging it in, and create entries in:

    /etc/udev/rules.d/99-usb-serial.rules

    That look like this:

    SUBSYSTEM==”tty”, ATTRS{idVendor}==”0403″, ATTRS{idProduct}==”6001″, ATTRS{serial}==”A6008isP”, SYMLINK+=”arduino”
    SUBSYSTEM==”tty”, ATTRS{idVendor}==”0403″, ATTRS{idProduct}==”6001″, ATTRS{serial}==”A7004IXj”, SYMLINK+=”buspirate”
    SUBSYSTEM==”tty”, ATTRS{idVendor}==”0403″, ATTRS{idProduct}==”6001″, ATTRS{serial}==”FTDIF46B”, SYMLINK+=”ttyUSB.ARM”

    Edit the serial number and symlink, and it will create a /dev/buspirate, /dev/arduino, or whatever when you plug them in.

  13. sam says:

    I am running OSX 10.5.8 and the application fails to open I get this message in the terminal

    Last login: Wed May 9 20:32:03 on ttys000
    Macintosh-26:~ smurray711$ /Users/smurray711/Desktop/rename/pirate-rename/MacOSX/PirateRename.app/Contents/MacOS/PirateRename ; exit;
    dyld: Library not loaded: @executable_path/../Resources/libusb-1.0.0.dylib
    Referenced from: /Users/smurray711/Desktop/rename/pirate-rename/MacOSX/PirateRename.app/Contents/MacOS/PirateRename
    Reason: no suitable image found. Did find:
    /Users/smurray711/Desktop/rename/pirate-rename/MacOSX/PirateRename.app/Contents/MacOS/../Resources/libusb-1.0.0.dylib: unknown required load command 0x80000022
    /Users/smurray711/Desktop/rename/pirate-rename/MacOSX/PirateRename.app/Contents/MacOS/../Resources/libusb-1.0.0.dylib: unknown required load command 0x80000022
    Trace/BPT trap
    logout

  14. George says:

    Hi I’ve been trying to use Pirate rename and I run into a problem.

    I notice that a backup file was created but
    a. How do I restore this back up file?

    b. The backup file seems too short. It is only 0x80 bytes long whereas the eeprom in the ftdi chip is 0xA0 bytes long.

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Recent Comments

  • Parkview: Another great idea! Be handy to be able to purchase the corresponding SMD and TH sockets as well.
  • Ryan White: Second that. I'd love the option to extend this already awesome tool to RF cables, hoping it's already in the works because I know the...
  • Tom Keddie: Hi Ian, Congrats on the launch. Suggest you name all the CHRO connectors you have as female. It's not done often but you can insert...
  • Craig Hollabaugh: Excellent post! Thanks
  • Drone: We need RF/Coaxial cables with connectors. Pre-made custom RF cables/connectors are insanely high in price. We'll pay more for an option to sweep them.