WCH341-Terminal History

  • What
  • How
  • History
  • Download

  • I had seen these cheap USB/Serial cables offered on several websites, but always without mention of drivers for Macs. One day I saw one on eBay, and the posting stated it was Mac compatible. Well, I thought, it would only be a $5 mistake if untrue. It was untrue. The enclosed mini-CD had drivers for some verisons of Windows but none for Mac.

    Some time before this, I had come across a project to make a driver for the Prolific PL2303 USB/serial adapater. So I thought: maybe I can adapt that code to work for the pretty silver bondi blue cable I now owned.

    First problem: There is not much official documentation from Apple about how to implement a KEXT providing serial stream services. Perhaps the plan was for USB to take over everything, but plain old serial will never die.

    Second problem: The code for the osx-pl2303 driver borrows from Apple's code for IrDA and contains unused variables and unnecessary code. This is not necessarily a bad thing, but it confused me plenty at first.

    Third problem: I have been unable to find much documentation for accessing the functions of the chip. However, there is a driver written for linux (search for 'ch341.c') and from reading the code in that file, I was able to figure out how to enable basic IO and even control of the handshake lines (DTR, RTS, etc.)

    So I wrote a simple application to access the chip via USB and test some of the things I learned from the linux code. I was able to read and write serial data, and even change the speed(baud). Great!

    But writing a driver(KEXT) was another matter entirely. You see, if the applications crashes, it is not a big problem. When the driver crashes, the computer must be restarted - the hard way.

    I completed it and it worked on 10.4 Tiger and then on 10.6 Snow Leopard. But no one else has been able to make it work. Something wrong with the way I package it; permissions fail. What I have available is the terminal-type application. It has some Applescript support, handles plug/unplug events gracefully, and even manages multiple adapters. There is some very basic VT100 support too.

    This will be useful for communicating with routers or other interactive situations. But there is no /dev/tty* entry created so applications looking for a serial connection will find none. For those situations, I have had good luck with Keyspan adapters and drivers.

    Other Software | email: AaronProman at Yahoo