TinyX 使用内置 fbtft 触摸屏驱动程序显示显示,但触摸不起作用 [英] TinyX shows display using builtin fbtft touchscreen driver but touch doesn't work
问题描述
我正在使用带有 raspi 的adafruitts"触摸屏来控制 USB 外围设备.
I'm using an "adafruitts" touchscreen with a raspi to control a usb peripheral.
完整的 raspbian 内核需要永远启动(50 秒),部分原因是触摸屏驱动程序加载(通过 modprobe/udev)和初始化.
The full raspbian kernel takes forever to boot (50 seconds), and part of that is due to the touchscreen driver loading (by modprobe/udev) and initializing.
在启动的前 20-30 秒内,显示屏未加载,因此为空白.我需要这是一个用户友好的项目,每次打开时不能空白 30 秒,因此我使用 buildroot 构建了一个内置触摸屏驱动程序的小内核.(我在构建根和内核构建方面处于陡峭的学习曲线上).
During the first 20-30 seconds of boot, the display is not loaded, so it is blank. I need this to be a user-friendly item that cannot be blank for 30 seconds each time it is turned on, so I've used buildroot to build a small kernel with the touchscreen driver built-in. (I am on a steep learning curve with buildroot and kernel building in general).
显示驱动程序是 fbtft_device.c 补丁以包含 adafruitts 显示.此补丁定义了触摸"部分:
The display driver is fbtft_device.c patched to include the adafruitts display. This patch defines the "touch" half:
/* Touch device spi-half of adafruit touchscreen */
.name = "adafruitts",
.spi = &(struct spi_board_info) {
.modalias = "stmpe610",
.max_speed_hz = 500000,
.mode = SPI_MODE_0,
.chip_select = 1,
.platform_data = &(struct stmpe_platform_data) {
.blocks = STMPE_BLOCK_TOUCHSCREEN | STMPE_BLOCK_GPIO,
.irq_over_gpio = 1,
.irq_gpio = 24,
.irq_trigger = IRQF_TRIGGER_FALLING,
.irq_base = GPIO_IRQ_START + GPIO_IRQS,
.ts = &(struct stmpe_ts_platform_data) {
.sample_time = 4,
.mod_12b = 1,
.ref_sel = 0,
.adc_freq = 2,
.ave_ctrl = 3,
.touch_det_delay = 4,
.settling = 2,
.fraction_z = 7,
.i_drive = 0,
},
}
},
.is_support = 1,
.gpio_settings = (struct gpio_setting []) {
{
.gpio = 24,
.pull = pull_up,
}
},
.gpio_num_settings = 1,
},
和液晶显示器:
}, {
/* LCD component of adafruit touchscreen */
.name = "adafruitts",
.spi = &(struct spi_board_info) {
.modalias = "fb_ili9340",
.max_speed_hz = 16000000,
.mode = SPI_MODE_0,
.chip_select = 0,
.platform_data = &(struct fbtft_platform_data) {
.display = {
.buswidth = 8,
.backlight = 1,
},
.bgr = true,
.gpios = (const struct fbtft_gpio []) {
{ "dc", 25 },
{},
},
}
}
}, {
包括:
fbtft_device.name=adafruitts
在启动加载程序的 cmdline.txt 中,我已经让系统的一半显示工作(它在大约 5 秒内启动:) ),其中 tinyX/matchbox 桌面显示桌面,但我无法获得触摸屏部分工作(触摸屏幕时光标不移动).
in the cmdline.txt for the boot loader, I've gotten the display half of the system to work (it boots in ~ 5 seconds :) ) with tinyX/matchbox desktop showing the desktop, but I cannot get the touchscreen part to work (the cursor does not move when I touch the screeen).
不知何故,我必须将触摸屏的触摸部分绑定到 tinyX,但我一直无法弄清楚如何做到这一点.
Somehow I have to bind the touch part of the touchscreen to tinyX, but I have not been able to figure out how to do this.
我尝试在启动 tinyX 时指定键盘(和鼠标):
I have tried to specify the keyboard (and mouse) when launching tinyX:
X -keybd smpte610 (for example)
但 X 报告找不到驱动程序.
but X reports it cannot find the driver.
如何验证触摸屏输入设备是否已成功加载?
How can I verify the touch screen input device was successfully loaded?
启动日志中有这些关于 fbtft_device 的消息:
The boot log has these messages about fbtft_device:
fbtft_device: SPI devices registered:
fbtft_device: spidev spi0.0 500kHz 8 bits mode=0x00
fbtft_device: spidev spi0.1 500kHz 8 bits mode=0x00
fbtft_device: 'fb' Platform devices registered:
fbtft_device: bcm2708_fb id=-1 pdata? no
fbtft_device: Deleting spi0.1 (spi0.1)
fbtft_device: Looking at item 0
fbtft_device: Setting pin 24 to 2
stmpe-spi: probe of spi0.1 failed with error -22
fbtft_device: Deleting spi0.0 (spi0.0)
Console: switching to colour frame buffer device 40x30
graphics fb0: fb_ili9340 frame buffer, 320x240, 150 KiB video memory, 16 KiB buffer memory, fps=20, spi0.0 at 16 MHz
fbtft_device: GPIOS used by 'adafruitts':
fbtft_device: 'dc' = GPIO25
fbtft_device: SPI devices registered:
fbtft_device: stmpe610 spi0.1 48000kHz 8 bits mode=0x00
fbtft_device: fb_ili9340 spi0.0 16000kHz 8 bits mode=0x00
kgdb: Registered I/O driver kgdboc.
kgdb 消息是否与 fbtft_device 或其他相关联?
Is the kgdb message associated with fbtft_device or something else?
如果我查看/dev/input,我会看到:event0、event1 和 mouse.event0 和 event1 与连接的键盘相关联(根据引导日志),我没有连接鼠标.输入中是否应该有其他一些项目?
If I look in /dev/input I see: event0, event1, and mice. event0 and event1 are associated with an attached keyboard (according to the boot log) and I have no mouse attached. Should there be some other items in input?
如果加载了触摸屏输入设备,如何为tinyX指定正确的驱动程序?
If the touch screen input device IS loaded, how to I specify the correct driver for tinyX?
谢谢
推荐答案
我学到了什么:
通过比较我的 modprobe/udev/module 加载内核和快速内置内核中的引导消息,它显示:
By comparing the boot messages in my modprobe/udev/module loading kernel with the fast built-in kernel, it shows:
stmpe-spi: probe of spi0.1 failed with error -22
是一件坏事".
一个成功的驱动程序加载会说(类似):
A successful driver load will say (something like):
bcm2708_spi.0: registered child spi0.0
然后:
input: stmpe-ts as /devices/virtual/input/input0
我通过对内核配置文件进行这些更改来修复探测"故障.(抱歉,我不想包含所有内容,所以这些是从我遇到问题到根据 syslog 成功加载驱动程序时的更改):
I fixed the "probe" failure by making these changes to my kernel configuration file. (Sorry, I don't want to include the whole thing, so these are the changes from when I had the issue to when the driver successfully loaded according to the syslog):
< Touch Did Not respond > Touch Did respond
> CONFIG_INPUT_FF_MEMLESS=y
< CONFIG_INPUT_POLLDEV=m > CONFIG_INPUT_POLLDEV=y
< CONFIG_INPUT_EVDEV=m > CONFIG_INPUT_EVDEV=y
< CONFIG_TOUCHSCREEN_STMPE=m > CONFIG_TOUCHSCREEN_STMPE=y
> CONFIG_KEYBOARD_STMPE=y
< CONFIG_SERIO=m > CONFIG_SERIO_SERPORT=m
> CONFIG_SPI_DEBUG=y
< CONFIG_SPI_SPIDEV=y
> CONFIG_SPI_GPIO=y
我进行这些更改的主要目的是尝试确保相关驱动程序也是内置的,并且我启用了调试.(其中一些是由 menuconfig 神奇地设置的,这与 buildroot 中的非默认"值不同,因此差异是 - 不同的)
My main objective with these changes was to try to make sure that the dependent drivers were also built-in, and I enabled the debug. (Some of these were magically set by menuconfig, and this is diff from the "non-default" values from buildroot, so the diff is - different)
有了这个配置,我现在有了 event0、event1、event2、mouse 和 mouse0.系统日志说 event1 和 event2 与我连接的 USB 键盘相关联.我没有附加额外的鼠标.
With this config, I now have event0, event1, event2, mice, and mouse0. The syslog says event1 and event2 are associated with the usb keyboard I have attached. I have no extra mouse attached.
每当我触摸显示器时,我都可以使用evtest"来查看来自/dev/input/event0 的事件.evtest'ing/dev/input/mouse0 抛出不适当的设备 ioctl"
I could use "evtest" to see events from /dev/input/event0 whenever I touched the display. evtest'ing /dev/input/mouse0 threw "Inappropriate ioctl for device"
我使用以下命令重新启动了 X (tinyX):
I restarted X (tinyX) using:
X -mouse mouse,,/dev/input/mouse0
并且触摸有效,但触摸轴从显示轴旋转.
and touches worked, but the touch axis is rotated from the display axis.
我无法在 tinyX 中找到解决此问题的方法,因此我打算使用完整的 Xorg 实现.
I could not figure out a way to fix this in tinyX, so I'm going with a full blown Xorg implementation.
这篇关于TinyX 使用内置 fbtft 触摸屏驱动程序显示显示,但触摸不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!