wiki:Docs/Prog/Manual/DeviceSupport/USB

Version 6 (modified by Don Wilson, 14 years ago) ( diff )

--

USB Support

The Cardinal 825 supports many USB devices such as Flash Drives, Printers (Cardinal supported only!), and keyboards.

USB Mass Storage

The 825 supports USB flash storage devices formatted with the FAT (file allocation table) and FAT32 file systems. From the serial command line when a USB storage device is inserted the display will appear similar to:

Screenshot of shell after inserting USB.

Use the mount command to access files on the USB flash drive:

mount –t vfat /dev/sda1 /mnt/fl1

The files will then appear in the path /mnt/fl1 such as:

Console messages after USB flash mount

The file manager may be used to access USB flash drives. When the /mnt/fl1 folder is selected the file manager will automatically perform the mount command.

Accessing USB storage from a program

system("mount -t vfat /dev/sda1 /mnt/fl1");

FILE* file = fopen("/mnt/fl1/outfile.txt", "w");
if(file != NULL)
{
   fprintf(file, "Gross Weight %g\r\n", wtdata[1].grosswt);
}
fclose(file);

system("umount /mnt/fl1");

This example will mount the flash device, write a file to it, and then unmount the device.

Top

USB Keyboards

As of kernel 2008-11-13 many USB keyboards should work with the 825. Simply plug the keyboard into an 825 USB connection.

Console messages after inserting USB keyboard

Applications using the lib825 functions such as [[lib825:source:trunk/kypdbeep.cpp#L78 ReadKeypad]] or [[lib825:source:trunk/form.cpp#L1027 FormLCD] will automatically work with the USB keyboard. To test the keyboard without any app running type some characters on the keyboard and type:

# cat /dev/usbkybd

Output:

Console test of USB keyboard

The characters typed on the USB keyboard should show on the serial port terminal.

Top

USB Printing

usblp.ko device driver module for usb printing support. Type:

# modprobe usblp

Kernel should be configured with /dev/usblp0 device node. If not type:

# mknod /tmp/usblp0 c 180 0

/dev is in read-only file system so device node can be created under /tmp instead

This creates the character device driver with major number 180 and minor number 0. This should work unmodified with USB printers that accept raw text for printing using a default font.

A simple test is:

# echo “ABCDEFGH” > /dev/usblp0
'''or'''
# echo “ABCDEFGH” > /tmp/usblp0

Applications may be written to open “/dev/usblp0” to print to USB printer 0 instead of “/dev/ttyS1” to open COM2

Successful Tests

  • Okidata Microline 320 Turbo - Older versions of this printer do not have USB port
  • Hewlett Packard DeskJet 830C - Does not print page until filled so extra line feeds are required to fill the page to finish the print Text output only (No graphics)

Top

USB to PC communications

To load the driver for USB to PC communications type:

# modprobe g_serial use_acm=1

When the 825 is connected to the PC it will be recognized by the PC and if the driver is not already installed it will prompt for it. Refer to “gadget_serial.txt”

When the driver is installed the PC will appear to have another COM port. For testing on the PC you can then open a communications program such as HyperTerminal and set it to the appropriate COM port (which is actually a USB connection).

On the serial connection to the indicator type:

# echo “abcdefg” > /dev/ttygserial

“abcdefg” will then appear on the Hyperterm display.

In HyperTerminal, type:

123456

On the serial connection to the indicator type:

# cat < /dev/ttygserial

The received characters “123456” from the PC will then be displayed.

Top

Attachments (7)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.