USB device

Instructions Document for USB Serial Device

1.Introduction:

To meet the business demands of different customers, Sunmi T1 provides universal communication interfaces such as LAN port, cash box port, 5 usb2.0 ports, serial port, headphone jack, etc.

This text mainly introduces the usage method of cash box port, usb port and serial port.

2.1. Port descriptions:

1)1) Cash box port:

Sunmi T1 cash box port uses RJ12 port. The developer can control the cash box by sending data to the cash box port.

Cash box developer document and resource file

2)Serial port:

Sunmi T1 serial port uses RJ11 port. The developer can control the peripherals by sending data via serial port. For safety, T1 doesn’t support serial port node traversal, but you can directly open the port for communication (the node path of the serial port at the device base /dev/ttyHSL1)

demo source code of the serial port 

Example of communication document: communication document for Jaynes serial port electronic scale (as for different electronic scale communication protocol, it is required to refer to the documents provided by each manufacturer)  

3)USB port:

Sunmi T1 supports USB devices with USB2.0 protocol.

Developer document for USB communication

3.1.) Obtain PID/VID of USB device:

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

图片 1

3.2.)Universal USB peripherals

  • HID device

Sunmi supports by default HID protocol devices (mouse, keyboard, code scanning gun, etc.), which can plug and play.

HID code scanning gun

HID code scanning gun can plug and play: connect Sunmi device, open an editable box on it and obtain the 

focal point, carry out code scanning. At this time, bar code or QR code content should be entered into this editable box. As for obtaining code scanning content from the code, you may refer to Google developer document for USB peripherals communication

  • U disk 

The supported U disk format:

FAT32: readable & writable; NTFS: readable but not writable; exFAT: not supported

  • Camera

 Sunmi supports USB UVC camera

Demo source code of the development package

Github source code address

EF90DAE9-C61C-4FDE-A280-479AAC985B26

 Sunmi reader-writer

 Sunmi card reader can be accessed to the sidebar (slot reader interface)

Sunmi card reader contains two parts. One part is magnetic strip card, for which you may refer to Sunmi card reader development package & card reader demo. The other part is nfc, which is android native interface, and you may refer to android nfc development document for it.  

Sunmi card reader development package

Sunmi card reader demo

Source code of Sunmi card reader demo

  • Third party universal reader-writer

Currently, Sunmi has already supported four types of third party usb universal reader-writer. The developer may refer to demo provided by Sunmi to carry out the operation of reading and writing the card.

1. UM 002 card reader of Esystech

2. T10 reader-writer of Shenzhen Deka Technology (it is required to support android version, power supply charging version)

3. ACR1281U-C1 reader-writer of Advanced Card Systems Ltd.

4. ACR1281U-K1 reader-writer of Advanced Card Systems Ltd.

Development document 2.0

demo of universal reader-writer

 

demo source code of universal reader-writer