Using CT-S280 with USB interface

## Overview

The USB interface of CT-S280 is not a printer class device. When you connect the printer to your computer, its kernel cannot recognize what kind of device is connected.

In this page, there are instructions to make kernel and CUPS to recognize CT-S280 with USB interface. (These instructions are based on Version 2.6)

Following instruction indicates to modify kernel of your computer. Linux on your computer does not boot if you fail to modify. Please modify, carefully.

## About Virtual Serial Port of CT-S280

USB interface of CT-S280 is structured with USB-serial converter and serial interface. If this printer is connected, a serial port that connected to CT-S280 with serial interface is added to your computer.

The USB-serial converter is compatible with FTDI's product.

## Install Driver

# Kernel Configuration

Configure to use FTDI USB-serial converter.
Go to the directory where the source files were extracted, and execute the following command.
make menuconfig
Trace the menu items in order of followings.

- Device Drivers
- USB support
- USB Serial Converter support

If only one item (such as "XXXX support") is displayed, activate it, and more items will be displayed.
In the "USB Serial Converter support" menu, activate "USB FTDI Single Port Serial Driver (EXPERIMENTAL)" to compile as a module or to embed into kernel.

# Patch Source File of the Kernel

Patch "ftdi_sio.c" in the "driver/usb/serial" directory.

Add an item which meanes both Vender ID and Product ID of CT-S280 (each value is 0x2730 and 0x1000) into the list of "usb_device_id" structures named "id_table_conbined". To be concern, add following line.

{ USB_DEVICE(0x2730, 0x1000) },
Following lists are part of "ftdi_sio.c" of version 2.6.23.1.

Before patch

          { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) },
          { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID),
          .driver_info = (kernel_ulong_t)&ftdi_olimex_quirk },
          { },                                    /* Optional parameter entry */
          { }                                     /* Terminating entry */
      };

After patch

          { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) },
          { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID),
          .driver_info = (kernel_ulong_t)&ftdi_olimex_quirk },

          {USB_DEVICE(0x2730,0x1000)},     //CT-S280

          { },                                    /* Optional parameter entry */
          { }                                     /* Terminating entry */
      };

# Compile Driver

Compile patched driver. Choose one of following by your configuration.

To Compile Driver as a Module
  Compile modules.
  make modules

To Embed Driver into the Kernel
  Compile kernel
  make

# Install Driver

Install the compiled module or kernel. In this operation, the root privilege is required.

To Compile Driver as a Module
  Install modules
  make modules_install
  It is not required to reboot your system after the modules are installed.

To Embed Driver into the Kernel
  Compile kernel.
  make install
  It is required to reboot your system after the kernel is installed.

# Register Driver

Register a driver to be read by kernel when CT-S280 is connected. Execute the following command.
modprobe ftdi_sio vender=0x2730 product=0x1000
After this command, connect CT-S280 to your computer and check the messages that the kernel sends.
dmesg | tail
If the kernel sends messages like following, the kernel recognize that a USB-serial converter is connected.

      usb 1-1: new full speed USB device using ohci_hcd and address 6
      usb 1-1: configuration #1 chosen from 1 choice
      ftdi_sio 1-1:1.0: FTDI USB Serial Device converter detected
      drivers/usb/serial/ftdi_sio.c: Detected FT232BM
      usb 1-1: FTDI USB Serial Device converter now attached to ttyUSB0

Number or port name in this message is depend on your system. kernel may send other number or port name.
The added device name (In this case, ttyUSB0 displayed in the last line) is needed while configuring CUPS.

## Setup CT-S280 to CUPS

# Setup CUPS Temporarily

Read instruction for CT-S280 in the instruction page, and register CT-S280 to CUPS.
While setting up, USB-serial port is not included in the choices to output (ttyUSBn). Choose one serial port (ttySn) temporarily.
Set up the serial interface as following,

Baud Rate | 115200 bps
Data Length | 8 bit
Parity Bit | none
Stop Bits | 1
Flow Control | Hardware (RTS/CTS)

Because of temporary setting, it is not able to print anything. Abort setting up after page setup is finished. (Test print will be done, lator.)

# Switch Device to Output

Stop CUPS daemon.
/etc/rc.d/init.d/cups stop
Open the configuration file (/etc/cups/printers.conf) with a text editor, and change the port to output.

In this file, "DeviceURI" is described as following,

  `DeviceURI serial:/dev/ttySn?baud=115200+bits=8+parity=none+flow=hard`

Modify as following,

  `DeviceURI serial:/dev/ttyUSBm?baud=115200+bits=8+parity=none+flow=hard`

In this case (written in bold), "n" is the number of serial port temporarily assigned, and "m" is the number of USB-serial port added when CT-S280 was connected. Start CUPS daemon, after these operation.
/etc/rc.d/init.d/cups start

# Test Print

Test to print with following the instruction page.

## Caution

If you install newer kernel, this patch for the driver of USB-serial coverter will be lost. Don't forget to patch this driver, when installing a new kernel.