Go to advanced search

by jojopi
Fri Aug 11, 2017 11:25 pm
Forum: Beginners
Topic: GPIO In bash not working (Solved)
Replies: 9
Views: 178

Re: GPIO In bash not working (Solved)

When I try to use pi@raspberrypi:~ $ gpio mode 21 up it doesnt change the mode of the pin when I use gpio readall they still show up as mode IN "gpio ... mode ... up" sets the pin as an input, but with the internal pull-up resistor enabled. The pull resistors are useful if you connect a switch to a...
by jojopi
Fri Aug 11, 2017 2:41 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: To "sudo echo..." or not to "sudo echo..." to /dev/spidev... ?
Replies: 18
Views: 604

Re: To "sudo echo..." or not to "sudo echo..." to /dev/spidev... ?

There is no permissions issue, because sudo would not fix that. Sorry. Just switching to printf does not help in this case, because it is not required to support hex escapes either. The only really portable solution is to use octal: printf "\017\001" > /dev/spidev0.1 Slightly less reliably, you coul...
by jojopi
Wed Aug 09, 2017 6:48 pm
Forum: General discussion
Topic: Re-purposing SPI lines to be GPIOs?
Replies: 12
Views: 635

Re: Re-purposing SPI lines to be GPIOs?

Many of the functions of the "gpio" binary expect wiringPi pin numbering by default.

Use "gpio -g mode 10 output" to indicate that you mean Broadcom numbering.
by jojopi
Wed Aug 09, 2017 4:53 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: To "sudo echo..." or not to "sudo echo..." to /dev/spidev... ?
Replies: 18
Views: 604

Re: To "sudo echo..." or not to "sudo echo..." to /dev/spidev... ?

@jojopi, the lack of -e or /x escapes may be a red-herring (AFAIK the use or not of "sudo" shouldn't change that). system() always uses /bin/sh, which is dash. sudo uses bash. Your echo command is not portable. Since the sudo does not improve the permissions of your command, the change of shell is ...
by jojopi
Wed Aug 09, 2017 3:25 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: To "sudo echo..." or not to "sudo echo..." to /dev/spidev... ?
Replies: 18
Views: 604

Re: To "sudo echo..." or not to "sudo echo..." to /dev/spidev... ?

system() runs the equivalent of /bin/sh -c 'COMMAND'. sh's implementation of echo does not support the -e option or the \x escapes, so the output is not as intended. You should use the POSIX compliant syntax, which works in all shells: printf "\x0f\x01" > /dev/spidev0.1 Now you can remove the sudo. ...
by jojopi
Wed Aug 09, 2017 10:06 am
Forum: Troubleshooting
Topic: Date Time remains in UTC despite being configure for Local Zone
Replies: 16
Views: 526

Re: Date Time remains in UTC despite being configure for Local Zone

ALTHOUGH.. now I am thinking I need to modify my code to work differently depending on the Kernel installed. No. There has been no change in behaviour, and any change would be related to the tzdata package, not the kernel version. The kernel does not worry about timezones, it just runs on UTC. Your...
by jojopi
Tue Aug 08, 2017 6:25 am
Forum: General discussion
Topic: Account deletion?
Replies: 61
Views: 2203

Re: Account deletion?

The OP goes to all the effort to sign up and open an account. Then the first post asks how to delete the account. Did you notice that the sign-up was three years ago? At least one old post, "Help with composite output on xbmc!" has recently been deleted. (I believe that is possible only when it is ...
by jojopi
Sun Aug 06, 2017 2:49 pm
Forum: Other languages
Topic: Register allocation (assembly language)
Replies: 32
Views: 1134

Re: Register allocation (assembly language)

#define max(a,b) ({ const typeof(a) t1 = (a), t2 = (b); (typeof(a))(t1 > t2 ? t1 : t2); }) The more I look at this, the more I think it is not correct. First of all the final cast seems unnecessary, because you already converted b to typeof(a) when assigning to t2. Actually it is a good job that yo...
by jojopi
Sat Aug 05, 2017 12:29 pm
Forum: Raspbian
Topic: ext4 inode ratio
Replies: 14
Views: 752

Re: ext4 inode ratio

So really I'm asking where is the 2017-07-05-raspbian-jessie-lite -news .zip download? If you were running an NNTP server, surely you would want to put its spool on an external drive, not the SD card? Incidentally, an alternative to regenerating the root filesystem is to create an additional partit...
by jojopi
Tue Aug 01, 2017 8:33 pm
Forum: Bare metal
Topic: When setting up the mini UART, why does it need clock control signal?
Replies: 6
Views: 516

Re: When setting up the mini UART, why does it need clock control signal?

Can someone explain what this is needed for? It is not needed . The UART will function whether the pulls are up, down, disabled, or in unknown state. A tiny amount of power (average 33µA at 3.3V) will be wasted when the pull resistors oppose the serial data. I would argue that it is actually better...
by jojopi
Fri Jul 21, 2017 7:00 pm
Forum: Python
Topic: For loop numeric
Replies: 15
Views: 633

Re: For loop numeric

Code: Select all

week = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]

for index, day in enumerate(week, start=1):
    print("A day of the week is: {}. {}".format(index, day))
by jojopi
Wed Jul 19, 2017 7:38 pm
Forum: Other languages
Topic: Assembly language: multiplication by a constant
Replies: 23
Views: 1039

Re: Assembly language: multiplication by a constant

I doubt it is practical to make an integer multiply unit as fast as a shift or add, regardless of how much silicon you throw at it. Think about all the intermediate results, and the ways that the output bits depend on the bits of the inputs, and imagine trying to compute it all within a fixed number...
by jojopi
Wed Jul 19, 2017 6:01 am
Forum: Beginners
Topic: Arduino Serial doesn't work until open Serial Monitor
Replies: 9
Views: 364

Re: Arduino Serial doesn't work until open Serial Monitor

you should do a s.write only inside a check if isOpen No way. It is far better just to write(). If you ever try to use a port that is not open, an exception will be raised. That is good, since then you will know your code has a bug. What you propose is to have the buggy program carry on running, bu...
by jojopi
Tue Jul 18, 2017 9:58 pm
Forum: Python
Topic: socket.gethostbyname returns wrong interface ip add
Replies: 12
Views: 513

Re: socket.gethostbyname returns wrong interface ip add

To create a socket to transmit, I need the IP add of the particular pi zero: You do not need to know your own IP address to create an outbound connection. You only need to know the address you are connecting to. More specifically, it is completely optional to bind() a local socket before you connec...
by jojopi
Tue Jul 18, 2017 6:53 pm
Forum: Python
Topic: socket.gethostbyname returns wrong interface ip add
Replies: 12
Views: 513

Re: socket.gethostbyname returns wrong interface ip add

You are running Python on the Pi. On that machine, 127.0.1.1 is a valid address to use to connect to the named machine (which is itself). Were you planning for the Pi to communicate the lookup result to some other system? How and why? Normally you would do the lookup on the host where you need the r...
by jojopi
Tue Jul 18, 2017 4:43 pm
Forum: General discussion
Topic: Forum code readability
Replies: 43
Views: 1784

Re: Forum code readability

jetibest wrote: margin-bottom: -15px !important;
You cannot have tested that for very long.

The problem is that some posters put a newline after [/code]. For those of us that do not, your modification will make the next paragraph overlap the code box. (In both themes.)
by jojopi
Mon Jul 17, 2017 6:16 pm
Forum: C/C++
Topic: set raspberry system time by a time_t w/o having Wifi
Replies: 18
Views: 797

Re: set raspberry system time by a time_t w/o having Wifi

hmm - time(0) would not work, because without WiFi the Pi does not know it actually, and it has no RTC built-in. Your original question was about setting the system time using the information you get from GPS. Once you have set the system time as root, all programs will have access to it. time(0) w...
by jojopi
Mon Jul 17, 2017 12:00 pm
Forum: C/C++
Topic: set raspberry system time by a time_t w/o having Wifi
Replies: 18
Views: 797

Re: set raspberry system time by a time_t w/o having Wifi

ps, and displaying that local time then correctly in the task bar, just like if it had come via internet time by LAN or WiFi? Once you set the system clock (as root) all programs including the panel applet will use the new time. I suppose the Arduino library you mean is: https://github.com/JChriste...
by jojopi
Sun Jul 16, 2017 5:41 pm
Forum: C/C++
Topic: How would you ...... in C ? (+ other C discussions)
Replies: 187
Views: 10848

Re: How would you ...... in C ? (+ other C discussions)

You need to get out more GCC in general is horrible at optimization with structures, Is the problem really specific to structures? It seems to me that you have written two separate blocks of code (the if and else parts) that do almost the same thing. You want the compiler to notice that and emit a ...
by jojopi
Sun Jul 16, 2017 8:48 am
Forum: Raspbian
Topic: Raspian 2017-07-05 apt-get install problem
Replies: 11
Views: 954

Re: Raspian 2017-07-05 apt-get install problem

The image has a size 4661483821 (which looks odd). I had been looking at that number myself and failing to spot the issue. It is not even even. So, it is not dd's fault if the output is truncated. When using a raw device or oflag=direct, the kernel will reject the whole of the last write for not be...
by jojopi
Sat Jul 15, 2017 9:12 pm
Forum: C/C++
Topic: set raspberry system time by a time_t w/o having Wifi
Replies: 18
Views: 797

Re: set raspberry system time by a time_t w/o having Wifi

But what I do not understand yet: if I do so, how will the Pi know if that is the CEST or the CET time, and not the utc time, or vice versa? time_t values represent the integer number of (non-leap) seconds elapsed since the epoch, 1970-01-01 00:00:00 UT. A time_t value that tries to use a different...
by jojopi
Sat Jul 15, 2017 11:18 am
Forum: C/C++
Topic: How would you ...... in C ? (+ other C discussions)
Replies: 187
Views: 10848

Re: How would you ...... in C ? (+ other C discussions)

jahboater wrote:Without using isapha(), how would you reduce this "if" to a single test instead of four?
Simply by compiling it:

Code: Select all

        bic     r0, r0, #32
        sub     r0, r0, #65
        cmp     r0, #25
Note that subtracting 65 is an improvement over rurwin's solution.
by jojopi
Thu Jul 13, 2017 9:34 am
Forum: Raspbian
Topic: Request for SSH Enabled Images
Replies: 19
Views: 1123

Re: Request for SSH Enabled Images

-bash: /usr/bin/touch: cannot execute binary file: Exec format error Yes, I did wonder whether you were overwriting your active root filesystem. If you install package busybox-static, copy /bin/busybox to /dev/shm/, and run "/dev/shm/busybox sh" before starting, then you should still have a basic s...
by jojopi
Wed Jul 12, 2017 9:50 am
Forum: Raspbian
Topic: Request for SSH Enabled Images
Replies: 19
Views: 1123

Re: Request for SSH Enabled Images

Why not touch the file between the dd and the reboot?
by jojopi
Tue Jul 11, 2017 7:05 pm
Forum: Raspbian
Topic: Why in 2017 do we still not have BTRFS in Raspbian?
Replies: 6
Views: 625

Re: Why in 2017 do we still not have BTRFS in Raspbian?

Debian and Ubuntu support it out of the box, why can't we have that? Debian supports different root filesystems using initramfs, not by compiling them all into a monolithic kernel. It would make a lot more sense to ask for easier integration of the Foundation-packaged kernels with the Debian/Raspbi...

Go to advanced search