Go to advanced search

by Paeryn
Sat Oct 20, 2018 8:15 am
Forum: Python
Topic: Must be a simple answer to this keyboard input problem
Replies: 3
Views: 106

Re: Must be a simple answer to this keyboard input problem

This runs okay in Python 3 , but gives the error in Python 2 . For Python2 this should do it: print fn,"is user", usr No, that won't solve anything. The problem is that in Python2 input() will evaluate what was entered and return that. This is why numbers work fine but strings don't. Essentially wh...
by Paeryn
Fri Oct 19, 2018 11:04 am
Forum: C/C++
Topic: Download data from URL and save to /dev/stdout
Replies: 4
Views: 94

Re: Download data from URL and save to /dev/stdout

Heater and n67 beat me to posting, but just in case you are needing the data in a shell variable (as per your example) as well as printing it... data="`wget -q O- http://www.example.com/linux_data.php'`" This code is safe, ok? Now I need to send data, save to /dev/stdout Unfortunately, I do not know...
by Paeryn
Thu Oct 18, 2018 3:35 pm
Forum: Python
Topic: Python Serial jumping ahead / While loop problem on boot only
Replies: 5
Views: 183

Re: Python Serial jumping ahead / While loop problem on boot only

Is this only happening when the code is being run automatically as start up? Just wondering if you are somehow managing to have multiple copies of the program running at the same time.
by Paeryn
Thu Oct 18, 2018 2:21 am
Forum: Beginners
Topic: If else code for time domain
Replies: 1
Views: 61

Re: If else code for time domain

When copying code out of your editor it doesn't help that you miss off the ends of lines, I've added what I assume the end of the line was. if int(hoursON) > int(presentHour) & int(hoursOFF) <= int(presentHour): So Im getting now at 19:14 that relay should be off: ON=17 OFF=6 present=19 17 > 19 FALS...
by Paeryn
Tue Oct 16, 2018 9:52 pm
Forum: C/C++
Topic: I am missing some fundamental understanding of C?
Replies: 13
Views: 330

Re: I am missing some fundamental understanding of C?

1- I got a problem with your image_load_png() function. I found out that it try to free memory when they are NULL pointer. Calling free() with a null pointer isn't a problem otherwise the compiler's standard library implementation doesn't conform to the standard. free() is explicitly defined as to ...
by Paeryn
Tue Oct 16, 2018 8:51 am
Forum: Python
Topic: Python Serial jumping ahead / While loop problem on boot only
Replies: 5
Views: 183

Re: While loop problem on boot only

That sounds like you are maybe seeing the effect of output being buffered, especially if you have stdout redirected to a file. If stdout is a terminal then it is flushed on every newline, if it is a pipe or redirected to a file then it isn't. Try explicitly flushing the print() lines, e.g. print("Da...
by Paeryn
Sun Oct 14, 2018 2:34 am
Forum: Raspbian
Topic: Is it Time to force Raspbian password change on initial login
Replies: 39
Views: 1202

Re: Is it Time to force Raspbian password change on initial login

Possible Scenario It is about protecting the SD card. If a user leaves the default login/password and transports RPI to a public event it would be easy to pop the SD card out of an unattended RPI and pop in a temporary replacement. Compromise the original SD and replace or remotely update users pro...
by Paeryn
Sat Oct 13, 2018 8:53 pm
Forum: General discussion
Topic: How to change Ctrl-Alt-Del to shutdown
Replies: 13
Views: 354

Re: How to change Ctrl-Alt-Del to shutdown

If you want to change the behaviour of Ctrl-Alt-Del to power-off you just need to change ctrl-alt-del.target to be a symlink to poweroff.target (as long as you are booting to the command line, booting to the desktop overrides this). [email protected]:~ $ cd /lib/systemd/system [email protected]:/lib/systemd/system $ su...
by Paeryn
Fri Oct 12, 2018 11:21 pm
Forum: Bare metal, Assembly language
Topic: Bare metal graphics : hardware acceleration ?
Replies: 7
Views: 386

Re: Bare metal graphics : hardware acceleration ?

Is neon core/thread safe ? I was thinking about interrupts in my program, that could make use of neon registers (automatically generated by GCC) writing unwanted things to the register I use for my drawing purposes. That all depends on whether your task switching / interrupt handling is correctly s...
by Paeryn
Fri Oct 12, 2018 3:32 pm
Forum: Bare metal, Assembly language
Topic: Assembler code porting from ARMv7 to ARMv8a (linuxsampler)
Replies: 3
Views: 159

Re: Assembler code porting from ARMv7 to ARMv8a (linuxsampler)

Thanks Paeryn, yes this is a user code application. So I may not be able to set daif register...one question: I've readed that the privilege system is implemented also in Cortex-A (Raspberry Pi 2) processors. As I said before the 32-bit version of this patch works, so with user space privilegies I'...
by Paeryn
Fri Oct 12, 2018 1:54 pm
Forum: C/C++
Topic: compilation error in raspberry pi 3
Replies: 4
Views: 206

Re: compilation error in raspberry pi 3

The libraries are incompatible with each other, they both define their own function brcm2835_delayMicroseconds() and each takes a different type parameter. The compiler can't deal with that as there is no way for it to differentiate between the two functions. The generated code to call these functio...
by Paeryn
Fri Oct 12, 2018 10:21 am
Forum: Bare metal, Assembly language
Topic: Assembler code porting from ARMv7 to ARMv8a (linuxsampler)
Replies: 3
Views: 159

Re: Assembler code porting from ARMv7 to ARMv8a (linuxsampler)

You said it is part of a sort of userspace version of atomic, do you mean that it is getting called from EL0? AFAIK you can only access (or at least set) daif from EL1 or higher.
by Paeryn
Fri Oct 12, 2018 9:41 am
Forum: C/C++
Topic: [Solved] Framebuffer and Freetype2 Font Color Control
Replies: 9
Views: 245

Re: [Solved] Framebuffer and Freetype2 Font Color Control

I wish I understood enough right now to come up with better ways of doing stuff like that.... I changed my function per your example ;) It does the same as yours but takes advantage of fixed-point rather than floating-point arithmetic and avoids shifts where possible. I added the 1 to the level bec...
by Paeryn
Fri Oct 12, 2018 1:06 am
Forum: C/C++
Topic: [Solved] Framebuffer and Freetype2 Font Color Control
Replies: 9
Views: 245

Re: [Solved] Framebuffer and Freetype2 Font Color Control

As you know the bits from each quarter aren't overlapping, orring unsigned ints is the same as adding. I prefer to write it with orring since that is logically what you are doing. Depending on usage, that is a lot of floating point operations per pixel. I'd be tempted to keep it in integers. Quick k...
by Paeryn
Thu Oct 11, 2018 9:47 pm
Forum: C/C++
Topic: [Solved] Framebuffer and Freetype2 Font Color Control
Replies: 9
Views: 245

Re: Framebuffer and Freetype2 Font Color Control

uint32_t color_level(int tc, int lvl) { int a,r,g,b; double p = lvl / 255.0f; uint32_t nc; a = (tc >> 24) & 255; r = ceil(p * (255 * ((((tc) & 0xFF0000) >> 16) / 255.0f))); g = ceil(p * (255 * ((((tc) & 0xFF00) >> 8) / 255.0f))); b = ceil(p * (255 * (((tc) & 0xFF) / 255.0f))); nc |= (a & 255) << 24...
by Paeryn
Wed Oct 10, 2018 5:30 pm
Forum: Python
Topic: Naming different file
Replies: 5
Views: 160

Re: Naming different file

Untested but Something like this

Code: Select all

import datetime

current_time = datetime.datetime.now()
current_time_str = current_time.strftime('%y-%m-%d_%H-%M-%S')
filename = 'my_data_' + current_time_str + '.csv'
by Paeryn
Tue Oct 09, 2018 6:37 pm
Forum: Python
Topic: Issue with select.select and GPIO.
Replies: 4
Views: 134

Re: Issue with select.select and GPIO.

As I said earlier, select.select() only waits on file descriptor numbers, it can't wait on any random thing. Your list that you are passing consists of the result of calling the function BynClick(), even if select() could wait on a function (which it can't) you aren't passing a function, only the re...
by Paeryn
Sun Oct 07, 2018 5:48 am
Forum: Python
Topic: Issue with select.select and GPIO.
Replies: 4
Views: 134

Re: Issue with select.select and GPIO.

Your use of select.select() is wrong, what it wants in those lists is numbers of file descriptors to wait on. It can't wait on anything else (well, Python's version allows you to use objects, but those objects must have a function called fileno() which returns a file descriptor number). What you are...
by Paeryn
Sun Oct 07, 2018 5:09 am
Forum: Troubleshooting
Topic: Display on screen different to ssh
Replies: 3
Views: 91

Re: Display on screen different to ssh

What is being shown on the displays (HDMI & touch screen) is the output of the main local terminal being drawn on the local framebuffer. When you ssh in you are creating another login session that connects to your remote terminal. What is running on one terminal is separate to what is running on any...
by Paeryn
Sat Oct 06, 2018 8:05 pm
Forum: Troubleshooting
Topic: gpiozero Button not working when autostarted via ~/.profile
Replies: 3
Views: 81

Re: gpiozero Button not working when autostarted via ~/.profile

python3 buttontest.py 2>&1 > /home/pi/buttonlog.txt & Not checked the rest of the code, but this line doesn't redirect sdterr to the buttonlog.txt file, redirections are applied in the order they are given so the 2>&1 needs to come after you redirect stdout otherwise it just redirects stderr to the...
by Paeryn
Thu Oct 04, 2018 11:27 pm
Forum: Other programming languages
Topic: Control a kiosk mode screen with bash and python
Replies: 2
Views: 160

Re: Control a kiosk mode screen with bash and python

When starting the bash script at startup (pretty much whichever way you did it) the program won't have any input stream from which to read any keypresses (programs are run in the background so there is nowhere for them to get any input from). When X11 is running then keypresses generally only get se...
by Paeryn
Thu Oct 04, 2018 3:48 am
Forum: General discussion
Topic: Sudo Visudo Problems Logging into My Pi User and Another User
Replies: 15
Views: 378

Re: Sudo Visudo Problems Logging into My Pi User and Another User

When the command line prompt starts "[email protected]" then you are currently logged in as "username". Starting as user "pi", when you typed su username you were asking to s ubstitute u ser to username which will attempt to start a new shell as username, you need username's password to do this. When you ty...
by Paeryn
Tue Oct 02, 2018 11:50 pm
Forum: General discussion
Topic: Sudo Visudo Problems Logging into My Pi User and Another User
Replies: 15
Views: 378

Re: Sudo Visudo Problems Logging into My Pi User and Another User

Hello: Be aware that I have never been prompted for my pi passwd, which I am happy about! I just want to check both passwd(s) now which I never did successfully. I originally checked via sudo cat /etc/passwd, and both the root: and /home/username: lines contain /bin/bash, which I think indicates th...
by Paeryn
Tue Oct 02, 2018 1:44 pm
Forum: Troubleshooting
Topic: openCV-contrib installation throws c++: internal compiler error: segmentation fault
Replies: 2
Views: 69

Re: openCV-contrib installation throws c++: internal compiler error: segmentation fault

Usually you get Internal Compiler Error when the compiler runs out of memory. First thing to do is either increase swap space or reduce the number of jobs that make runs in parallel and try again.
by Paeryn
Mon Oct 01, 2018 6:12 am
Forum: Bare metal, Assembly language
Topic: When compiling for Pi3 in Arch32 enabling VFP
Replies: 9
Views: 808

Re: When compiling for Pi3 in Arch32 enabling VFP

Sorry fixed it... my assembler options were not being updated What does this mean? If you look at the Makefile shown the -mcpu and -march options were only applied when compiling C code (using COPTS). For assembly files no -mcpu or -march options were being applied (using ASMOPTS). Both DietPi and ...

Go to advanced search