Touchscreen on Raspberry Pi emits click not touch - raspberry-pi

i folowed this link to calibrate touchscreen: http://www.circuitbasics.com/raspberry-pi-touchscreen-calibration-screen-rotation/.
ls -la /dev/input/
total 0
drwxr-xr-x 4 root root 240 Jul 12 18:38 .
drwxr-xr-x 15 root root 3460 Jul 12 18:38 ..
drwxr-xr-x 2 root root 140 Jul 12 18:38 by-id
drwxr-xr-x 2 root root 140 Jul 12 18:38 by-path
crw-rw---- 1 root input 13, 64 Jul 12 18:38 event0
crw-rw---- 1 root input 13, 65 Jul 12 18:38 event1
crw-rw---- 1 root input 13, 66 Jul 12 18:38 event2
crw-rw---- 1 root input 13, 67 Jul 12 18:38 event3
crw-rw---- 1 root input 13, 68 Jul 12 18:38 event4
crw-rw---- 1 root input 13, 63 Jul 12 18:38 mice
crw-rw---- 1 root input 13, 32 Jul 12 18:38 mouse0
crw-rw---- 1 root input 13, 33 Jul 12 18:38 mouse1
root#raspberrypi:/sys/devices/virtual/input# cat input4/uevent
PRODUCT=0/0/0/0
NAME="FT5406 memory based driver"
PROP=2
EV=b
KEY=400 0 0 0 0 0 0 0 0 0 0
ABS=2608000 3
MODALIAS=input:b0000v0000p0000e0000-e0,1,3,k14A,ra0,1,2F,35,36,39,mlsfw
root#raspberrypi:~# cat /etc/ts.conf
# Uncomment if you wish to use the linux input layer event interface
module_raw input
# Uncomment if you're using a Sharp Zaurus SL-5500/SL-5000d
# module_raw collie
# Uncomment if you're using a Sharp Zaurus SL-C700/C750/C760/C860
# module_raw corgi
# Uncomment if you're using a device with a UCB1200/1300/1400 TS interface
# module_raw ucb1x00
# Uncomment if you're using an HP iPaq h3600 or similar
# module_raw h3600
# Uncomment if you're using a Hitachi Webpad
# module_raw mk712
# Uncomment if you're using an IBM Arctic II
# module_raw arctic2
module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear
I only get response when configuring X with xinput_calibrator. When i enter this command
sudo TSLIB_FBDEVICE=/dev/fb0 TSLIB_TSDEVICE=/dev/input/event1 ts_calibrate
I get optput
xres = 800, yres = 480
selected device is not a touchscreen I understand
Can someone please help me,
Thanks in advance.

I don't have a solution for this, but I believe that it is related to the problem of touches being treated as mouseovers. This bug has been reported several times, but never actually fixed
https://gitlab.gnome.org/GNOME/gtk/-/issues/945
https://bugzilla.gnome.org/show_bug.cgi?id=789041
https://bugs.launchpad.net/ubuntu-mate/+bug/1792787
A bugzilla.gnome.org user named niteshgupta16 created a script that solves this problem, but it was uploaded to pasting/sharing service called hastebin at https://www.hastebin.com/uwuviteyeb.py.
Hastebin deletes files that have not been accessed within 30 days. Since hastebin is a javascript-obfuscated service, this file is not available on archive.org.
I am unable to find an email for niteshgupta16 in order to ask him if he still has uwuviteyeb.py.

Related

Why logrotate doesn't properly postrotate only has 1 day delay

I have in /etc/logrotate.d/mikrotik :
/var/log/mikrotik.log {
rotate 2
daily
compress
dateext
dateyesterday
dateformat .%Y-%m-%d
postrotate
#/usr/sbin/invoke-rc.d syslog-ng reload >/dev/null
rsync -avH /var/log/mikrotik*.gz /backup/logs/mikrotik/
/usr/lib/rsyslog/rsyslog-rotate
endscript
}
The mikrotik.log.YYYY-MM-DD.gz file is created daily
The problem is that rsync in postrotate doesn't copy the last file. For example, on September 25, 2021, there are such files in /var/log:
-rw-r ----- 1 root adm 37837 Sep 24 23:49 mikrotik.log. 2021-09-24.gz
-rw-r ----- 1 root adm 36980 Sep 25 23:55 mikrotik.log. 2021-09-25.gz
and in /backup/logs/mikrotik/ are only:
-rw-r ----- 1 root adm 35495 Sep 23 00:00 mikrotik.log. 2021-09-22.gz
-rw-r ----- 1 root adm 36842 Sep 23 23:58 mikrotik.log. 2021-09-23.gz
-rw-r ----- 1 root adm 37837 Sep 24 23:49 mikrotik.log. 2021-09-24.gz
There is no file mikrotik.log.2021-09-25.gz from Sep 25 23:55 it will not be copied until the next rotation.
How to make a file packed today copied by postrotate ?
Problem solved.
It relied on the order in which the operations were performed.
Lgrotate does a 'postrotate' section before compressing to .gz.
The solution to the problem was to change the name from 'postrotate' to 'lastaction'.

OSX: detect 'restricted' filesystem flag programmatically

Starting from El Capitan the system got System Integrity Protection which doesn't allow certain activities for some folders and files. Using Terminal "ls lO" command you can see flags that specific file or folder has.
drwxr-xr-x# 3 root wheel hidden 96 Aug 12 2014 opt
drwxr-xr-x 6 root wheel sunlnk,hidden 192 Nov 28 15:14 private
drwxr-xr-x# 64 root wheel restricted,hidden 2048 Nov 29 13:48 sbin
lrwxr-xr-x# 1 root wheel restricted,hidden 11 Nov 28 15:13 tmp -> private/tmp
drwxr-xr-x# 10 root wheel restricted,hidden 320 Nov 28 15:21 usr
lrwxr-xr-x# 1 root wheel restricted,hidden 11 Nov 28 15:13 var -> private/var
I'm interested in "restricted" flag. How can it be found using Swift without executing terminal commands?
I want to emphasize that executing Process() in code is not an approach that suits the needs.
"Hidden" flag can be detected via "isHidden" property from here URLResourceKey. However there is nothing about "restricted".
Could somebody point me to the right direction?
The things listed by the -O option on the ls tool are the file flags. These can be read by the stat() function in the BSD layer, and are found in the st_flags field of the resulting structure.
The "restricted" flag in ls's output corresponds to SF_RESTRICTED, so you can read it by doing something like this:
func isRestricted(at url: URL) throws -> Bool {
let flags: UInt32 = try url.withUnsafeFileSystemRepresentation { fsRep in
var info = stat()
if stat(fsRep, &info) != 0 {
guard let code = POSIXError.Code(rawValue: errno) else {
throw CocoaError(.fileReadUnknown)
}
throw POSIXError(code)
}
return info.st_flags
}
return flags & UInt32(bitPattern: SF_RESTRICTED) != 0
}

Perl touch -t file error for a future date

I am trying to touch a file(for referencing date) with a future date something like -
Current date - $date
Fri Jan 6 03:59:55 EST 2017
touch -t 201702032359.59 /var/tmp/ME_FILE_END
on checking the timestamp of the file as -
$ ls -lrt /var/tmp/ME_FILE_END
getting an output with only date and not the entire timestamp(hhmm.sec)
-rw-r--r-- 1 abcproc abc 0 Feb 3 2017 /var/tmp/ME_FILE_END
But for a date with is less than or equal to current it gives correct result -
touch -t 201612010000.00 /var/tmp/ME_FILE_START
ls -lrt /var/tmp/ME_FILE_START
-rw-r--r-- 1 abcproc abc 0 Dec 1 00:00 /var/tmp/ME_FILE_START
Can someone please suggest why this discrepancy ?
It's just the way ls displays the date. When far from now, the modification time is not displayed.
If you want details regarding the last access / modification / change time, you should be using stat.
stat /var/tmp/ME_FILE_END
You will see the expected output.
For example:
[10:29:41]dabi#gaia:~$ touch -t 201702032359.59 /var/tmp/ME_FILE_END
[10:29:43]dabi#gaia:~$ ls -ltr /var/tmp/ME_FILE_END
-rw-rw-r-- 1 dabi dabi 0 feb. 3 2017 /var/tmp/ME_FILE_END
[10:29:47]dabi#gaia:~$ stat /var/tmp/ME_FILE_END
File : '/var/tmp/ME_FILE_END'
Size : 0 Blocks : 0 I/O blocks : 4096 empty file
Device : 803h/2051d Inode : 5374373 Links : 1
Access : (0664/-rw-rw-r--) UID : ( 1000/ dabi) GID : ( 1000/ dabi)
Access : 2017-02-03 23:59:59.000000000 +0100
Change : 2017-02-03 23:59:59.000000000 +0100
Change : 2017-01-06 10:29:43.364630503 +0100
Birth : -

How do you read every line of the output using Perl's OpenSSH

Using Perl's Net::SSH::Except, there is a method called read_line which allows me to read every line of the output.
I want to use Net::OpenSSH but I can't find anything similar.
How do you write this SSH::Except method using OpenSSH?
$ssh->send("ls\r\n");
while ( defined( $line = $ssh->read_line() ) {
# do something
}
The Net::OpenSSH module provides a capture method which will capture all the output. If called in list context will return the output line by line
use strict;
use warnings;
use Net::OpenSSH;
my $host = "localhost";
my %opts = (
user => 'cdoyle',
password => 'thisisnottherealpassword',
);
my $ssh = Net::OpenSSH->new($host, %opts);
my #output = $ssh->capture('ls -lrta');
my $count=0;
foreach my $line (#output){
$count++;
print "line $count $line";
}
gives the output
line 1 total 28
line 2 -rw------- 1 cdoyle users 73 Jun 11 2015 .Xauthority
line 3 -rw------- 1 cdoyle users 602 Jun 11 2015 .viminfo
line 4 -rw-r--r-- 1 cdoyle users 32 Jun 11 2015 .profile
line 5 drwxr-xr-x 2 cdoyle users 4096 Jun 11 2015 .
line 6 -rw------- 1 cdoyle users 682 Aug 20 2015 .sh_history
line 7 drwxr-xr-x 32 root root 4096 Feb 21 02:33 ..

use LWP::Simple to get ftp site content in Perl

I am having some issue here using LWP::Simple to get ftp site content in Perl. It would work fine if the site used http, but not ftp, for example ftp://ftp.di.uminho.pt/pub/ctan/fonts/. But in my firefox browser, I can view the content as html.
So how to get the html of the site in this case?
LWP returns a document of the type text/ftp-dir-listing for a FTP directory. Use File::Listing to parse it.
$ GET -USe ftp://ftp.di.uminho.pt/pub/ctan/fonts/
GET ftp://ftp.di.uminho.pt/pub/ctan/fonts/
User-Agent: lwp-request/6.00 libwww-perl/6.02
200 OK
Server: --------- Welcome to Pure-FTPd [privsep] ----------
Content-Length: 32208
Content-Type: text/ftp-dir-listing
Client-Date: Mon, 06 Jun 2011 21:32:45 GMT
Client-Request-Num: 1
drwxr-xr-x 257 500 50 20480 May 30 06:27 .
drwxrwsr-x 18 500 50 4096 Jun 6 20:02 ..
drwxr-xr-x 2 500 500 4096 Apr 7 19:13 Asana-Math
-rw-r--r-- 1 500 500 573482 Apr 7 19:14 Asana-Math.zip
drwxr-xr-x 2 500 50 4096 May 20 2005 CJK
-r--r--r-- 1 500 500 20384230 May 20 2005 CJK.zip
drwxr-xr-x 2 500 50 4096 May 20 2005 DayRoman
-r--r--r-- 1 500 500 573352 May 20 2005 DayRoman.zip
drwxr-xr-x 2 500 50 4096 Sep 7 2007 LuxiMono
-r--r--r-- 1 500 500 199660 May 6 2005 LuxiMono.zip
lrwxrwxrwx 1 500 50 8 Oct 14 2005 MnSymbol -> mnsymbol
lrwxrwxrwx 1 500 50 12 Oct 14 2005 Mnsymbol.zip -> mnsymbol.zip
['Asana-Math', 'd', undef, 1302196380, 16877],
['Asana-Math.zip', 'f', 573482, 1302196440, 33188],
['CJK', 'd', undef, 1116540000, 16877],
['CJK.zip', 'f', 20384230, 1116540000, 33060],
['DayRoman', 'd', undef, 1116540000, 16877],
['DayRoman.zip', 'f', 573352, 1116540000, 33060],
['LuxiMono', 'd', undef, 1189116000, 16877],
['LuxiMono.zip', 'f', 199660, 1115330400, 33060],
['MnSymbol', 'l mnsymbol', 8, 1129240800, 41471],
['Mnsymbol.zip', 'l mnsymbol.zip', 12, 1129240800, 41471],
You probably want to use Net::FTP instead:
use Net::FTP;
$ftp = Net::FTP->new("some.host.name", Debug => 0)
or die "Cannot connect to some.host.name: $#";
$ftp->cwd("/pub")
or die "Cannot change working directory ", $ftp->message;
$ftp->get("that.file")
or die "get failed ", $ftp->message;
$ftp->quit;
Firefox will internally generate an HTML document when you are viewing an FTP directory. The FTP server won't provide one.
If you want one, then you will have to iterate over the files and directories and generate your own.