©
2007,
UTC RETAIL
13
11473012 Rev B
Appendix B
Programming Guide: UltimaTouch
1800 Cash Drawer Driver
Note: If you are using the cash drawer with an OPOS, JavaPOS, or POS for .Net application, this document does
not apply to you. You will need to use the correct driver available on the UTC RETAIL web site at
www.utcretail.com
.
Linux
If you purchased your UltimaTouch
1800 with Linux pre-installed on it, the kernel driver for the cash drawer
should have already been installed. If you setup Linux yourself, you will need to download the Linux kernel driver
(p.n.: 11473039) from the UTC RETAIL web site. When the driver is installed a device node called "/dev/UTC
RETAIL1800Cashdrawer" will be created. This is the file that all communications with the driver will go though.
Included in the driver package is sample source code showing how to communicate with the cash drawer port on the
UltimaTouch
1800. Any application that you write to use the cash drawer must have the following include line:
#include "1800cashdrawer_ioctl.h"
The 1800cashdrawer_ioctl.h file defines the IO Controls (ioctls) for using the cash drawer port. The following ioctls
are defined:
IOCTL_FIRE_1 Fire drawer 1
IOCTL_FIRE_2 Fire drawer 2
IOCTL_STATUS Get drawer open status
Note: Although two cash drawers are supported; there is only one status line. If either of the two drawers is open,
the status will be open. If both drawers are closed, the status will be closed.
Below is a code snipit that shows how to open drawer 1:
...SNIP...
printf("Firing 1\n");
dev = fopen("/dev/UTC RETAIL1800Cashdrawer","r");
if( dev == NULL){
perror("Failed to open /dev/UTC RETAIL1800Cashdrawer ");
exit(1);
}
if(ioctl(fileno(dev),IOCTL_FIRE_1) == -1){
perror("Error with ioctl ");
}
fclose(dev);
...SNIP...
Below is a code snipit that shows how to get the status of the cash drawer
...SNIP...
printf("Status : ");
opendev();
if(ioctl(fileno(dev),IOCTL_STATUS, &retval) == -1){
perror("Error with ioctl ");
}
printf("%s\n",(retval?"Open":"Closed"));
fclose(dev);
...SNIP...