Skip to content

Debug File System Interface (sysfs)

mgong98 edited this page Feb 23, 2021 · 1 revision

sysfs

The sysfs interface is a virtual file system for exporting kernel objects and is a ram-based file system based on ramfs. It provides a means to export kernel data structures, their attributes, and the linkages between them to userspace.

Attributes are created within the driver for direct access to a firmware flash or the configuration (for example, update_fw, update_cfg).

Other attributes are created to access information obtained by the driver (for example, fw_version, hw_version, config_crc).

Store and show functions are created to allow write and read access to the attributes.

When the sysfs attributes are created, they appear as files in the /sys directory. The path is as follows:

cd /sys/bus/spi/drivers/ddddd/spib-x/

where:

ddddd = Name of the driver. For instance, "mchp_spi_ts"

b = b indicates the bus number

x =  indicates the chip select number

For example:

cd /sys/bus/spi/drivers/mchp_spi_ts/spi0.3

The attributes created by the driver are as follows:

  • fw_version – Gets current firmware version of the device.

  • hw_version – Gets the maXTouch device’s family ID and the variant ID.

  • update_cfg – Used to update the configuration.

  • config_crc – Used to get current configuration CRC from the device.

  • debug_enable, debug_v2_enable, debug_notify – Attributes used to enable debug messages to be polled from the dmesg (driver message) buffer or the maXTouch device Message Processor T5 object.

  • mem_access – Gives access to the I2C address space for mxt-app operation and config loading.

  • mxt_debug_msg – Enables access to the Message Processor T5 messages from the device.

  • object - Retrieves a text dump of current configuration settings in hex format. Only retrieves those objects specified as readable in the driver.

  • debug_irq - Retrieves the current setting for the IRQ processing flag in the driver. Can be used to ignore interrupts.

  • inbootloader - Can we used to determine if maXTouch controller is in bootloader mode.

mem_access

The mem_access binary attribute provides read and write access to the touch device. It is used for loading the firmware and configuration, as well as, provides access to the device when using the mxt-app application.

The permissions to this attribute need to be set to 777 to allow data to be buffered between the device and the mxt-app application.

debug_enable

The debug_enable attribute allows the user to turn on messages that would directly come from the Message Processor T5 object. These messages can be enabled by echoing a “1” to the debug_enable attribute.

echo “1” > /sys/bus/spi/drivers/mchp_spi_ts/spi0-3/debug_enable
mchp_spi_ts spi0-3: debug enabled
mchp_spi_ts spi0-3: message: 31 94 90 02 b2 01 00 00 00 00
mchp_spi_ts spi0-3: message: 31 91 91 02 b2 01 00 00 00 00
mchp_spi_ts spi0-3: message: 31 91 92 02 b2 01 00 00 00 00
mchp_spi_ts spi0-3: message: 31 91 93 02 b2 01 00 00 00 00

Improved Debug Interface

An enhanced debug interface is supported in the driver for message debug output. This consists of the following sysfs attributes:

debug_v2_enable
debug_notify
mxt_debug_msg (binary attribute)

The interface is enabled using debug_v2_enable.

The interface does not use dmesg. Instead, messages can be read from the mxt_debug_msg binary attribute. The debug_notify attribute can be polled synchronously to determine if there are more messages.

Clone this wiki locally