Join us on Discord!
You can help CodeWalrus stay online by donating here.

Caleb Learns Linux

Started by Caleb Hansberry, November 09, 2015, 11:28:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

novenary

That's unfortunate, it will be hard to troubleshoot without access to the machine. Your best bet at this point is a reinstall I suppose. :/

Travis

Yeah, reinstalling is probably the easiest way for now while you're still learning your way around, even if it wouldn't be strictly necessary if you knew what was wrong and how to fix it.

One good idea is to write down (or keep in a text file somewhere) everything you do on the system as root or with sudo, so if something breaks you can retrace your steps and try to figure out what you might have done to cause it. It also gives you a list of things to redo if you have to reinstall or switch to another distro so you don't have to figure it all out again. I wish I had done that on my current Arch desktop system; I plan to get back into that habit when I change to some other distro which I'm planning to do someday because rolling release doesn't seem to work well for me.



The recommended way to make modules load automatically on boot on Arch-based systems is described here: https://wiki.archlinux.org/index.php/Kernel_modules#Automatic_module_handling
Basically, you make a file in /etc/modules-load.d/ and list the modules you want. Putting "brcmsmac" on a line in one of these files ought to work. On my Arch desktop right now, I have '/etc/modules-load.d/custom.conf' which I created and just threw things in:

# Load extra needed modules that aren't loaded automatically

loop
#uvesafb
#acpi_cpufreq
vboxdrv
vboxnetflt
vboxnetadp


Lines starting with # are ignored; the rest are modules I wanted loaded on boot because they don't load automatically for whatever reason. (In case you're curious, 'loop' is the module that allows mounting and accessing things like the contents of ISO and disk image files directly as if they were actually on a disk in my system, the 'vbox...' stuff is drivers for VirtualBox (lets me run other OSes in virtual machines from inside the main OS), and the commented-out lines are apparently stuff I was once fooling around with and decided I didn't need (I might as well delete those).



Can't really answer the backlight thing since I've never really had to mess with ACPI stuff much.
  • Calculators owned: TI-81, TI-82, TI-85, TI-86, TI-89, TI-89 Titanium, 2 × HP 50g

novenary

Why would you load loop on boot ? I thought it was supposed to be automatically loaded when you mount something with -o loop (and apparently mount is smart enough to make this option implicit).

Travis

It doesn't seem to work for me. I have to always load it separately before the mount -o loop or losetup commands work.
  • Calculators owned: TI-81, TI-82, TI-85, TI-86, TI-89, TI-89 Titanium, 2 × HP 50g

novenary

Strange, it seems to work fine over here, I don't even need to specify -o loop, and the module gets loaded.

Lionel Debroux

Under Debian sid amd64, loop isn't loaded by default or automatically when I use `mount -o loop`, either.
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TIEmu and TILP.
Co-admin of TI-Planet.

Caleb Hansberry

Aaaaah been too long since I posted my update here, I know.
So I've been messing around with Antergos. Reinstalled it with Gnome (I think, whatever the default was) as the desktop environment instead of KDE. Now the wifi works fine for some reason. The brightness is the same issue, but I succeeded in making a script that worked, I had to chmod +x it which was interesting. It takes the value of "/sys/class/backlight/intel_backlight/brightness", stores it into a variable called "luminance", adds or subtracts 1000 (the range is 0 to 13046), and stores it back.

Next I need to make some sort of exponential function to control the brightness. This will be hard. The brightness changes much more dramatically at lower numbers, so should change less, and less at high numbers. Like 6000 to 12000 is a small difference, and 20 to 1000 is a big difference (20 is the lowest you can stil lsee anything on the screen). Got any ideas as to how this would work? I never was very good at math, never really finished Algebra, and don't know where to start.

Next I need to install Python for programming. I know it has python installed, but I need a good beginner tutorial that is aimed at graphics not math, and I'll need a good IDE.
  • Calculators owned: TI-82, TI-83, TI-83+SE, TI-84+SE, TI-85, TI-89, TI-99/4A
  • Consoles, mobile devices and vintage computers owned: HP Portable Plus 110, Toshiba T3100, Toshiba T5200, GRiD 1660, TI-99/4A, Apple IIgs, and much more than I can list here

semiprocoder

#22
Well, instead of adding or subtracting to or from the brightness, I suggest multiplying/dividing the brightness by some value. It would be best if you start with 20 and then add from there.

Here are some values I calculated, which 20 as the min val and 13046 as the max val.
~3.655 with 5 different brightness values
~1.9118 with 10 different brightness values
~1.5404 with 15 different brightness values
and ~1.3827 with 20 different brightness values.

I calculated it using this, with n=num different brightness values:
(13046/20)^(1/n)=(652.3)^(1/n)
same thing(hopefully) but just in latex:
[tex](\frac{13046}{20})^{\frac{1}{n}}=652.3^{\frac{1}{n}}[/tex]

In other words, [tex]\sqrt[n]{652.3}[/tex].
Hope that makes sense, and otherwise just use my precalculated variables.
  • Calculators owned: ti nspire, ti 84 plus se
My cemetech username is awesommee333.

Travis

#23
Ooh, this is one of those fun, practical uses for using graphing calculators. :) You can experiment with different formulas like the ones "semiprocoder" gave in function graphing mode and play with them until you get a curve that does what you want. It can take some trial and error, but eventually you get a feel for what math operations do what to the graph. Or, if you have some idea of a few inputs you want to map to what outputs at different points, you can throw them into the statistics editor and find a regression model that might be close to what you want. (Perhaps I just happen to have a bit too much fun doing this. ;) It's definitely educational, though.)

Implementing the equations in bash scripting might be slightly tricky, though, since math is very limited, and I don't think it does floating point. You can easily pass the equations to external programs like 'bc' or even python and capture the output result and use it, though.

Graphics in Python has a bunch of choices, depending on what "system" you want to use. It has its own Tkinter GUI toolkit built in (and apparently a turtle graphics module as well), but there are also libraries for using SDL, GTK+, Qt, and other GUI toolkits with Python. There are certainly a number of IDEs available, but I don't know much about them. I haven't really felt the need to use an IDE, personally; a good text editor with good multiple-file and Python-syntax support, some open terminal windows, and an interactive shell like ipython, work pretty well for me.
  • Calculators owned: TI-81, TI-82, TI-85, TI-86, TI-89, TI-89 Titanium, 2 × HP 50g

Caleb Hansberry

Nice, guys! 1.3827 is a nice enough number. The math part definitely confused me though to be honest. I actually tried using my CSE for the task first but it threw an error that I didn't understand :(

Can't figure out how to get it into bash though. I believe all I need to do is multiply brightness by 1.3827 and then store the result back into brightness, but first I need to figure out how to do that part, and then I need to stop it from giving the LCD panel a decimal number (was that the technical name? a number with numbers to the right of the decimal point) cause it won't like that. Then I also need to stop it from giving it a number above 13046. I tried just stripping off the numbers to the right of the decimal point, but that does weird stuff to the math when you multiply, remove them, and then divide, and remove them again.
Maybe I could store the variable that it does math on elsewhere, and only turn it back into an integer when it's stored into Brightness.

For Python, most likely Turtle is fine right now. So I can just program in Nano then?


Anyways, here's my code:
brightness=$(cat /sys/class/backlight/intel_backlight/brightness)
luminance=$(expr $brightness * 1.3827)
if $luminance > 13046 then $luminance=13046
echo $luminance | sudo tee /sys/class/backlight/intel_backlight/brightness

But it doesn't work >_> something about the "if" command used there?
  • Calculators owned: TI-82, TI-83, TI-83+SE, TI-84+SE, TI-85, TI-89, TI-99/4A
  • Consoles, mobile devices and vintage computers owned: HP Portable Plus 110, Toshiba T3100, Toshiba T5200, GRiD 1660, TI-99/4A, Apple IIgs, and much more than I can list here

Yuki

You're missing a few stuff here. Here's a more correct code.

if [ $luminance -gt 13046 ]
then
luminance=13046
fi
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron

if you wanna throw money at me and/or CodeWalrus monthly it's here

Caleb Hansberry

#26
Ah, thanks Juju! When I tried it, it told me some error, but then Travis gave me a different code which I used and it worked well - sorry that I didn't use your's :'(

But, it finally works right! I could change the brightness with the function keys out of the box in windows, but for some reason it failed in Linux. But now it finally is put together. The finished script that Travis and the others helped me put together is:
brightness=$(cat /sys/class/backlight/intel_backlight/brightness)
luminance=$(python –c "print(min(int(round($brightness * 1.3827)),13046))")
echo $luminance | sudo tee /sys/class/backlight/intel_backlight/brightness


It changes the brightness with 20 levels beautifully, and I do understand how it works which is great :D Then I just made a file in the /etc/acpi/events/ directory containing:
event=video/brightnessup BRTUP 00000086 00000000
action=/usr/local/bin/brightnessup


To tie the ACPI event to the script, and it worked well! Next I need to tell it to run "sudo systemctl start acpid.service" when it boots up, because it doesn't work without that.

[EDIT] Okay so I added an entry to .bashrc to start the acpid service. However, that means the brightness buttons don't work until I open the terminal and type my sudo password. How else should I be doing this so I don't need to type my password to execute this command and don't need to open the terminal?
  • Calculators owned: TI-82, TI-83, TI-83+SE, TI-84+SE, TI-85, TI-89, TI-99/4A
  • Consoles, mobile devices and vintage computers owned: HP Portable Plus 110, Toshiba T3100, Toshiba T5200, GRiD 1660, TI-99/4A, Apple IIgs, and much more than I can list here

Travis

#27
Try "sudo systemctl enable acpid.service". That should set it to start acpid automatically during bootup.
  • Calculators owned: TI-81, TI-82, TI-85, TI-86, TI-89, TI-89 Titanium, 2 × HP 50g

Caleb Hansberry

Thanks Travis, that worked fine!

Sorry I've been really busy this season, plus the netbook screen got damaged so half the screen flickers now. Turns out netbooks are really very finicky. I'll get back to it as soon as I can though.
  • Calculators owned: TI-82, TI-83, TI-83+SE, TI-84+SE, TI-85, TI-89, TI-99/4A
  • Consoles, mobile devices and vintage computers owned: HP Portable Plus 110, Toshiba T3100, Toshiba T5200, GRiD 1660, TI-99/4A, Apple IIgs, and much more than I can list here

Caleb Hansberry

Alright, I think I'll be able to return! I'm pretty committed to giving Linux a fair shot even if it's loads of work :P

The netbook screen got worse and I couldn't handle it anymore, I just threw it away (on ebay for cost of shipping). So I finally got a new HDD for my desktop and wanna try dual booting Windows and Linux. Unless a different distro offers something major, I'll still plug away at Antergos, my experience wasn't bad with it.

How do I set that up? I'm installing Linux on a 160GB HDD, and have windows on 120GB SSD and a 1TB data drive. Should I modify the 160 from linux or windows to make the swap and root partitions?
  • Calculators owned: TI-82, TI-83, TI-83+SE, TI-84+SE, TI-85, TI-89, TI-99/4A
  • Consoles, mobile devices and vintage computers owned: HP Portable Plus 110, Toshiba T3100, Toshiba T5200, GRiD 1660, TI-99/4A, Apple IIgs, and much more than I can list here

Powered by EzPortal