Author Topic: QB64 on Raspberry Pi (again)  (Read 3399 times)

0 Members and 1 Guest are viewing this topic.

Offline maersi

  • Newbie
  • Posts: 3
    • View Profile
QB64 on Raspberry Pi (again)
« on: October 17, 2020, 07:13:26 am »
So, a few months ago, trapped at home, I dug an old Raspberry  Pi  2, out of a drawer, and found it was still working. I set it up as a home samba server and media centre, and all was fine,
I wanted to add some more features, and needed to write some code. QB64 seemed to be the best choice. BASIC was the first language I learned, back in the early 70's, I have QB64 installed on both Windows and Linux, which I tend to use when I can't find an existing way to do something.
QB64 is now installed on the Pi, and seemed less painless than the last time I tried it, compiled on the 4th attempt - less than 2 hours overall.
The initial "Hello World" program compiled and ran fine.
I realise that this is not officially supported, but wondered if anyone could help. I have two problems:
1: the IDE is broken when set to full screen, but seems OK otherwise
2: SHELL is not working as a statement or function - I can't tell if it is starting a shell but not passing the execution string, or not starting the shell. There is no error.

This is a biggie - without shell I cannot do what is needed. I want to simplify and automate some actions.
For example, my VPN provider requires that IPV6 be disabled before starting VPN, and I have to edit their config file to insert the details of the server I want to connect to.
I want to simplify this procedure, and that cannot be achieved without SHELL
Obviously, the compiled BASIC program itself is running in a shell, but seems either unable to create a sub shell or pass an executable string to a sub shell.
The problem may be nothing to do with QB64 - maybe a permissions problem somewhere.
I would be gratefully for any pointers.

Marked as best answer by maersi on October 17, 2020, 10:18:42 am

Offline luke

  • Administrator
  • Seasoned Forum Regular
  • Posts: 324
    • View Profile
Re: QB64 on Raspberry Pi (again)
« Reply #1 on: October 17, 2020, 09:34:49 am »
Quote
2: SHELL is not working as a statement or function - I can't tell if it is starting a shell but not passing the execution string, or not starting the shell. There is no error.

When running a SHELL command, the command's output will go to the program's stdout/stderr. If you start the QB program directly from the terminal (or, if launching via the IDE, start the IDE from the terminal) you will see the output of any SHELL commands.

Generic advice aside, disabling IPv6 should be a matter of setting
Code: [Select]
net.ipv6.conf.all.disable_ipv6 = 1 in /etc/sysctl.conf, rebooting and you're done, so I'm not entirely sure why you'd need to automate it. Anyway, editing that file requires root permissions, so you'd need to run any automation program with appropriate privilege.

Depending on where your VPN program reads its config from it may it may not require root privilege to edit.

Offline maersi

  • Newbie
  • Posts: 3
    • View Profile
Re: QB64 on Raspberry Pi (again)
« Reply #2 on: October 17, 2020, 02:58:55 pm »
Excellent :) I can see the output from shell commands now. So I can press on.
VPN was just an example. There is no supplied VPN program or app, Just a set of instructions. I am planning to "WGET" the list of VPN servers from the provider's website, and display the list for selection in my program. This would then edit the vpn config file, with IP address and port, then edit sysctl.conf, and issue sudo sysctl -p to avoid a reboot, and finally start vpn.
After closing  vpn, the program would reverse the edit to sysctl. conf, issue another sudo sysctl -p, sudo ifconfig eth0 down, and sudo ifconfig eth0 up. No reboots required. I'm just lazy ;-)
As I am the only user of the Pi, I have no qualms about using chmod 666 on such files.
Thanks again - starting QB64 from the terminal would not have occurred to me, especially as the nice QB64 devs have created an entry point in the Programming category

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: QB64 on Raspberry Pi (again)
« Reply #3 on: October 18, 2020, 04:23:28 am »
Is a Pi 2 the cheapest new hardware QB64 will run on?
What does a Pi need to be a fully functioning computer?
Board + power supply + display + keyboard? 

Bet I can buy old used 32 bit laptops for 20-50 at flea
markets and garage sales.
It works better if you plug it in.

Offline luke

  • Administrator
  • Seasoned Forum Regular
  • Posts: 324
    • View Profile
Re: QB64 on Raspberry Pi (again)
« Reply #4 on: October 18, 2020, 08:17:42 am »
What does a Pi need to be a fully functioning computer?
Board + power supply + display + keyboard? 
Power supply is via USB but with moderate power requirements, see https://www.raspberrypi.org/documentation/hardware/raspberrypi/power/README.md

Display not necessary because you can use ssh to connect to it via network, though it can be convenient to have one for the initial setup.

You will also require an SD card.