Monday, December 30, 2019

Pt 2 :: A33 (quad core 32-bit Cortex A7) Allwinner notes

Links: key xda post :: firmware site

Ok, here we go again.

  1. Uses eMMC (not NAND) flashing
  2. Can run the installation from an SD card, which makes no changes, but allows users to do so.
  3. Maybe can use linux scripts in lieu of PhoenixCard or Phoenix USB (manufacturer), or Live Suite (retailer)

Command line connection

This particular Allwinner (A33) has a sunxi sun8i SoC (System on a Chip). I found this using the app, "Terminal Emulator for Android" and looked in the /system directory.

adb

NB: both boot.img and recovery.img are image files, so one needs to know which is which to know which directory into which to put them.

Different ID's depending on mode, like other phones.

$ lsusb
1f3a:1007 Allwinner Technology Android
18d1:d001 Google Inc. Nexus 4 (fastboot)
Similarly with the ADB's; depends on the mode.
$ adb devices
List of devices attached
990c3b4b07f100000000 device
990c3b4b07f100000000 recovery
990c3b4807f100000000 sideload
$ adb reboot bootloader [to run other adb's]

fastboot

press power and volume down at same time. When it's correct, you'll see only the A33 Quadcore logo with caption "Allwinner Tech". Verfiy...

# fastboot devices
Android Fastboot fastboot

yes

fastboot devices
fastboot erase boot [or recovery, data, cache, system]
fastboot continue

no

fastboot devices
fastboot flash boot someimage.img [block size]
fastboot continue
video unbrick with SD card It's possible that the initial "fastboot flash boot" failed with block size errors because all block sizes in the phone must be 1024 (native to phones), not 4096 (native to my laptop and desktop) or 256 I got the PhoenixCard here and then tried to use it with Wine.

Sunday, December 29, 2019

wine -- can we do this better?

Wine works but has been useless to me since its creation. Each app requires a custom installation -- that's fine -- but when we start the actual app with the "wine" command preceeding the EXE file, Wine "updates"(overwrites) the custom settings, and one receives the same suboptimal performance as if customization hadn't been accomplished in the first place. Because it's been entirely eliminated. It's essentially a repeat of the old problem we used to have with Python when running "pip" instead of a package manager. But Wine doesn't ask first.

Summary of iRoot steps

See backstory below for the steps regarding this USB connected device.
  1. Download PC version from website.
  2. Enter the ~/.wine and delete all files
  3. Prepare Wine and .NET using winetricks
    $ mkdir .wine/Win7
    $ WINEARCH=win32 WINEPREFIX=/home/$USER/.wine/Win7 winetricks dotnet452 vcrun2010 corefonts wininet
  4. Unzip the downloaded installation file somewhere, eg ~/.wine/Win7install.exe
  5. Install the iRoot program using wine.
    $ WINEPREFIX=/home/$USER/.wine/Win7 wine explorer /desktop=somename,720x480 "/home/$USER/.wine/Win7/iRoot_1.8.9.21144_cid1005.exe"
  6. Connect the tablet via USB and be sure screenlock is off, and data transfer enabled.
  7. Run the program, using wine. You could make an iDesk icon or menu entry with same info.
    $ WINEPREFIX=/home/$USER/.wine/Win7 wine explorer /desktop=somename,720x480 "/home/$USER/.wine/Win7/iRoot/1.8.9.21144/Root.exe"

Summary of audio editor steps

  1. $ mkdir .wine/Win7/audio
  2. $ cp audio.exe .wine/Win7/audio/audio.exe
  3. $ WINEPREFIX=/home/$USER/.wine/Win7 wine explorer "/home/$USER/.wine/Win7/audio/audio.exe"

backstory

For me, there are four applications with operating system complexity inside Linux use: Linux itself, LaTeX, Wine, and Blender. Plus perhaps the only slightly lesser issues of ALSA audio and CUPS printing. This time it was Wine, due to the need for two Windows PC apps, one for audio editing, another (iRoot) for rooting a cheap tablet. The former was straightforward, but the tablet rooting app was apparently developed using the .NET framework, and requires a USB connection to the tablet. As is well known, even in Windows proper, .NET dependent USB connections are horrible. Then add Wine complexity. The plan was to work through the errors to get a good Wine installation, then do the same thing for a good application installation.

part 1 :: wine (12+ hrs)

Strategy: follow someone else. Bracing for turbulence and a lost weekend, I downloaded the iRoot PC app and began Googling. The closest I could find was the Garmin Nüvi PC application for updating maps. It is .NET framework dependent, with a USB connection. Chris Titus has a helpful video (11:45) and a helpful web page on the Garmin. I followed his steps, only with the iRoot app, but wasn't successful. It's important to be specific about failures, the USB device was detected but then...
... and the tablet did not appear in the iRoot app, in spite of being detected beneath the hood.

directory structure

Unless two applications can run on the same version of Windows, each application requires a separate installation of windows. I put them in folders as seen here.
That is, although I keep wine and winetricks in the system, I completely eliminate all their files inside of /home/foot/.wine/. I then add directories for each version of Windows required. Based on my iRoot application, and Chris Titus' stuff above, I knew I wanted to work it into Windows 7.
$ mkdir .wine/Win7
$ WINEARCH=win32 WINEPREFIX=/home/$USER/.wine/Win7 winetricks dotnet452 vcrun2010 corefonts

installation errors

During the .NET (dotnet452) portion of the installation, several files are downloaded from Microsoft. A status box (left) also appears, and displays the error that I lack "Windows Modules Installer Service" (C:\Windows\servicing\TrustedInstaller.exe). I sought this executable afterward, but could not locate it. Based on the terminal, it appears the lack of this file prevented a certain level of software use.
0060:fixme:service:QueryServiceConfig2W Level 6 not implemented
I hoped to perhaps remedy this via the cleanup tool, once the Win7 was in, the next step.
$ WINEARCH=win32 WINEPREFIX="/home/$USER/.wine/Win7" winetricks win7

registry cleanup

This doesn't have to be run, but I was curious about it. With Windows 7 in, I placed the cleanup tool just inside the Windows 7 installation, in /home/foo/.wine/win7/drive_c/. It should look like this:
I had read about the (.NET framework cleanup tool) and wanted this operating. Cleanup would also have to be placed in any other installed folders -- XP, 10, whatever -- in which a person wanted to check their .NET install. The prefix is the OS folder, and then I gave it a 720x480 desktop to run inside, in case the Cleaner requires one.
$ WINEPREFIX="/home/$USER/.wine/win7" wine explorer /desktop=cleaner,720x480 "/home/foo/.wine/win7/drive_c/cleanup_tool.exe"
As it ran, the Cleaner, among many thousands of errors it revealed, noted the lack of level 6 implementation. Here are some of the error notifications...
Level 6 is not implemented.
HKLM\Software\Microsoft\Windows\CurrentVersion\Installer\Components key is not present.
No product/patch data was found.

part 2 :: application (12+ hrs)

First run indicated some missing pieces from my installation
0054:err:wininet:open_http_connection create_netconn failed: 12029
... it appeared the program needed to dial home. So, I added the missing wininet.
$ WINEARCH=win32 WINEPREFIX="/home/$USER/.wine/Win7" winetricks wininet
Here's more of the garbled mess that popped up. The program itself indicated a bug.

dead ends

A collection of various things I tried and which were apparently irrelevant.

lack of Windows Module Installer Service

During .Net (aka. "dotnet452") installation, if the installer is unable to find the Windows Module Installer Service,then it provides an error window. There is a noticeable effect downstream from this.
For example, error messages will appear if one attempts to attach a USB device via USB. This is because Level 6 of the .Net installation was not met. The USB device will successfully be detected, but the device will not be able to send file information or be written to. The complaints will take a form similar to...
0060:fixme:service:QueryServiceConfig2W Level 6 not implemented
The situation has been encountered by others, for example as documented here.

linux library checks - AUR

One of my dead ends was checking the Linux libraries. Mine turned out to be fine, but I read of them being a problem for others and having similar problems. Eg, a Battlenet article noted some missing Linux libraries had led to fails. The only one I thought might be mine was hal, so I checked for it...
$ ldconfig -p | grep hal
... returning nothing. Hal is in the AUR,so it has to be built.I'd want the 32 bit version. My luck, yaourt is no longer functioning.
$ yaourt -Ss hal
package-query: error while loading shared libraries: libalpm.so.11: cannot open shared object file: No such file or directory
$ ldconfig -p | grep alpm
libalpm.so.12 (libc6,x86-64) => /usr/lib/libalpm.so.12
libalpm.so (libc6,x86-64) => /usr/lib/libalpm.so

... so it's annoying as heck. Time to move to yay, I suppose; yaourt getting just too unmaintained -- I'm not going to create softlinks to libraries and such. Buh-bye...

yay build

# nano /etc/sudoers
foo ALL=(ALL) ALL
... otherwise the build will fail. Then...
$ cd Downloads
$ git clone https://aur.archlinux.org/yay.git
$ cd yay
$ makepkg -si

Sunday, December 22, 2019

video card replacement - hdmi

Although it looks imposing and is potentially a solid choice, I became tired (2019) of the 2Gb nVidia GeForce GTX770 (GK104 Audio Controller onboard) that came with my system.
Maybe it's an nVidia thing, but it had the nasty habit of ramping-up sound instead of turning audio on immediately. This meant that, after any silence, sound always returned smoothly, however it made video editing impossible. Sound needs to match video precisely and, since we're not going to play back video on only this nVidia system, we need to know volumes exactly, not with system-specific audio ramping.

nVidia vs Radeon

According to the proprietary utility nvidia-settings (in the nVidia driver), my motherboard has a PCIe Gen3(16bit) slot. I'm not a gamer, but for Blender's sake, I doubled GPU RAM with a 4Gb Polaris based AMD Radeon RX560D.
Again, however, the main factor is having audio that works correctly. There was simply nothing I could do to stop the nVidia card audio ramping. All automuting, all of that was disabled, but the nVidia sound always ramped instead of immediate.

Remove nVidia software

Once replaced, i uninstalled the nVidia module in favor of amdgpu module.It's just sitting there and not being used so it doesn't really hurt anything, but it's a 200Mb of orphaned stuff. I ran # pacman -Ss nvidia to see what I had installed and removed all of them...
# pacman -Rdd libvdpau libxnvctrl nvidia nvidia-utils

audio

When I had the nVidia card, I was never able to pass the dreaded same-named sound card issue...
$ cat /proc/asound/modules
0 snd_hda_intel
1 snd_hda_intel
...which would sometimes provide sound and sometimes static.

libva v libvdpau

I still don't understand if I'm supposed to have both the Intel and the nVidia video hardware acceleration. I knew that va was intel and vdpau nVidia, so which/what to use on with the amdgpu and a Radeon. At some point, because Chromium appeared to favor vdpau, I installed vdpau, and did so by installing its utility, vdpauinfo...
# pacman -S vdpauinfo
... which also brought in libvdpau. Following this, Chromium opened normally, and YouTube functioned.

xorg

With the nVidia software removed and the amdgpu package installed, X refused to initialize. The error and the solution discussion are here. The solution required a change to /etc/mkinitcpio.conf...
MODULES=(amdgpu)
... and then
# mkinitcpio -p linux
After this, X loaded normally.

Sunday, December 15, 2019

sound and systemd, restart sound

Running HDMI means dealing with two audio chips -- the first on the motherboard and a second on the video card, where the A/V HDMI cable is connected. Many things can therefore derail the sound. In this case it was an Arch update, causing some conflict with the kernel. But each failure has to be solved by a process of elimination. ALSA is embedded into the kernel, so that systemd is the way to restart.
# systemctl restart alsa.restore.service
Should d

Let's suppose the connected HDMI device at the other end of the cable is putting out clean video. Now let's suppose the audio is also present, but that it sounds distorted: chipmunky or maybe raspy or fuzzy, like a bad AM radio connection. We know that at least one of the audio chips IS working if sound is present at the output. But solving the distortion many not be easy. Perhaps the wrong sound chip, both chips simultaneously, or that the correct chip has incorrect settings. You've done everything here and the gold standard...
$ aplay -D plughw:1,7 /usr/share/sounds/alsa/Front_Center.wav
...for your particular hardware, which you correctly determined with...
$ aplay -l

Suppose this is in spite of Pulseaudio being effectively disabled , /usr/share/alsa/alsa.conf successfully sterilized of hooks, and /etc/asound.conf, ~/.asoundrc, and ~/.config/asound.conf having been successfully deleted.

Suppose also that we have...
$ systemctl list-unit-files |grep alsa
alsa-restore.service static
alsa-state.service static

$ systemctl list-units |grep sound
sys-devices-pci0000:00-0000:00:01.0-0000:01:00.1-sound-card1.device loaded active plugged GK104 HDMI Audio Controller
sys-devices-pci0000:00-0000:00:1b.0-sound-card0.device loaded active plugged 7 Series/C216 Chipset Family High Definition Audio Controller
sound.target loaded active active Sound Card
... well then WTF is going on? We can see ALSA is properly "static" and therefore compiled into the kernel. We can see that both hardwares examine some of those systemd service modules inside /etc/systemd/system/, but this does not seem to be the problem.

possibility 1

Suppose you still have an unaddressed situation of both sound cards receiving the same name from the kernel
$ cat /proc/asound/modules
0 snd_hda_intel
1 snd_hda_intel