Go to advanced search

by jojopi
Sat May 09, 2020 7:56 pm
Forum: General discussion
Topic: Why does Task Manager show 100% CPU, but no process seems to be using it?
Replies: 6
Views: 332

Re: Why does Task Manager show 100% CPU, but no process seems to be using it?

You would be better to use standard "top". Its cpu line gives user, system, nice, idle, iowait, irq, softirq, and steal values. (See /proc/stat in "man proc" for information.) %Cpu(s): 0.3 us, 0.5 sy, 0.0 ni, 99.2 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st GUI programmers typically assume that their users w...
by jojopi
Sat May 09, 2020 1:54 am
Forum: Beginners
Topic: Dos Box with Raspbian Lite
Replies: 4
Views: 200

Re: Dos Box with Raspbian Lite

Yes, the keyboard handling is broken when dosbox is run outside of the GUI. It does not seem to understand that Linux numbers the keys starting with Esc=1, while Xorg numbers from Esc=9. So QWER produces 7890. As a workaround, you can edit ~/.dosbox/dosbox-*.conf and in the [sdl] section change the ...
by jojopi
Fri May 08, 2020 2:13 pm
Forum: Beginners
Topic: RuntimeError: This module can only be run on a Raspberry Pi!
Replies: 17
Views: 468

Re: RuntimeError: This module can only be run on a Raspberry Pi!

Check whether the python (2) package is somehow blocked from updating to the current version: [email protected]:~ $ apt policy python-rpi.gpio python-rpi.gpio: Installed: 0.7.0~buster-1 Candidate: 0.7.0~buster-1 Version table: *** 0.7.0~buster-1 500 500 http://archive.raspberrypi.org/debian buster/main...
by jojopi
Wed May 06, 2020 6:54 pm
Forum: General programming discussion
Topic: The least spoofable way to read Raspberry serial number
Replies: 9
Views: 530

Re: The least spoofable way to read Raspberry serial number

And for comparison, here is how you spoof that: #define _GNU_SOURCE #include <dlfcn.h> int ioctl(int fd, long req, long *p) { int ret = 0; int (*real_ioctl)(int, long, long *) = dlsym(RTLD_NEXT, "ioctl"); if (req == 0xc0046400) p[5] = 0x12345678; else ret = real_ioctl(fd, req, p); return ret; } I wi...
by jojopi
Wed May 06, 2020 1:32 pm
Forum: Networking and servers
Topic: Access Point Routed - Issue with MASQUERADE and question about documented procedure
Replies: 7
Views: 313

Re: Access Point Routed - Issue with MASQUERADE and question about documented procedure

iptables v1.8.2 (nf_tables): Chain 'MASQUERADE' does not exist Try `iptables -h' or 'iptables --help' for more information. MASQUERADE is a target, not the name of a chain. To give that error message, the program must have misparsed the rule. The command you quoted is correct, and it works with ipt...
by jojopi
Tue May 05, 2020 3:24 pm
Forum: Troubleshooting
Topic: RPi4 - boot into command line, logged in under wrong user
Replies: 4
Views: 156

Re: RPi4 - boot into command line, logged in under wrong user

Any login sessions are unrelated to the Kodi service. When you use "sudo raspi-config" to enable autologin, it tries to do that for the currently-detected user. If you want pi to autologin, run "sudo raspi-config" as pi. If you need to override it, for instance to allow autologin by a user with no s...
by jojopi
Tue May 05, 2020 2:41 pm
Forum: Troubleshooting
Topic: File System / df -h output
Replies: 5
Views: 162

Re: File System / df -h output

/dev/sda2 on /var/nextcloud/data type ext4 (rw,nosuid,nodev,noexec,noatime,stripe=8191,user) You will need at least execute (search) permission on /var/nextcloud/ in order to either access /var/nextcloud/data or check its free space. You rather implied that the affected user could access the mount,...
by jojopi
Mon May 04, 2020 9:32 am
Forum: C/C++
Topic: C++ Program writes in .txt file when started manually, but not in autostart
Replies: 3
Views: 246

Re: C++ Program writes in .txt file when started manually, but not in autostart

sudo nano ~/.config/lxsession/LXDE-pi/autostart Are you not the owner of that file? Stop using sudo. I can see the program running, but when I check the .txt file, it doesn't get updated. Does the program ever flush its output? If not, the file will not be updated until you have written several kil...
by jojopi
Mon May 04, 2020 6:16 am
Forum: Troubleshooting
Topic: SyntaxError pyclean
Replies: 3
Views: 114

Re: SyntaxError pyclean

Have you installed your own version of Python, tried to make the "python" command default to python3 instead of python2, or anything like that? Both the SyntaxError and the ImportError are consistent with dpkg executing the wrong interpreter. Also, debconf_1.5.56+deb8u1_all.deb appears to be the pac...
by jojopi
Mon May 04, 2020 1:19 am
Forum: Raspberry Pi OS
Topic: Buster sudo raspi-config broken: Unrecognized character \x08;
Replies: 3
Views: 163

Re: Buster sudo raspi-config broken: Unrecognized character \x08;

Just for information, line 375 of the mentioned Perl module begins with two tab characters (\x09), and the character after __DIE_ is supposed to be another underscore (\x5f). So the errors about \x08 and \x1f in both cases refer to a single bit being flipped. That is suggestive of a faulty SD card, ...
by jojopi
Sun May 03, 2020 10:28 am
Forum: Beginners
Topic: Cannot get passwordless SSH keys to work...
Replies: 5
Views: 177

Re: Cannot get passwordless SSH keys to work...

However, as soon as i deactivate SSH password i cannot log in to the pi remotely. This should be easy to avoid. Do not disable passwords until after the keys start working. Also, it is fine to have multiple concurrent login sessions. Keep at least one open at all times, so you have somewhere to wor...
by jojopi
Sun May 03, 2020 8:57 am
Forum: C/C++
Topic: Help reading serial packets
Replies: 8
Views: 339

Re: Help reading serial packets

Again, giving read() an N-byte buffer is not sufficient to make it wait for N bytes to arrive. If the goal was to have Linux itself recognize the input device, that really should be as simple as setting the correct line discipline on the port: sudo inputattach --microsoft /dev/ttyUSB0 I just tried t...
by jojopi
Sat May 02, 2020 10:27 pm
Forum: C/C++
Topic: Help reading serial packets
Replies: 8
Views: 339

Re: Help reading serial packets

I've worked around the issue and now I only need to convert a 7 bit 2's complement number to a signed char What protocol is the mouse using? Looking at the possibilities in man 4 mouse , several of them pack the sign bits or high bits into a different part of the packet. Incidentally, that "serial....
by jojopi
Mon Apr 27, 2020 10:50 am
Forum: General discussion
Topic: How to detect individual USB-RS232 device tty number?
Replies: 16
Views: 459

Re: How to detect individual USB-RS232 device tty number?

I do not see that Raspbian "out of the box" creates a device other than the ttyUSBx where x designates the order of detection of the USB device. The underlying devices are always called ttyUSB N , but those symlinks you showed are perfectly valid ways to open the device, and the symlinks automatica...
by jojopi
Mon Apr 27, 2020 9:32 am
Forum: General discussion
Topic: How to detect individual USB-RS232 device tty number?
Replies: 16
Views: 459

Re: How to detect individual USB-RS232 device tty number?

lrwxrwxrwx 1 root root 13 Apr 27 07:07 usb-FTDI_US232R_FTFK085Y-if00-port0 -> ../../ttyUSB1 lrwxrwxrwx 1 root root 13 Apr 27 07:07 usb-FTDI_US232R_FTFK0869-if00-port0 -> ../../ttyUSB0 So if I can read this S/N in my code then I could presumably identify the adapter that belongs to a specific connec...
by jojopi
Thu Apr 16, 2020 8:05 pm
Forum: Automation, sensing and robotics
Topic: Help getting colour names out of TCS34725 (Adafruit) -python on raspberry pi
Replies: 3
Views: 243

Re: Help getting colour names out of TCS34725 (Adafruit) -python on raspberry pi

Color has three components, so you can represent a given sample as a point in 3D space. The distance between two points is given by Pythagoras: sqrt((x1-x2)**2 + (y1-y2)**2 + (z1-z2)**2). By comparing the sample against each of the reference colors you want to recognize, you should be able to tell w...
by jojopi
Wed Apr 08, 2020 1:13 pm
Forum: General discussion
Topic: send keyboard input terminal commands while X is started
Replies: 9
Views: 343

Re: send keyboard input terminal commands while X is started

Handling focused window for one. Even a single mono app can have multiple windows, so this is essential. If there is no window manager running, the X server handles focus itself, using the traditional rule that input events go to the window the mouse cursor is over. If you have exactly one full-scr...
by jojopi
Wed Apr 08, 2020 12:34 pm
Forum: Troubleshooting
Topic: Error with apt-get and anything that runs python3
Replies: 6
Views: 315

Re: Error with apt-get and anything that runs python3

You can check what package a file belongs to with "dpkg -S FILE ", and then reinstall that package with "sudo apt install --reininstall PACKAGE ". In the case of the vim .txt files, I would be tempted to take copies of the faulty versions first, and then compare them against the corrected files usin...
by jojopi
Tue Apr 07, 2020 8:40 pm
Forum: Troubleshooting
Topic: Error with apt-get and anything that runs python3
Replies: 6
Views: 315

Re: Error with apt-get and anything that runs python3

The variable $GLIBC_2.4 contains the value ".4" in both systems, $GLIBC_2.4 is the variable ${GLIBC_2} followed by the text ".4". No worries, because the library/symbol version has nothing to do with any environment variables. The python executables in /usr/bin/ are exactly the same in both systems...
by jojopi
Tue Apr 07, 2020 2:53 pm
Forum: Troubleshooting
Topic: Keyboard layout in console different or broken
Replies: 4
Views: 153

Re: Keyboard layout in console different or broken

Philipp1887 wrote:
Tue Apr 07, 2020 2:06 pm
XKBVARIANT="T3"
You have selected "German (T3)", an obscure and uncommon variant, which may also be broken. (Shift appears to be functioning the same as AltGr, so many characters are unobtainable.)

Try "German". Or, set XKBVARIANT="" in /etc/default/keyboard, and then run "sudo setupcon".
by jojopi
Tue Apr 07, 2020 1:20 pm
Forum: Troubleshooting
Topic: Keyboard layout in console different or broken
Replies: 4
Views: 153

Re: Keyboard layout in console different or broken

The raspi-config setting is the one for the console, and it affects all users, plus the login sequence itself. GUI settings may take precedence, but only affect the current user and desktop environment. One possible problem is that Debian/Raspbian supports many "variants" for each country's layout. ...
by jojopi
Mon Apr 06, 2020 2:49 pm
Forum: Raspberry Pi OS
Topic: Permission denied when using mkdir in /mnt
Replies: 9
Views: 334

Re: Permission denied when using mkdir in /mnt

But when I rebooted the system and tried to add another share I could not edit /mnt anymore and I can't create directories in it. That is entirely to be expected. Once autofs is mounted on /mnt, it is no longer a real directory. It just contains whatever mounts autofs makes appear there. If you wan...
by jojopi
Thu Apr 02, 2020 7:18 pm
Forum: Python
Topic: 2 inputs in the same line
Replies: 3
Views: 185

Re: 2 inputs in the same line

Lalo wrote:
Thu Apr 02, 2020 6:09 pm
Input:
3 5
The most general solution would be:

Code: Select all

string = input()
list = string.split()
a = int(list[0])
b = int(list[1])
When they are both/all the same type, we could shorten that to:

Code: Select all

a, b = [int(x) for x in input().split()]
or:

Code: Select all

a, b = map(int, input().split())
by jojopi
Thu Apr 02, 2020 2:53 pm
Forum: Troubleshooting
Topic: getch struggles
Replies: 6
Views: 278

Re: getch struggles

I am sure that you had already installed the module correctly. Otherwise you would have had "ModuleNotFoundError: No module named 'getch'", or "AttributeError: module 'getch' has no attribute 'getche'", or "TypeError: 'module' object is not callable". Instead, the output in your initial post showed ...
by jojopi
Thu Apr 02, 2020 2:48 am
Forum: Troubleshooting
Topic: getch struggles
Replies: 6
Views: 278

Re: getch struggles

>>> %cd '/home/pi/Documents/EXPTS TO FIX' >>> %Run _getch.py I think you are using Thonny here. In Linux, configuration of whether text input is character or line buffered, and whether it echoes, is done via the terminal interface. You will need to run the program on a terminal or in a terminal emu...

Go to advanced search