-
Notifications
You must be signed in to change notification settings - Fork 58
Device Interfaces
The following section describes the format of the commands and arguments used with mxt-app. Some commands will only work if the device feature is available, for example, on-demand tests may not be available in all products.
By default, mxt-app will scan available devices and connect to the first I2C device it finds at address 0x4A over the sysfs interface. If a different DEVICESTRING is given, the mxt-app will scan for this device at the specific device location defined in the string. See the following commands and options examples below:
-q [--query] : Scan for devices and output a list.
-d [--device] DEVICESTRING : Connect to a particular device specified by DEVICESTRING which is given
in the same format as output by –query.
There are several connection modes supported for hardware access and used along with the DEVICESTRING argument.
The sysfs interface is used in conjunction with the Linux kernel driver. It accesses sysfs attributes under the following directories:
I2C
/sys/bus/i2c/drivers/dddddddd/b-00xx/
SPI
/sys/bus/spi/drivers/dddddddd/spib-x/
Where
d : driver name – atmel_mxt_ts or mchip_spi_ts
b : I2C adapter bus number
spi-b : SPI bus number
xx : I2C address of device
x : Chip select for SPI device
The sysfs attributes used under this directory to interface to the device are the following
mem_access : Access to raw I2C and SPI address space using read/write command within the driver
debug_enable : Output messages from the device to dmesg log as hexadecimal, if enabled. By default, unknown
messages not specified by the driver are also dumped into dmesg logs.
debug_v2_enable, debug_msg, debug_notify : Optional improved binary interface to retrieve messages. Maximum
number of messages held in buffer is 200.
The following are examples on how to specify a particular device found over the sysfs interface:
EXAMPLE: Find specific I2C device on bus adapter #1 at slave address 0x4b
./mxt-app -d: sysfs_i2c:1-004b
EXAMPLE: Find a specific SPI device on bus adapter #1 on chip select #3
./mxt-app -d: sysfs_spi:1-3
Many maXTouch devices support a USB mode which reports touches via USB-HID. In addition, evaluation boards may use a “bridge chip” which converts the I2C to USB protocol. USB support in mxt-app is enabled during compile time of the source.
With a maXTouch USB device attached mxt-app will find the first available unit. To specify a particular USB device, a DEVICESTRING option is required. The corresponding bus and device number can be given using the -q/--query option or kernel app lusb. The following options are available for USB:
EXAMPLE: Find specific USB device on bus #1 and device #3
./mxt-app -d: usb:001-003
Devices can be assessed directly via the i2c-dev debug interface by giving location information on the command line.
The i2c-dev interface is documented in the Linux kernel source in the /Documentation/i2c/dev-interface directory.
The I2C debug interface support must be enabled using the CONFIG_I2C_CHARDEV kernel configuration option. It is enabled on a system if the file directory /dev/i2c-* is present.
To use i2c-dev, provide a DEVICESTRING such as -d i2c-dev:1-004a to access a device on Bus 1, slave address 0x4a through I2C.
Messages for the maXTouch devices are read in i2c-dev mode, by polling for available messages. If a kernel touch driver is also present on the system, reading messages on interrupt, then no messages will be received by themxt-app. To prevent this conflict, the recommendation is to disable the maXTouch Linux driver.
EXAMPLE: Unbind the driver
echo -n “1-004a” > ./unbind /* Done under the /sys/bus/i2c/drivers/atmel_mxt_ts/ directory */
Another workaround is to set the T18.COMMAND (byte 1) to 2 “Force the /CHG line high (inactive)” so the kernel driver does not receive interrupts.
There is no scanning support for I2C. This is because reading from every possible maXTouch address on every I2C bus might adversely affect some unrelated hardware that does not understand Object Protocol. You must manually identify the correct adapter and address by referencing the protocol guide or hardware schematic to fill in the DEVICESTRING option with the correct bus# and slave address.
The i2c-dev interface is used with the –flash command to access a device for firmware update or to access the device already in bootloader mode.
The hidraw backend supports maXTouch devices which connect using USB or HID over I2C.
The hidraw interface is documented in the Linux kernel source, in Documentation/hid/hidraw.txt.
The device must have /dev/hidraw raw HID device support enabled using the CONFIG_HIDRAW kernel configuration option.
To use hidraw, provide a DEVICESTRING such as d. There is no scanning support. Bootloading is not supported in this mode.
It is possible to use the –flash command with a device already in bootloader mode by specifying the bootloader address only for USB-HID mode.