CopyNES (parallel version) in Linux
Moderators: B00daW, Moderators
CopyNES (parallel version) in Linux
Does anyone here use their CopyNES in Linux? I've had one for a while and never really got around to using it.
There's a few ways to do it involving varying levels of virtualization and emulation (full virt, wine, dosemu, etc), but I'd like to know what other people are doing.
I've though about re-writing the qbasic program in some more recent language, but I'm kinda busy (mainly lazy and hating BASIC).
There's a few ways to do it involving varying levels of virtualization and emulation (full virt, wine, dosemu, etc), but I'd like to know what other people are doing.
I've though about re-writing the qbasic program in some more recent language, but I'm kinda busy (mainly lazy and hating BASIC).
-
MatthewCallis
- Posts: 82
- Joined: Sat Sep 22, 2007 8:32 am
- Location: Seattle, WA
- Contact:
Hi AtariMike,
You sound like you are in a similar boat to myself, I have also considered rewriting the software for Linux. I was a little worried that I would wreck the thing though
Well, in answer to your question, I have successfully been using the parallell version of the CopyNES in linux by running in it windows in VMWare. Probably not all that helpful since running in VMWare is practically like running Windows on the hardware.
I had to use the parport (somewhat older, but allows for real control & development with the parallel port) kernel option for the parallel port device even for it to work in VMWare. I also had to play arround switching the BIOS setting in the VMWare image for the Parallel port, but I asume you would need to do that on a regular windows box too.
I never tried it in Wine. The software/hardware combo just seemed to fragile for me to believe it would work, and now unfortunately, I fried by serial CopyNES and replaced it with a USB one. This one seems to work with no trouble in my VMWare image.
I am reconsidering rewriting the code for the USB version now, as the source is provided, and the component they use for USB communications has a linux version, so it probably wouldn't be too bad.
You sound like you are in a similar boat to myself, I have also considered rewriting the software for Linux. I was a little worried that I would wreck the thing though
Well, in answer to your question, I have successfully been using the parallell version of the CopyNES in linux by running in it windows in VMWare. Probably not all that helpful since running in VMWare is practically like running Windows on the hardware.
I had to use the parport (somewhat older, but allows for real control & development with the parallel port) kernel option for the parallel port device even for it to work in VMWare. I also had to play arround switching the BIOS setting in the VMWare image for the Parallel port, but I asume you would need to do that on a regular windows box too.
I never tried it in Wine. The software/hardware combo just seemed to fragile for me to believe it would work, and now unfortunately, I fried by serial CopyNES and replaced it with a USB one. This one seems to work with no trouble in my VMWare image.
I am reconsidering rewriting the code for the USB version now, as the source is provided, and the component they use for USB communications has a linux version, so it probably wouldn't be too bad.
Has anyone had any luck using the USB CopyNES in Linux (with Wine or otherwise)? I've done a little bit of experimenting and found out:
1. The USB CopyNES uses a USB to serial adapter (FT2232C).
2. Linux recognizes the adapter and maps it to a serial port (/dev/ttyUSB0 and /dev/ttyUSB1)
3. USB CopyNES software appears to run fine with Wine; but it is not programmed to address a serial port directly, only through USB (via ftd2xx.dll).
4. The parallel port CopyNES software will not work, because it is programmed for a parallel port and not a serial port.
I figure if the USB CopyNES program could be programmed to address the CopyNES as a serial port rather than USB (via ftd2xx.dll), it could be used in Wine without any problems.
1. The USB CopyNES uses a USB to serial adapter (FT2232C).
2. Linux recognizes the adapter and maps it to a serial port (/dev/ttyUSB0 and /dev/ttyUSB1)
3. USB CopyNES software appears to run fine with Wine; but it is not programmed to address a serial port directly, only through USB (via ftd2xx.dll).
4. The parallel port CopyNES software will not work, because it is programmed for a parallel port and not a serial port.
I figure if the USB CopyNES program could be programmed to address the CopyNES as a serial port rather than USB (via ftd2xx.dll), it could be used in Wine without any problems.
-
mattmatteh
- Posts: 345
- Joined: Fri Jul 29, 2005 3:40 pm
- Location: near chicago
what does ftd2xx.dll do and is that a windows file or a file of copynes?
i do not have a copy nes and have no experience with it.
i would be interested getting one if it worked with linux and mac natively. (no wine). if copynes uses a usb serial port, then it should be possible to use on any OS with usb ?
matt
i do not have a copy nes and have no experience with it.
i would be interested getting one if it worked with linux and mac natively. (no wine). if copynes uses a usb serial port, then it should be possible to use on any OS with usb ?
matt
-
mattmatteh
- Posts: 345
- Joined: Fri Jul 29, 2005 3:40 pm
- Location: near chicago
-
Lord Nightmare
- Posts: 131
- Joined: Wed Apr 05, 2006 10:12 am
- Location: PA, USA
- Contact:
scanty already made a port of the copynes parallel software to linux. I THINK I have a copy of it somewhere...
Edit: found it. http://www.sendspace.com/file/tqpc3i
LN
Edit: found it. http://www.sendspace.com/file/tqpc3i
LN
"When life gives you zombies... *CHA-CHIK!* ...you make zombie-ade!"
-
mattmatteh
- Posts: 345
- Joined: Fri Jul 29, 2005 3:40 pm
- Location: near chicago
It does this because the chips can be talked to as a serial device with a driver, and Linux apparently has the [virtual COM port] driver built in. Here's a 3rd-party library to use the more direct "bitbang" mode however: http://www.intra2net.com/en/developer/libftdi/index.phpmattmatteh wrote:hmmm
then what is dev/ttyUSB0 and /dev/ttyUSB1 as famitek suggested ?
I don't believe that an app built for the old parallel copynes would work directly with the new usb copynes without modification.
The new usb copynes has a dataport and a control port which are both treated as seperate serial ports when plugged in through the usb->serial driver in linux. I *believe* the old one used the parallel port to do both data and control combined.
the usb to serial driver isn't neccessarily built in, you may need to enable it in the kernel configuration. You need the usb serial kernel module and the ftdi sdio driver for it enabled in the kernel.
On my machine, this creates /dev/USBtty0 and /dev/USBtty1 when the usb is plugged in.
The new usb copynes has a dataport and a control port which are both treated as seperate serial ports when plugged in through the usb->serial driver in linux. I *believe* the old one used the parallel port to do both data and control combined.
the usb to serial driver isn't neccessarily built in, you may need to enable it in the kernel configuration. You need the usb serial kernel module and the ftdi sdio driver for it enabled in the kernel.
On my machine, this creates /dev/USBtty0 and /dev/USBtty1 when the usb is plugged in.
working on USB CopyNES and Linux
I'm trying to do the exact same thing. I've got Ubuntu running the 2.6.24 kernel and a USB CopyNES. Here's what I have so far:
I could easily reverse the entire protocol from the source code for the windows host app. I was hoping that somebody would have a more detailed doc though.
I think it is time to look at the data sheet for the FT2232 chip too.
- 1. I have confirmed from this page that newer 2.6.x kernels use the ftdi_sio driver that supports the FT2232C chip that is in the USB CopyNES. I'm hoping to figure out how to make this all work without resorting to libftdi.
2. When I connect my CopyNES to my Linux box the ftdi_sio driver is loaded automatically and both UARTs are detected. The first one is bound to /dev/ttyUSB0 and the second is bound to /dev/ttyUSB1. Here's the dump from lsusb -v:and the output from /var/log/syslog:Code: Select all
Bus 002 Device 006: ID 0403:6010 Future Technology Devices International, Ltd FT2232C Dual USB-UART/FIFO IC Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 8 idVendor 0x0403 Future Technology Devices International, Ltd idProduct 0x6010 FT2232C Dual USB-UART/FIFO IC bcdDevice 5.00 iManufacturer 1 iProduct 2 iSerial 3 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 55 bNumInterfaces 2 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 (Bus Powered) MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 255 Vendor Specific Subclass bInterfaceProtocol 255 Vendor Specific Protocol iInterface 2 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 255 Vendor Specific Subclass bInterfaceProtocol 255 Vendor Specific Protocol iInterface 2 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x04 EP 4 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 03. I was looking at the source code for the CopyNES host app and trying to get a simple demo program running to confirm that the CopyNES is up and running. The CopyNES host app is just a windows app that sends different commands to the CopyNES with the correct data. There is a command called "CMD_NESINFO" that writes the by 0xA1 on the first UART and then reads back the version string from the first UART. Here's the code but it doesn't seem to work. It hangs during the read loop.Code: Select all
Mar 2 12:32:47 mycroft kernel: [254659.999433] usb 2-1: new full speed USB device using uhci_hcd and address 6 Mar 2 12:32:47 mycroft kernel: [254660.257997] usb 2-1: configuration #1 chosen from 1 choice Mar 2 12:32:47 mycroft kernel: [254660.260911] ftdi_sio 2-1:1.0: FTDI USB Serial Device converter detected Mar 2 12:32:47 mycroft kernel: [254660.260930] /build/buildd/linux-2.6.24/drivers/usb/serial/ftdi_sio.c: Detected FT2232C Mar 2 12:32:47 mycroft kernel: [254660.260987] usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB0 Mar 2 12:32:47 mycroft kernel: [254660.265623] ftdi_sio 2-1:1.1: FTDI USB Serial Device converter detected Mar 2 12:32:47 mycroft kernel: [254660.265643] /build/buildd/linux-2.6.24/drivers/usb/serial/ftdi_sio.c: Detected FT2232C Mar 2 12:32:47 mycroft kernel: [254660.265692] usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB1
4. I think maybe I'm not initializing the CopyNES correctly...I mentally stepped through the CopyNES source code to see where it initializes the chip but since I don't have the source code for all of the FT_* functions provided by the windows ftd2XX.dll, I can't be 100% sure I'm doing everything correct.
I could easily reverse the entire protocol from the source code for the windows host app. I was hoping that somebody would have a more detailed doc though.
I think it is time to look at the data sheet for the FT2232 chip too.
looks like libftdi is the way to go
So it looks like using libftdi is the way to go. That means that you need to unload the ftdi_sio module from your kernel like so:
then use the libftdi library to talk to the CopyNES. I'll have a demo app in just a few minutes.
Code: Select all
rmmod ftdi_sio
I don't see offhand the problem with your code, but I'm pretty sure the kernel driver works fine, and it looks like it is set up right from your posted info.
I have been able to get the internal copynes version and bios version using this driver and put the thing into play mode. Some commands need to be sent to the control port (I think control is /dev/USBtty1 but I might be misremembering) and some to the data port. I can post some sample code in a few hours when I get home.
I have been able to get the internal copynes version and bios version using this driver and put the thing into play mode. Some commands need to be sent to the control port (I think control is /dev/USBtty1 but I might be misremembering) and some to the data port. I can post some sample code in a few hours when I get home.