vi / virtual_touchscreen

Simple evdev linux device driver and GUI program to simulate multitouch touchscreen
90 stars 33 forks source link

Script just says "killed" #3

Closed holbrookab closed 7 years ago

holbrookab commented 7 years ago

Hi,

I know this is old, but I figured I'd ask anyway. I installed the kernel and can see the device (and the cat command returns the instructions), however when I did a test of simulating touch:

1# printf 'x 200\ny 300\nS 0\n' > /dev/virtual_touchscreen

I get back "Killed".

This is running Ubuntu 16.04 4.10.0-37 generic kernel.

Any suggestions for why this might be failing?

vi commented 7 years ago

What's relevant in dmesg? I suspect the kernel says "BUG!" and kills the triggering process.

holbrookab commented 7 years ago
[ 5145.306155] virtual_touchscreen: Major=237
[ 5180.067818] IP: device_write+0x40/0x230 [virtual_touchscreen]
[ 5180.068036] Modules linked in: virtual_touchscreen(OE) rfcomm ccm bnep intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp arc4 snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel kvm_intel kvm snd_hda_codec iwlmvm snd_hda_core snd_hwdep irqbypass snd_pcm mac80211 snd_seq_midi snd_seq_midi_event nvidia_uvm(POE) crct10dif_pclmul crc32_pclmul snd_rawmidi ghash_clmulni_intel pcbc aesni_intel aes_x86_64 iwlwifi joydev crypto_simd snd_seq input_leds glue_helper cryptd snd_seq_device snd_timer intel_cstate cfg80211 snd intel_rapl_perf ir_lirc_codec ir_rc6_decoder lirc_dev soundcore btusb mei_me btrtl mei shpchp intel_pch_thermal hci_uart wmi btbcm btqca btintel rc_rc6_mce bluetooth nuvoton_cir rc_core intel_lpss_acpi intel_lpss acpi_als mac_hid kfifo_buf acpi_pad industrialio
[ 5180.069171] RIP: 0010:device_write+0x40/0x230 [virtual_touchscreen]
[ 5180.075592] RIP: device_write+0x40/0x230 [virtual_touchscreen] RSP: ffffa4aec1b6fe80
vi commented 7 years ago

I'll try it on my current 4.9.33 later.

vi commented 7 years ago

For me it froze in busy loop. Attempting to unload the module Oopsed.

Will try to fix.

vi commented 7 years ago

Fixed, pushed. Please re-check.

holbrookab commented 7 years ago

Thanks! Doesn't say "killed" any more...will continue to test if functionality fully works

holbrookab commented 7 years ago

So not erroring, but not seeing anything that seems to work.

I noticed in DMSG:


[ 2902.691893] virtual_touchscreen: Major=237```

`/devices/virtual/input/input15` actually doesn't exist.  Is that a problem?
vi commented 7 years ago

Major=237 is just a reminder of the device number, so it can be created with mknod. It should always appear in dmesg when you load the module.

Provided udev is running, input device node should be created automatically. If not, try to create it manually: mknod input15 c 13 79 (number may be different).

Then use hexdump/hd or evdev-dump to inspect that device.

holbrookab commented 7 years ago

Interesting, so when I run this:

printf 'x 200\ny 300\nS 0\n' > /dev/virtual_touchscreen
printf 'd 0\nS 0\n' > /dev/virtual_touchscreen

I get this

00000000  1e 20 e5 59 00 00 00 00  92 db 08 00 00 00 00 00  |. .Y............|
00000010  03 00 00 00 c8 00 00 00  1e 20 e5 59 00 00 00 00  |......... .Y....|
00000020  92 db 08 00 00 00 00 00  03 00 01 00 2c 01 00 00  |............,...|
00000030  1e 20 e5 59 00 00 00 00  92 db 08 00 00 00 00 00  |. .Y............|
00000040  00 00 00 00 00 00 00 00  2c 20 e5 59 00 00 00 00  |........, .Y....|
00000050  89 48 05 00 00 00 00 00  01 00 4a 01 01 00 00 00  |.H........J.....|
00000060  2c 20 e5 59 00 00 00 00  89 48 05 00 00 00 00 00  |, .Y.....H......|

So...it's working? And my computer just isn't recognizing it?

vi commented 7 years ago

d 0\nS 0\n is probably too little. Try just using virtual_touchscreen.jar application to get the event stream.

Here is example of input stream that moves it a bit to the left-top:

s 0
T 4
0 10
: 100
e 0
d 0
S 0
s 0
X 158
Y 110
x 158
y 110
S 0
s 0
X 174
Y 129
x 174
y 129
S 0
s 0
X 180
Y 147
x 180
y 147
S 0
s 0
X 187
Y 159
x 187
y 159
S 0
s 0
X 192
Y 173
x 192
y 173
S 0
s 0
X 200
Y 181
x 200
y 181
S 0
s 0
T -1
0 0
: 0
e 0
u 0
S 0

I don't actually remember all details about commands. Grep linux kernel source for ABS_MT_ or something like that.

holbrookab commented 7 years ago

Thanks! That command output was super helpful...it appears to be working now!