Saturday, 3 November 2018

Linux on a HP Chromebook 11 G5 - First steps

Cool, a free Laptop! Now what?

Google currently gives away free Chromebooks to promote GSuite and other cloud services. Once the Chromebook had served it's purpose to do an interview through Google hangouts, the device remained with us. (Which is probably cheaper than sending sales-reps to any mid-sized company.)
Google most likely got a good deal out of HP getting rid of their 2016, 5th generation model of the 11" Chromebooks for them. (Current devices are G6 (6th generation))

HP Chromebook 11 G5 running Linux (Project Crostini)

The specs

You can't expect stellar specs from a Laptop that goes for unter 200€, a 10 year old Core2 Duo will still have more processing power.

HP Chromebook 11 G5 ee

  • Intel Celeron N3060 / 1.60 GHz (2.48 GHz) /2 MB cache, 2 cores
  • Intel HD Graphics 400 / 29.46 cm (11.6 in) 1366 x 768 screen + HDMI out
  • eMMC SSD 16GByte
  • 4GByte RAM
  • WiFi 2,4/5GHz
  • Webcam (720p) Speakers/Mic - Headphone jack
  • 2xusb 3.0 Ports
  • SD Card slot

Of course it has enough grunt to run the Chrome browser plus some apps at an acceptable speed. It easily beats my Raspberry-Pi's desktop performance.
And despite being very plasticy, it feels quite sturdy and doesn not bend or creak.

Chromebook 11 with sleeve

Microsoft Office 365

Quite unlike what Google probably intended, I installed Microsoft's Office 365 apps from the playstore. This integrates nicely with my E3 plan for Office 365. The usual Word / Excel / PowerPoint jobs are not much of a challenge for the little machine. The documents stored in OneDrive are instantly accessible.
PowerPoint in all it's glory
I tried some of my larger PowerPoint presentations and was amazed that all of them worked very well. Including the embedded videos.

Linux?

Before potentially ruining a percectly useable machine, my first attempt was to go the easy route and use what Google has already provided: Crostini
Other than other Chromebooks, the HP 11 G5 has to be set to update it's Chrome OS from the Beta channel. (No need for the developer mode, though.)

Change the channel
Switch to beta

After a restart, the Linux option is available in the chrome://settings menue
Inside the VM

This installs a VM along with a terminal application and a shared folder. Everything looks and feels pretty much like Debian stretch.
Now I can run some super exciting software:
xeyes - a classic :-)
I also installed thunderbird as a proper e-mail client, gnuradio and gqrx. The latter two suffer from the still missing USB support, so they won't talk to external SDR hardware.

The shortcomings of Crostini

For some, Crostini might be good'nuff already. If you need sound, hardware accellerated graphics and USB-access, it is not ready at the time of writing. (Nov 2018)
So it is quite possible, I'll try crouton (a chroot solution) some time soon. See here for more on crouton. (I'll keep you posted.)



Monday, 22 October 2018

Fix iPhone USB disconnects from Microsoft surface dock

iPhone 8 frequently disconnects - update your dock firmware

My iPhone 8 disconnected from my Microsoft Surface Laptop frequently, and reconnected immediately. I tried several cables, re-starting the phone & computer. Nothing helped.
This was especially annoying because I couldn't transfer photos and videos reliably from the phone.

Surface Dock updater

What solved it for me (at least for the moment), was to update the surface dock firmware.
I got the latest version from Microsoft here.
Microsoft dock updater

Several rounds needed?

I ran the updater three times (taking about 5 minutes for each round), following the instructions of the updater each time.
Finally re-running the updater reported:

Dock firmware fully updated
And that seemed to fix it. The iPhone now syncs with iTunes reliably and I can transfer data without disconnects.

Tuesday, 2 October 2018

How to build a low cost applause-o-meter

Building an applause-o-meter with a WS1361

1)The task

When a friend asked me if I could build an applause-o-meter (clap-o-meter, clapometer, applausemeter) for a concert, I thought that should be quick and painless. - I was wrong.
But not knowing what one is up against can be a blessing. And so it went:
Detail of the application: Progress bars as bargraphs


2) The Hardware

So I bought the cheapest sound level meter I could find at my favourite Chinese seller that sported an USB interface: The Wensn WS1361, also sold as HY1361.
See this article about the driver setup to get it up and running with the original software in this blog post.
The other things needed for the applause-o-meter are a projector and a computer running a current version of Windows.

3) The software

For my purposes, the supplied software is pretty useless. So I set out to write my own software for reading the meter.

3.1 libusb-win32 vs libusb

While the SoundPCLink  software relies on libusb-win32, I found a fantastic project for using the libusb at libusb.info. Full support for Visual Studio 2017. - Very handy.
You need to change the driver for the WS1361 from libusb-win32 to libusb (Winusb) with Zadig.
Change the driver with Zadig
If you don't see the WS1361 listed, check the "list all devices" option.

3.2 Simple c++ sound level reader

After a little time it took to understand the library, I wrote a very simple command line tool to read a single db value from the meter:


 /*  
  * ReadSoundMeter: Read DB Value from WS1361 / HY1361 sound level meter  
  * 2018-09 by AReResearch (Andy Reischle)  
  * www.areresearch.net  
  * Inspiration and many lines of code taken from  
  * Pete Batard <pete@akeo.ie> 's example code to libusb, xusb.c  
  */  
 #include "pch.h"  
 #include <stdio.h>  
 #include <stdint.h>  
 #include <stdlib.h>  
 #include <string.h>  
 #include <stdarg.h>  
 #include <C:\Buffer\SoundMeter\libusb-master\libusb\libusb.h>  
 #define CALL_CHECK_CLOSE(fcall, hdl) do { int _r=fcall; if (_r < 0) { libusb_close(hdl); ERR_EXIT(_r); } } while (0)  
 #define ERR_EXIT(errcode) do { perr("  %s\n", libusb_strerror((enum libusb_error)errcode)); return -1; } while (0)  
 #if defined(_WIN32)  
 #define msleep(msecs) Sleep(msecs)  
 #else  
 #include <time.h>  
 #define msleep(msecs) nanosleep(&(struct timespec){msecs / 1000, (msecs * 1000000) % 1000000000UL}, NULL);  
 #endif  
  // Future versions of libusb will use usb_interface instead of interface  
  // in libusb_config_descriptor => cater for that  
 #define usb_interface interface  
 int r;  
 static uint16_t VID = 0x16C0;  
 static uint16_t PID = 0x05DC;  
 static void perr(char const *format, ...)  
 {  
      va_list args;  
      va_start(args, format);  
      vfprintf(stderr, format, args);  
      va_end(args);  
 }  
 static double test_device(uint16_t vid, uint16_t pid)  
 {  
      uint8_t resultat[2];  
      libusb_device_handle *handle;  
        
      handle = libusb_open_device_with_vid_pid(NULL, vid, pid);  
        
      if (handle == NULL) {  
           perr(" Failed.\n");  
           return -1;  
      }  
        
      r = libusb_control_transfer(handle, 0xC0, 0x04, 0, 0, resultat, sizeof(resultat), 1000);  
      if (r < 0) {  
           fprintf(stderr, "Error during control transfer: %s\n",  
                libusb_error_name(r));  
      }  

      libusb_close(handle);  
        
      return ((resultat[0] + ((resultat[1] & 3) * 256)) * 0.1 + 30);  
 }  
 int main(int argc, char** argv)  
 {  
      libusb_context *ctx = NULL; //a libusb session  
      r = libusb_init(NULL);  
      if (r < 0)  
           return r;  
    }  
      printf("%f\n", test_device(VID, PID));  
      libusb_exit(NULL);  
 }  

3.3 And some visual basic

Writing a Windows forms application in C++ turned out a lot harder than expected. It feels like Microsoft had never even intended that to go smoothly.
So I took an extremely ugly approach to call the above command line tool and read it's output into a visual basic windows forms application. The way I did that eats half the CPU power of a brand new i5 machine.
But I needed a quick solution. After the better half of a night of coding, I had a working version.

applause-o-meter GUI (German)
As you might see from the screenshot (German, sorry), the idea is to have three contesting pieces of music per group and three groups.
The audience can "vote" one of the three pieces of each group to be played fully that evening.

PS: The visual basic code is quite ugly and needs some tidying before publication. If you are in dire need of a clap-o-meter, please leave a note in the comments and I will make the code available regardless of it's shortcomings.


Intersting WS1361 links:


Wednesday, 19 September 2018

The weird and wonderful world of the WS1361 sound level meter USB driver

WS1361 / HY1361 sound level meter

When I had the need to build an applause-o-meter, I thought I'd go the easy route and buy a cheap sound pressure meter with an USB interface. What could possibly go wrong?
It is bigger than it looks here

About the meter

As seen so often, the identical meter appears under several manufacturer labels:
  • Hongyan / Hong Yan HY1361
  • Wensn WS1361
  • Unmarked HY 1361 (My device)
There is also a model with an Card slot on the market (WS1361C / HY13611). I didn't need recording, but I'll crack the device open some time to see if I can fit a SD-module.

I don't know any details about these meters:

  • Benetech GM1356 digital usb noise level meter
  • CHEER GM1356 digital usb noise level meter
  • Sinokit SK1356 
These look like the WS1361 with the exception that they have no card slot. The WS1361 card slot is sealed with the QC label. Please let me know if you have one of these meters. They might run the same protocol.
Then again, the Tondaj SL-814 also looks similar, but runs a serial protocol on what looks like a USB-Port. But it needs a cable with a prolific pl2303 chip to connect to usb. So a similar appearance can be misleading.


The tripod mount is a nice touch, especially since the case does creak when not handled carefully. Apart from better scaling on the LCD bar graph, I can't see any reason why I should change the ranges from the 30-130db setting. Neither the resolution on the PC, nor on the LCD changes like we're used to see on multimeters.

USB Driver issues

After ordering the meter, I did a little research and prepared for the worst: No signed drivers, proprietary protocol.... a nightmare.
Things could have been so easy if the meter had presented itself as a serial interface.

The device manufacturer's web site might be this one. With installation instructions here. And a software download page here.
The instructions include disabling driver signature enforcement. Not such a great idea.
So I decided to have a closer look.

USB Details

Ok, so the important bits are:
Vendor ID: 16C0
Product ID: 05DC

This Vendor ID is registered to voti.nl. Further research on shows, that the product ID had been reserved as "shared ID for use with libusb". Not a great choice for a consumer product. But then again not really a problem.

The same VID/PID seems widely used for the USBasp Atmel programmer (ISP).
That also explains why the .inf file in the driver is called usbasp.inf and why the .cat file's signature does not match the .inf file. Probably because whe whole driver set has been "borrowed" from there and modified.

New drivers?

While the sound meter's driver, as well as older drivers I found relied on libusb-32, the later versions available for the USBasp use libusbK in a version from 2015. Unfortunately the .inf is also not signed there.

Different approach - Zadig

So what it all boils down to is, that the above Vendor/Product ID pair needs to be associated with a generic usb driver. The driver disc that came with the meter had libusb-win32 on it.
There is another option beside having a signed driver. This is well known to everyone who tried using an RTL-SDR receiver on windows. - Zadig.
There are numerous versions of this floating around. Get the latest version from the Zadig web site.
Zadig
On my system, the WS1631 is instantly recognized. As the SoundLink software appears to rely on libusb-win32, choose that as the target driver for the WS1361. Zadig installs the driver without any complaints.

Success

And sure enough, the SoundLink software is happy with that:
SoundPCLink Software
As with many cheap Chinese instruments, the software ist very limited in it's abilities. So based on the fact that it uses libusb-win32, it should be possible to write my own code. There are some hints in the links below.

Intersting WS1361 links:






Friday, 14 September 2018

How to remove unwanted drivers from Windows 10

Remove unwanted USB device drivers (Win7 to Win10)

Why would you want to remove drivers from the Windows driver store?

I need to remove drivers on two occasions:

  • When I screwed up designing my own USB devices with v-usb
  • When experimenting with SDR (software defined radio) receivers

Locate the offending driver

Microsoft documents the process here. You need an elevated shell (admin shell). Both CMS and PowerShell are ok.
Type:
pnputil -e
This will list the drivers in the driver store.
The output should look like this:

Excerpt of pnputil's output.

Remove the driver from the Windows driver store

If (for argument's sake), this was the offending driver:

Veröffentlichter Name:            oem123.inf

Treiberpaketanbieter:   SDRplay Ltd
Klasse:                     Audio, Video und Gamecontroller
Treiberversion und -datum:   08/26/2017 5.22.11.11
Name des Signaturgebers:               Microsoft Windows Hardware Compatibility Publisher

The driver can be removed, using it's oemXYZ.inf identifier:

pnputil -d oem123.inf

This will remove the driver package from the driver store. If the device is busy, you can try the -f option to force the removal.

Reinstall driver

When you re-connect the device, it will prompt for a driver.

This procedure always worked for me when I need to start over with odd USB devices.

Thursday, 19 July 2018

How to fix shared folder permissions in VirtualBox

For my SDR experiments, I installed Skywave Linux in a VirtualBox VM. To transfer IQ files, I needed a shared folder between the Linux guest and the windows host.
Skywave Linux running in VirtualBox
Long story short: To allow the user "andy" (in this case) access to the shared folder, he needs to be in the "vboxsf" group. To add that user to this group:

sudo usermod -G vboxsf -a andy

Works a treat.

Friday, 15 June 2018

How to get rid of the canberra-gtk-module error

Canberrra GTK missing

This is more like a "note to self":

The Problem:

I'm running Ubuntu 18.04 in an Oracle Virtual Box for radio experiments with the FL2k VGA adapter.
Gnuradio complained about a missing canberra-gtk module in startup. But I already had the canberra-gtk3 module installed.

The Solution:

It admittedly is a bit of a shotgun solution. I simply did a:

sudo apt-get install libcanberra-gt*

and that was that.

Friday, 8 June 2018

How to receive pictures from the international space station ISS

Spacecom the easy way

Certainly the easiest way to get started with space communications is to listen to transmissions from the ISS' amateur radio station. Actually it is easier than setting up a satellite dish for TV reception.
SSTV Picture received from the ISS

Options

There are three kinds of transmissions that are easy to listen to:

  • Voice contacts, usually with schools. You will probably only hear the ISS, not the school, as the ground station will usually be out of your range and not use the downlink frequency.
  • Packet Radio / APRS. Needs noise-free reception to get anything at all
  • SSTV - Slow scan television. The word television might mislead the uninitiated. SSTV looks and feels more like colour fax.
All of the above are transmitted in FM. This allows very cheap equipment to be used for reception.

Equipment

A directional antenna would greatly improve the signal quality. My 4-element Yagi is currently stowed away in the garage (and has been for the last 10 years).

Settings


Simple SSTV setup
Settings for the Baofeng UV-5R:

  • The frequency to tune to is 145.800MHz
  • Set deviation (Option 5) "WN" to 5KHz, i.e. WIDE
  • Set squelch (Opion 0) "SQL" to 0, i.e. always open
  • Set to comfortable listening volume
Settings for the App:

  • Mode is PD120 (although PD180 has been used in the past)
  • Disable "Auto Mode" (see above)
  • Enable "Auto Start" (although it will sometimes be triggered by noise)
  • Enable "Save to Photos"
Out of phase - can be corrected in the App

When to listen?

  • There are several web sites and twitter users constantly sending updates when interesting stuff happens. Specifically for SSTV, I recommend the ARISS SSTV Blog.
  • The next thing you need to know is if/when the ISS passes over your location. The ISS Tracker Website can help there, so can the free GoISSWatch App for iOS.


Other options:

I tried receiving the space station with a SDR-RTL DVB-T USB dongle. This is fine for local ham radio repeaters, but  with the very poor antenna that came with it, the ISS barely left a trace in the spectrum.
A Sdrplay RSP2pro should arrive any day now with the mail. I'll see how that compares.


Received 2018-06-07

Legal Caveats:

In some countries, even owning ham radio equipment without an amateur radio license is illegal. Transmitting without the proper permit and knowledge of frequency assignments is not only illegal, but also extremely stupid. Get yourself a ham-license if you want to do that. It is worth the effort.




Friday, 6 April 2018

Resetting an Avaya Conference Phone 1692

Resetting the Avaya / Polycom 1692

The correct reset code for FW 1.4

To get it on the new phone system, I needed to reset an Avaya 1692 to it's default configuration. There are several versions in the manuals. None of them seemed right for the firmware our 1692 was running. What worked for me was:
  1. Hit the "Mute Microphone" key
  2. Type 2723825327# (= craftclear#)
  3. Then confirm the clearing-request in the dialog

craftreset# will only restart the phone.
Avaya 1692
End of the story:
The 1692 is not compatible with the new IPOffice pbx. 

Thursday, 8 February 2018

The all-you-can-possibly-want ESP8266 dev board


All-in-one ESP8266 module

I did a very simple 5-minute example project with this board. The video will be available shortly.
The video is available here now!

Overview

The somewhat unwieldly name "Wemos® D1 Esp-Wroom-02 Motherboard ESP8266 Mini-WiFi NodeMCU Module ESP 8266+18650 Battery+0.96 OLED" betrays a very complete ESP8266 development module, that boasts a load of features:
  • USB2Serial bridge (Silicon Labs CP210x USB to UART Bridge)
    If your PC does not automatically detect the driver, you find it here.
  • Power switch
  • LiIon charge circuit
  • 18650 battery holder
    Beware: the holder is too short for my favourite protected 18650 cells. These INR cells should fit instead.
  • "Wemos" labelled ESP-12F ESP8266 module. It does not look like a WROOM-02, though.
  • SSD1306 OLED display
  • 4-way + push "joystick"

Bells and whistles
The Wemos product page does not list a module like that, so it might not be their product at all.
The advertised product name:
Wemos D1 Esp-Wroom-02 Motherboard ESP8266 Mini-WiFi NodeMCU Module ESP 8266+18650 Battery+0.96 OLED does not really fit in quite a few respects.
Leave a note in the comments, if you know more about that.

OLED details

The OLD display is white-ish in colour. It works with the usual SSD1306 library. The protocol is I2C.

No surprises here.

The PIN assignment is:
  • SDA=GPIO 5
  • SCL=GPIO 4 
The I2C Address ist 0x3c, as it is common for these modules.

4-way switch

To interact with the module, this is super handy.
The Pin assignment is:
  • UP = GPIO 12  (=D6)
  • DOWN = GPIO 13 (=D7)
  • LEFT = GPIO 0 (=D3, FLASH)
  • RIGHT = RESET (!)
  • SELECT = GPIO 14 (=D5)
The RIGHT pin is a bit of a questionable choice. Then again the module does not have a dedicated reset button.

Caveats

I could not get the module to power up without a battery inserted.
People have reported that some components heat up when charging the batteries. I haven't noticed that yet.

IDE selection

I use the Arduino IDE on Windows whenever possible and the bare bones Espressif build environment on Linux whenever necessary.
  • Set-up of the Arduino IDE for ESP8266 ist >>here<<
  • For the Linux build environment, see >>here<<
In the Arduino IDE, I used "WeMos D1" as board type. and 4M (3M SPIFFS) for this module and did not have any issues with it.




Saturday, 6 January 2018

How to use a TTGO ESP32 module with OLED display and 18650 battery holder

TTGO ESP32 dev module

I got this very complete dev module from Banggood for review.


TTGO ESP32 Development Module

  Features:

  • ESP-WROOM-32 Module
    (=Wifi, Bluetooth, two cores)
  • USB to serial bridge with Silicon Labs CP210X Chip
    (supported by Windows and Linux)
  • Charge Circuit for an 18650 battery (backside of board)
  • OLED display (SSD1306 or compatible) I2C version
  • LED on GPIO16
  • power switch

Notes from my experiments:

IDE

It was no problem getting the module to work with both the Arduino IDE and a generic ESP-32 developmnent environment (as provided by Espressif).
I set up a dedicated virtual machine running Ununtu with VirtualBox under Windows 10.
For the setup I simply followed the instructions provided by Espressif.

OLED

Unlike on other ESP32 boards with OLEDs, the OLED's I2C SDA and SCL pins are connected as follows:

SCL - Pin 4
SDA - Pin 5

It does not require an "enable" signal on GPIO16 as suggested in some programs I found. So comment these out if you see them.


Power requirements

When I didn't have a battery inserted, my powered USB hub apparently could not provide enough power when I activated WiFi and the ESP32's brownout detection triggered.
I haven't investigated that further. Either my USB hub dies not provide enough power, or the board's regulator is too weak to handle the current.

Example Project: Web Radio

As my first project, I ran a very simple web radio firmware on the module. The code was easy to find here on Github. A six minute video of my 5-minute project is available on my Youtube channel here.



Friday, 5 January 2018

Firefox FF Protecter malware plugin

FF Protecter [sic!]

Wahrscheinlich jeder, der sich "mit Computern auskennt", hat eine nette alte Dame deren Bitte doch mal nach ihrem PC zu schauen er nicht abschlagen kann.

Scareware?

Allein die Tatsache, dass ich aus dem Hilferuf der Dame nicht schlau wurde, legte nahe, dass irgend eine Form von Scareware am Start war. Unmöglich das am Telefon vernünftig zu qualifizieren.
Also Kinder ins Bett gebracht und ins Auto gestiegen.

Scareware!

Schon der erste Eindruck war deutlich: Firefox hatte sich über den gesamten Bildschirm gelegt und allerhand obskure Warnfenster in etwas unbeholfenem Deutsch aufgeworfen:

Sehr hässlich!
Keines der Fenster konnte mehr geschlossen werden. Der Task-Manager zeigte keine verdächtigen Prozesse, der Firefox Prozess konnte über den Task-Manager beendet werden. Damit war der Spuk vorbei.
Ich checke in solchen Fällen zuerst mit Autoruns, ob Programme im Kontext des Benutzers gestartet werden. Administrative Rechte hat die Dame nicht.
Das ist auch gut so, denn im "Downloads" Ordner lagen einige suspekte Installer für "Recovery" Programme. Hätte die Installation geklappt, wäre die Situation unangenehmer geworden.

Plugins

Firefox startete nun zunächst wieder unauffällig. Aber nicht für lange: Nach wenigen Klicks poppte über eigentlich unverdächtigen Websites Werbung für Potenzpillen auf. Ein Indiz, dass die Ursache des Problems im Dunstkreis des Firefox liegt. Also mal einen Blick in die Plugins werfen...
Ooops... die installierten Plugins lassen sich nicht anzeigen. Offensichtlich schützt sich da ein Stück Schadsoftware selbst.

Safe mode

Also den Firefox mit gedrückter "Shift" Taste gestartet, schon war der Plugin Manager wieder zugänglich.

FF Protecter

Zwei Einträge passten vom Datum her sehr schön zum Beginn der Probleme. Beide Plugins nannten sich "FF Protecter" [sic!]. Nach deren Deinstallation gab es keine Auffälligkeiten mehr.

Eine Suche bei Google nach "FF Protecter" ergab keine Treffer. Die Suche nach der angeblichen Microsoft Support Nummer 08938034150 hingegen ergab, dass seit Ende Dezember 2017 mit Scare-Popups zum Anrufen bewegt werden sollen.
Was bei so einem Anruf passiert habe ich hier beschrieben.