External USB Serial DeviceInstructions Document for USB、serial device
1. Brief introduction:
peripheral interfaces: general communication interfaces such as LAN port, cash drawer port, usb2.0 port, serial port, headphone jack, etc.
This text mainly introduces the usage mode of cash drawer port, usb port and serial port.

2. Interface description
1) Cash drawer port: the cash drawer port uses RJ12 port. The developers can control the
cash drawer by sending data to the cash drawer port.
Cash drawer developers document and resources file:Interface Documentation
2) 1) Serial port: the serial port uses RJ11 port. The developers can control the peripherals
by sending data from the serial port. The RJ11 of sunmi equipment is four-wire and does not support hard-flow control (some peripherals turn on hardware-flow control by default, and these devices can not connect sunmi mainframe through RJ11).
For security reasons, serial port nodes traversal is not supported, but you can directly open the port to communicate (
T1,T1mini:the node path of the serial port at the device base /dev/ttyHSL1,
T2,S2,T2lite,X2,T2mini:/dev/ttyHSL3,
N1、D2、D1s Single screen:/dev/ttyS1,
N1、D2、D1s 、s2cc、Double screen:/dev/ttyS3
T1: the node path of the serial port at the device base/dev/ttyHSL3, T2: ttyHSL1,T2lite:ttyHSL1,
N1、D2、D1s Single screen:/dev/ttyS1;N1、D2、D1s Double screen:/dev/ttyS3)
Serial port reference demo, JNI reference
Communication document example:
communication document for electronic scale at Jaynes serial port
(different electronic scale communication agreements need to refer to the documents provided by every manufacturer)

3) USB port: supports USB devices with USB2.0 agreement.
USB communication developers document :USB communication developer documentation
Sunmi support list of USB to Serial port
List of USB to Serial: CH341, FT series, PL2303, CP210X series
When used USB to Serial port, system will build the node: /dev/ttyUSERx (like /dev/ttyUSER0, /dev/ttyUSER1, etc.)
Don’t use USB to debug system when you use USB to Serial port, it would make USB to Serial port not work
3.1 Obtain USB devices’ PID/VID:
Method 1: java code
try {
Process p=Runtime.getRuntime().exec("cat /proc/bus/input/devices");
BufferedReader in = new BufferedReader(new
InputStreamReader(p.getInputStream()));
String line = null;
while((line = in.readLine())!= null){
}
String deviceInfo = line.trim();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
Method 2: adb command
adb shell cat /proc/bus/input/devices

3.2 HID device of universal USB peripherals supports by default the HID agreement devices (mouse, keyboard, code scanning gun, etc.), and you can plug and play.
HID code scanning gun
As for HID code scanning gun, you can plug and play: connect Sunmi device, open an editable box on the Sunmi device to obtain the focal point and scan the code. Then bar code or QR code content should be inputted into this box.
As for obtaining code scanning content from the code, please refer to: Communications Google Developer documentation
- U diskThe supported U disk format: FAT32: readable & writable; NTFS: readable & non-writable; exFAT: not supportedCameraSunmi supports USB UVC camera (e.g. LogitechC170)
- Sunmi card reader can be connected at the sidebar of Sunmi reader (Slot reader interface)

Development package Demo source
Sunmi card reader includes two parts: one part is magnetic stripe card, which can be referenced to Sunmi card reader SDK and card reader demo. The other part is nfc, which is android native port and can be referenced to android nfc development document:
Sunmi card reader demo source code
The third party universal reader & writer Sunmi has now already supported four types of third party usb universal reader & writer. The developers can refer to demo provided by Sunmi to carry out card reading & writing operation.
Shanghai Yixi Intelligent Technology Co., Ltd UM002 card reader
Shenzhen Deka Technology Co., Ltd T10 reader & writer (needs to support android version, power charging version)
Hong Kong Longjie Smart Card Co., Ltd ACR1281U-C1 reader & writer
Hong Kong Longjie Smart Card Co., Ltd ACR1281U-K1 reader & writer