Calibrate touchscreen over xfce4 - x11

dear experts
I have a problem with calibrating my Penmount touchscreen over x-server.
I connected through tslib.
In X, I have a compiled xf86-input-tslib library.
Unfortunately, ts_calibrate not working with "Illegal instruction level
Touch work good, the response from it is well, but sometimes, tap occurs on the wrong spot on a screen, sometimes with a deviance.
I try to calibrate screen with xinput-calibrator, but have no touchscreen in xinput -list:
xinput-calibrator
No calibratable devices found
mc ~ # DISPLAY=:0 xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Mouse1 id=6 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Keyboard1 id=7 [slave keyboard (3)]
although in kernel:
mc ~ # dmesg | grep PenMount<br/>
input: PenMount Serial TouchScreen as
/devices/pci0000:00/0000:00:01.0/0000:01:02.2/tty/ttyS0/serio0/input/input3
mc ~ # cat /proc/bus/input/devices
I: Bus=0013 Vendor=0031 Product=9000 Version=01f2
N: Name=«PenMount Serial TouchScreen»
P: Phys=ttyS0/serio0/input0
S: Sysfs=/devices/pci0000:00/0000:00:01.0/0000:01:02.2/tty/ttyS0/serio0/input/input3
U: Uniq=
H: Handlers=mouse0 event3
B: PROP=0
B: EV=b
B: KEY=400 0 0 0 0 0
B: ABS=3
In Xorg.0.log i found this:
[1051910.230] (II) config/udev: Adding input device PenMount Serial >TouchScreen(/dev/input/event3)
[1051910.230] (II) AutoAddDevices is off - not adding device.
[1051910.232] (II) config/udev: Adding input device PenMount Serial TouchScreen (/dev/input/mouse0)
[1051910.232] (II) AutoAddDevices is off - not adding device.
[1051910.237] (II) config/udev: Adding input device ltc2954 (/dev/input/event2)
[1051910.237] (II) AutoAddDevices is off - not adding device.
What can I do for touch will appear in xinput --list?
Debain, kernel 3.14

What version of xf86-input-tslib and tslib did you use? Using xf86-input-tslib 1.1.1 and tslib 1.13 should actually work. In case you want to run ts_calibrate while running a graphical desktop, consider building tslib yourself, using ./configure --with-sdl2

Related

hdiutil attach/detach/convert results to "resource temporarily unavailable"

Since MacOS 10.13 I have the following problem.
/usr/bin/hdiutil attach "target/MyDrive-tmp.dmg" -mountroot /tmp
/dev/disk3 GUID_partition_scheme
/dev/disk3s1 Apple_APFS
/dev/disk4 EF57347C-0000-11AA-AA11-0030654
/dev/disk4s1 41504653-0000-11AA-AA11-0030654 /private/tmp/MyDrive
/usr/bin/hdiutil detach -force -debug "/tmp/MyDrive" or diskutil eject "/tmp/MyDrive"
process_detach: entry with "/tmp/MyDrive"
util_verify_dev_entry: entry with "disk4s1".
process_detach_deventry: about to unmount_and_eject disk4s1
unmount_and_eject(disk4s1)
LetDIDriverSettleDown: calling IOServiceWaitQuiet...
DI_kextWaitQuiet: about to call IOServiceWaitQuiet...
DI_kextWaitQuiet: IOServiceWaitQuiet took 0.000005 seconds
LetDiskImageDriverSettleDown: wait took 0.000066 seconds
_unmountCallback: disk4
"disk4" unmounted.
"disk4" ejected.
/usr/bin/hdiutil convert "target/MyDrive-tmp.dmg" -format UDZO -o "target/MyDrive.dmg" -debug
DIIsInitialized: returning YES
DIIsInitialized: returning YES
DIBackingStoreNewWithCFURL: entry with
file:///Users/xxxx/Documents/git/Midi%20Automator/Midi%20Automator/target/MyDrive-tmp.dmg
writeable: false
DIBackingStoreInstantiatorProbe: entry
file:///Users/xxxx/Documents/git/Midi%20Automator/Midi%20Automator/target/MyDrive-tmp.dmg
writeable: false
DIBackingStoreInstantiatorProbe: probing interface 0 CBSDBackingStore
CBSDBackingStore::newProbe score 100 for
file:///Users/xxxx/Documents/git/Midi%20Automator/Midi%20Automator/target/MyDrive-tmp.dmg
DIBackingStoreInstantiatorProbe: interface 0, score 100, CBSDBackingStore
DIBackingStoreInstantiatorProbe: probing interface 1 CBundleBackingStore
CBundleBackingStore::newProbe score -1000 for
file:///Users/xxxx/Documents/git/Midi%20Automator/Midi%20Automator/target/MyDrive-tmp.dmg
DIBackingStoreInstantiatorProbe: interface 1, score -1000,
CBundleBackingStore
DIBackingStoreInstantiatorProbe: probing interface 2 CRAMBackingStore
CRAMBackingStore::probe: scheme "file": not ram: or ramdisk: scheme.
CRAMBackingStore::probe: score -1000 for
file:///Users/xxxx/Documents/git/Midi%20Automator/Midi%20Automator/target/MyDrive-tmp.dmg
DIBackingStoreInstantiatorProbe: interface 2, score -1000, CRAMBackingStore
DIBackingStoreInstantiatorProbe: probing interface 3 CCarbonBackingStore
CCarbonBackingStore::newProbe: setting initial rval to +100
CCarbonBackingStore::newProbe score 100 for
file:///Users/xxxx/Documents/git/Midi%20Automator/Midi%20Automator/target/MyDrive-tmp.dmg
DIBackingStoreInstantiatorProbe: interface 3, score 100,
CCarbonBackingStore
DIBackingStoreInstantiatorProbe: probing interface 4 CDevBackingStore
CDevBackingStore::newProbe: not /dev/disk or /dev/rdisk (/Users/xxxx/Documents/git/Midi Automator/Midi Automator/target/MyDrive-tmp.dmg).CDevBackingStore::newProbe score -1000 for file:///Users/aguelle/Documents/git/Midi%20Automator/Midi%20Automator/target/MyDrive-tmp.dmg
DIBackingStoreInstantiatorProbe: interface 4, score -1000, CDevBackingStore
DIBackingStoreInstantiatorProbe: probing interface 5 CCURLBackingStore
CCURLBackingStore::probe: scheme is: file
CCURLBackingStore::probe: not recognized URL scheme.
CCURLBackingStore::probe: score -1000 for
file:///Users/xxxx/Documents/git/Midi%20Automator/Midi%20Automator/target/MyDrive-tmp.dmg
DIBackingStoreInstantiatorProbe: interface 5, score -1000, CCURLBackingStore
DIBackingStoreInstantiatorProbe: probing interface 6 CVectoredBackingStore
CVectoredBackingStore::newProbe not "vectored" scheme.
CVectoredBackingStore::newProbe score -1000 for file:///Users/xxxx/Documents/git/Midi%20Automator/Midi%20Automator/target/MyDrive-tmp.dmg
DIBackingStoreInstantiatorProbe: interface 6, score -1000,
CVectoredBackingStore
DIBackingStoreInstantiatorProbe: selecting CBSDBackingStore
DIBackingStoreNewWithCFURL: CBSDBackingStore
CBSDBackingStore::setPermission: opening /Users/xxxx/Documents/git/Midi
Automator/Midi Automator/target/MIDI Automator-tmp.dmg
CBSDBackingStore::OpenLockFriendly: mapping flags 0x00000000 -> 0x00000014 (locks are MANDATORY)
CBSDBackingStore:OpenLockFriendly: could not open with lock 35
DIBackingStoreNewWithCFURL: instantiator returned 35
DIBackingStoreNewWithCFURL: returning 35
DIResolveURLToBackingStore: unable to resolve to any backing store class. 35.
DIResolveURLToDiskImage: resolving backing store/file encoding failed. 35.
convert: unable to recognize "target/MyDrive-tmp.dmg":
resource temporarily unavailable.hdiutil: convert: result: 35`
/usr/bin/hdiutil attach "target/MyDrive-tmp.dmg" -mountroot /tmp
Eject MyDrive via mouse click in Finder
/usr/bin/hdiutil convert "target/MyDrive-tmp.dmg" -format UDZO -o "target/MyDrive.dmg"
-> Result: Conversion worked fine
So what is the difference between hdiutil detach, diskutil eject and ejecting from Finder?
Analysis:
lsof [device] gives no output as the device is not left after hdiutil detach at least mount shows none.
diskutil info "disk4s1" or diskutil info /tmp/MyDrive:
Device Identifier: disk4s1
Device Node: /dev/disk4s1
Whole: No
Part of Whole: disk4
Volume Name: MyDrive
Mounted: Yes
Mount Point: /private/tmp/MyDrive
Partition Type: 41504653-0000-11AA-AA11-00306543ECAC
File System Personality: APFS
Type (Bundle): apfs
Name (User Visible): APFS
Owners: Disabled
OS Can Be Installed: Yes
Media Type: Generic
Protocol: Disk Image
SMART Status: Not Supported
Volume UUID: A3EE0B42-A021-47AA-B424-E494B75049D3
Disk / Partition UUID: A3EE0B42-A021-47AA-B424-E494B75049D3
Disk Size: 212.5 MB (212471808 Bytes) (exactly 414984 512-Byte-Units)
Device Block Size: 4096 Bytes
Volume Total Space: 212.5 MB (212471808 Bytes) (exactly 414984 512-Byte-Units)
Volume Used Space: 184.7 MB (184709120 Bytes) (exactly 360760 512-Byte-Units) (86.9%)
Volume Available Space: 27.8 MB (27762688 Bytes) (exactly 54224 512-Byte-Units) (13.1%)
Allocation Block Size: 4096 Bytes
Read-Only Media: No
Read-Only Volume: No
Device Location: External
Removable Media: Removable
Media Removal: Software-Activated
hdiutil is really for working with disk images just as you are doing. The eject in finder is essentially diskutil eject [device]. hdutil detach is to "detach a disk image and terminate any associated process" (from the man page). Where diskutil is for "manipulating the structure of of local disks" (from the man page). Functionally, hdiutil detach is the same as diskutil eject. How it works though depends on if Disk Arbitration is running.
Disk Arbitration is framework and is in process diskarbitrationd that gets started by launchd and is always on by default. It handles the mounting and unmounting of disks attached via USB, Firewire, Thunderbolt, ect.
According to the man page on hdutil, when Disk Arbitration is running. hdutil detach will use it to unmount any file systems and detach the image. But if diskarbitrationd is not running then it will try and unmount filesystems and detach the image directly with a system call to ioctl. I don't recall for certain if diskutil -eject uses the Disk Arbitration framework but I want to say that it does.
It might be interesting to try and figure out why you getting that error. It typically means that exclusive access was not obtainable. You might experiment with lsof [device] This will show all the ope files and PIDs and lot more for the device, and this can maybe give you clues as to what is giving the [EBUSY] error (Resource Temporarily Unavailable). You can use mount with no argument to list all the devices and mount points if you don't know what device it is. I believe that you can also do lsof [mount/point]. The man page for lsof is your friend, and it is very long.
Another diagnostic is to use the -verbose option with hdiutil. It is available with all verbs. So, /usr/bin/hdiutil -verbose convert "target/MyDrive-tmp.dmg" -format UDZO -o "target/MyDrive.dmg" might provide some enlightenment.
And yet another possible source of clues would to have have an additional Terminal.app window open with the command diskutil activity running when you try the steps that cause the error. This command continuously reports on all Disk Arbitration framework activity. Ctrl-C to stop the process.
You have a workaround that is working for you so maybe looking into why it is giving the error isn't important or interesting to you. Also, if you don't want to use Finder you can always use diskutil eject [device] from the terminal. I have noticed a lot of things that are not quite right since I 'upgraded' to High Sierra and based on blogs around the net, it seems Apple is breaking things in the name of security and their new filesystem. I doubt in this case it is security related but I wouldn't be surprised if they introduced a bug altering commands and frameworks to work with APFS.
I also observed the problem that on newer OS X versions after hdiutil detach the DMG was still occupied by diskimage-helper and I could not do hdiutil convert due to the error message you got.
My solution simply was to copy the source file first, because that works without problem and then do the convert on the copy. This works without problems for me so far.
#Angelo Thank you for the insight:
So it is a problem with APFS. Creating the image with ´/usr/bin/hdiutil create -srcfolder "target/MyApp.app" -volname "MyApp" -ov "target/MyDrive-tmp.dmg" -fs HFS+ -format UDRW´ works like a charm and solves my problem. –
Angelo Berlin
In High Sierra (10.13.6), the additional argument, -fs HFS+ resolved my (and same) issue described here.
Details:
hdiutil create foo.dmg -srcfolder junk -format UDRW -size 1.1M -volname foobar
hdiutil attach foo.dmg -readwrite
hdiutil detach /Volumes/foobar
hdiutil convert foo.dmg -format UDZO -o fooConverted.dmg -imagekey zlib-level=9
hdiutil: convert failed - Resource temporarily unavailable
No joy. Same as everyone else.
But create and specify the filesystem with -fs...
hdiutil create foo.dmg -srcfolder junk -format UDRW -size 1.1M -volname foobar **-fs HFS+** -ov
hdiutil attach foo.dmg -readwrite
hdiutil detach /Volumes/foobar
hdiutil convert foo.dmg -format UDZO -o fooConverted.dmg -imagekey zlib-level=9 -ov
created: /Users/mjo/Documents/Code/bitcoin/bitcoin/fooConverted.dmg
This works like a champ! or as stated above, a charm.
Last, I tried the sequence of hdiutil commands without -fs HFS+ on Big Sur. All's good. Clearly an (old) issue with High Sierra.

Raspberry Pi 3 - sound and microphone doesn't work

I have installed Raspbian Jessie with Pixel (version April 2017) on my Raspberry Pi 3. I have plugged a Platronics C320-M headphone + microphone set.
And obviously it doesn't work.
I have followed this instructions: https://raspberrypi.stackexchange.com/questions/40831/how-do-i-configure-my-sound-for-jasper-on-raspbian-jessie/40832
to make my USB set a main device.
So no I have:
pi#raspberrypi:~ $ cat /proc/asound/modules
0 snd_usb_audio
1 snd_bcm2835
pi#raspberrypi:~ $ cat /etc/modprobe.d/alsa-base.conf
# This sets the index value of the cards but doesn't reorder.
options snd_usb_audio index=0
options snd_bcm2835 index=1
# Does the reordering.
options snd slots=snd_usb_audio,snd_bcm2835
pi#raspberrypi:~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: C320M [Plantronics C320-M], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
But when I try to play test sound:
speaker-test -c2 -twav
I can see test running but can't hear anything.
Really have no idea what to check/set more...
I will be grateful for any hints.
Regards
Pawel
try to follow below steps to enable audio recording and playback from a usb-sound adapter for rpi-3. I had documented these while performing audio recording from usb sound adapter. Hope this help you.
Steps:
1.1) Create/edit file .asoundrc
$vim .asoundrc
If file is not present create it;
$ touch .asoundrc
$vim .asoundrc
pcm.!default {
type asym
playback.pcm "hw:1,0"
capture.pcm "hw:1,0"
}
ctl.!default {
type hw
card 1
}
1.2)Edit below line in file alsa.conf;
$sudo vim /usr/share/alsa/alsa.conf
defaults.ctl.card 0
defaults.pcm.card 0
to
$sudo vim /usr/share/alsa/alsa.conf
defaults.ctl.card 1
defaults.pcm.card 1
1.3) Change audio levels/setting using alsamixer utility
$alsamixer
1.4) Command to record audio
$arecord -D plughw:1 -f S16_LE -r 48000 -d 5 ./testSound.wav
1.5) Command to play recorded audio
$aplay --device=plughw:1,0 ./testSound.wav

Can I use artoo-keyboard to listen to global keystrokes?

I'm building a text macro application for personal use and am using the artoo and artoo-keyboard gems to listen for keystrokes on my laptop's computer.
The goal is to fire events for global keystrokes, i.e. no particular window needs to be in focus.
Currently it is connected to /dev/ttyS4 and only registers keystrokes made when the terminal is in focus.
The reason I got /dev/ttyS3 is that someone advised I run dmesg | grep tty - this was the result.
With Artoo, the keyboard port is connected to like this:
connection :keyboard, adaptor: :keyboard, port: '/dev/tty/S4'
device :keyboard, driver: :keyboard, connection: :keyboard
Somebody else advised me to run cat /proc/bus/input/devices, and by doing so I see the following entry:
I: Bus=0011 Vendor=0001 Product=0001 Version=ab41
N: Name="AT Translated Set 2 keyboard"
P: Phys=isa0060/serio0/input0
S: Sysfs=/devices/platform/i8042/serio0/input/input3
U: Uniq=
H: Handlers=sysrq kbd event3
B: PROP=0
B: EV=120013
B: KEY=20000 20000000020 0 0 1500f02100000 3803078f900d401 feffffdfffefffff fffffffffffffffe
B: MSC=10
B: LED=7
I'm assuming this is the keyboard entry given the name.
I tried the Artoo connection command using port: 'isa0060/serio0/input0', but the code runs the exact same way.
If it's not clear what I'm trying to accomplish here, take a loot at this 10-second screencast, where I've established a listener to open the artoo.io homepage whenever the text hello world is typed: https://raw.githubusercontent.com/MaxPleaner/keyboard-macros/master/usage_screencast.gif
The problem is that it only works when typing in the terminal.
I am wondering what I can change to get it to work for global keystrokes.
I should mention I'm running Ubuntu 14.04 on a HP EliteBook 2540p laptop.
The creator of the artoo-keyboard gem responded to me on Github telling me this is impossible.
I make a global keyboard macro program for Linux using evtest and pty.
See http://github.com/maxpleaner/linux-keyboard-macros

How to insert hwmon module (ARM)

I fear that this is a very specific question.
Hardware: Gumstix Overo Fire (ARM Cortex A8)
Distro: Poky (customized with the Yocto Project)
Kernel: 3.5.7
I tried to write a program to read a HIH6130 i2c sensor, using /dev/i2c-3 and < linux/i2c-dev.h>, but despite it works for every other i2c device, it does not work for this one. Probably this happens because a particularity of the reading protocol, but anyway, that's not the topic.
I found this code that implements a driver for that sensor, and it is inside a so called "hwmon", which seems to be a collection of sensor drivers.
After successfully compiled and inserted this module I was expecting to see the entry humidity1_input somewhere under hwmon but I didn't find it.
root#overo:/sys# find -name hum*
root#overo:/sys# find -name hih*
./bus/i2c/drivers/hih6130
./module/hih6130
root#overo:/sys# ls ./bus/i2c/drivers/hih6130
bind module uevent unbind
root#overo:/sys# ls ./module/hih6130
coresize holders initstate refcnt srcversion uevent
drivers initsize notes sections taint
Do I have to do something else to enable the reading of this sensor? Any ideas?
I ended up using i2cget to read it:
$ i2cget -y 3 0x27 0x00
Later, the author, Iain Paton, kindly showed me how to bind the driver:
$ insmod hih6130.ko
$ echo hih6130 0x27 > /sys/bus/i2c/devices/i2c-3/new_device
In my device it appeared in this directory:
$ find /sys/ -name humidity*
/sys/devices/platform/omap_i2c.3/i2c-3/3-0027/humidity1_input
Also there is a 'temp1_input' in this same directory.

Linux USB Enumeration and uevents

I read an article at http://www.technovelty.org/code/linux/plugging-in-usb.html. Its just very good.
In which function exactly the enumeration of a connected device is done by host and in which function uevent is sent ?
I introduced printks in usb_new_device etc functions and If i use "udevadm monitor --kernel", it is showing the kernel events even before the enumeration function which is called in usb_new_device in hub.c ?
Log follows
[ 110.819399] 123456 hub_irq
[ 110.824952] 123456 hub_port_connect_change
[ 110.979624] 123456 hub_port_init
[ 111.059625] usb 2-1.2: new high speed USB device using fsl-ehci and address 3
[ 111.189722] 123456 usb_new_device
[ 111.196219] usb 2-1.2: New USB device found, idVendor=05ac, idProduct=12a0
[ 111.203113] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 111.210438] usb 2-1.2: Product: iPhone
[ 111.214196] usb 2-1.2: Manufacturer: Apple Inc.
[ 111.218728] usb 2-1.2: SerialNumber: 9356b662a93170509226069e5adf53f2351d774e
KERNEL[110.940183] add /devices/platform/fsl-ehci.1/usb2/2-1/2-1.2 (usb)
Check the timestamps though udevadm out put is at the end(udevadm runs in user space) its actuallt got the event at [ 110.940183] where as usb_new_device was called at [ 111.189722]
I am almost Linux kernel illiterate, so not 100% sure of this info..but managed to trace the USB init with the help of http://www.cs.fsu.edu/~baker/devices/lxr/http/find?v=2.6.11.8
Here is the flow of USB Host code (Please correct me if this is wrong), on Linux 2.6.11.8 kernel
usb_init() // invoked in ../core/usb.c it initializes host, major, usbfs and usb_hub
usb_hub_init() // in core/hub.c it creates a kernel thread hub_thread()
hub_thread() // in core/hub.c
hub_events() // next this if called
hub_port_connect_change() // then this..

Resources