Labels

Showing posts with label Windows. Show all posts
Showing posts with label Windows. Show all posts

Thursday, 5 February 2026

Python can replace BAT

 Intro

For a long while I have put up with the limitations of Windows antiquated 50 year old batch file system.  With plenty of trial and error I can set up batch files to do simple tasks but it continually frustrating that they have none of the capabilitiy or power of linux shell scripts (which are even older!).  I need some better way to control BEN2 processes and I foolishly thought to try PowerShell as an alternative.  As you would expect it is horrendous, a whole new useless language to help you dig into the cesspit of Windows.

It then occured to me to use python; after all it is a scripting language, windows friendly, easy to use and has an interface to the underlying Operating System.

Serial Port Control


The arses at Microsoft have seen fit to reduce serial port functionality in Windows 11.  Windows 10 shared ports quite happily with WSL programs.  By default Serial ports are now not available within WSL.  You need to install a program called usbipd from github to attach ports to WSL. 

The instructions are not trivial.  You have to identify the correct device in a list that usbipd gives you then "bind" and "attach"  it to wsl.

This isn't something I am capable of doing within a batch file.


Python

Our python script first reads in output from the command "usbipd list" to see if it can find the COM port, which will be labelled as "USB serial converter".
If we find it we capture BUSID and STATE values for that line.

Once we have these values we can attach the device (BUSID=3-3) in this example to WSL.  The bind command only has to be done once so we dont issue it every time in the script.


Outro

Note that the BUSID can change depending on what is attached to the PC.
Also, although device 3-3 is called COM3 in Windows it is called /dev/ttyUSB0 in WSL.
Windows doesn't help me with working this out.

A very irritating situation :(



Wednesday, 24 September 2025

ATHENA Configuration 1

Previously I described my purchase and installation of ATHENA, my Geekom mini PC.  My first action following installation was to setup RDP so that I could access FREEDOM, my existing primary Windows 10 PC, since there isn't anything much I can do with the new PC except access the old one!

As I suspected it is taking me a long time to move over apps / functionality to ATHENA.  Details of all the installations would be very very tedious so I shall limit myself to points that I find interesting and others may find merely very tedious.

RDP (Remote Desktop Program) is great to avoid the need to switch over keyboard/mouse/screen.
However to make it even  easier I setup WOL (Wake on Lan).  This is a tiny utility which sends a magic packet to power on another computer.  I told it FREEDOM's MAC address, so that when I click on the associated icon FREEDOM starts up - without me needing to rummage under the desk.
Once the PC is turned on I can click on the RDP icon to use it.
This means I no longer need a screen, keyboard, mouse attached to FREEDOM.
I have another (noisy) Win11 mini PC called PICO which I also setup for RDP.  I now have a practical single desktop for my Windows Environment.


Ideally I would like to move away from MS-Office.  Excel is great, Word is a pain and Outlook is pretty useless.  However it is too much effort.  I was going to migrate (remove and install) MS-Office 2019 from the old PC, but found that I could buy a new activation key for £10 - so that it what I did.  



I setup WSL2:Ubuntu for linux access and setup SSH and Shares to access my RPI storage.  I also shared the legacy PC disks so that I can easily transfer data across.

One of my own main apps is my Art Library / slideshow.  It is an RPI web application written in Javascript/HTML which uses a MariaDB SQL database to organise picture information.
Although the webapp, database and pictures are stored on RPI I need some PC apps to manage the system.  My old HTML editor is obsolete now, so I set up a new one WebStorm which seems very good.  I installed a new instance of Heidi SQL on ATHENA so that I can update the image database and I copied across my master picture Library to ATHENA so that I can edit and move pictures to the RPI.
I have installed Irfanview to manipulate the images, it appears more popular than Fastone, which I used previously.



Removing Bloatware

When I first started using Win11, I found the constant adverts, popups very irritating.  I round a random article in The Register which provides some quick fixes.  Now I don't have Windows telling me about the picture it has chosen for the lock screen and I dont have news flashes disturbing me.
Microsoft still try hard to make me use OneDrive and Office365, Edge and Copilot, but I can cope.
 

Windows 11 Features

There isn't much improvement, moving from Windows 10 to Windows 11.  I  have listed here what I have noticed so far:
1)    The Phone Link app is great, it allows me to use many phone functions on the PC and makes transferring photos across very simple
2)    File Explorer has tabs so that you can view multiple folders in one place, I always lost track of them as soon as I needed two or three open
3)    When switching between virtual desktops, each desktop can have a different screen background, so you can see where you are at a glance.

Monday, 11 August 2025

Geekom Mini PC

 

I have been considering a new PC for a number of years but I haven’t had a compelling reason to upgrade: I can install and use any apps I want to on my current / old PC FREEDOM; it is powerful enough for most software I use; it is a lot of work to change over; new ones don’t have features I desire.

However FREEDOM, is becoming less reliable: it needs to be booted twice to restart; recently it has had a few “blue screens of death”; a few programs such as 3D manipulation can be slow; it isn’t Win11 compatible…

I decided to make a quick decision on a new PC.  I have been keen to buy a new small PC from inside-tech but their small ones aren’t very attractive.  Currently there are plenty of adverts for a number of mini-PCs. My main requirements are:

·         Small size
·         Silent operation
·         At least 2GB SSD C: drive
·         Preferably a second SSD drive
·         At least 16GB memory
·         Allow 3 monitors
·         Win 11 Pro

Geekom have a good range of mini-PCs and appear to be widely used.  Most, but not all, reviews seem positive.  They are available from Amazon and directly from Geekom.
Since this is a rare and important purchase I am not too concerned about price – it is going to last me a long time.  Looking at the options, purchase with a 2GB SSD was a limiting factor.  I chose the IT13 as it seemed most appropriate for me.


I ordered the PC on 3rd July and it was delivered the next day.  It is as small as it seems, it feels sturdy and looks good.  If appropriate I can attach it to the rear of a VESA mount so it wont take up any space.

For me the most important test is silent operation.  When I turned it on the fan started but after a few seconds, at mostly thereafter it is beautifully tranquil.  It has passed the first test with flying colours.
I connected up two HDMI screens, wireless mouse and keyboard and I now have a useful system.  She has been named ATHENA after the powerful and wise Greek goddess.

My first action was to setup RDP so that I can use FREEDOM from ATHENA seamlessly.  This gives me access to all existing functionality whilst I change over to the new system which I expect to take a number of weeks.

My verdict is that I am happy with the new hardware.  I couldn't ask for more.  Windows 11 remains irritating whilst Microsoft "features" try to push Edge, OneDrive, Office365 and their horrible widgets .
In a next episode I can say how configuration and migration turn out. 



Saturday, 5 April 2025

PC : End of Life Kicker

My Windows PC hardware is becoming quite venerable.  Back in April 2016, just before I left work I purchased a HP Pavilion 550 which had a reasonable specification: I5 processor,  128GB SSD and 2TB hard drive, 8GB RAM and Window 10.

It broke down after 4.5 years in December 2020 and I considered upgrading, but honestly there was nothing better to spend my money on.  Instead I purchased a re-conditioned HP 800 G1 desktop with a very similar specification for £200.  The HP 800 G1 first became available in 2014 so it now about 10 years old.




Back in the olden days it was necessary to buy a new PC every couple of years and my bench mark was to spend £1,000.  As Windows and software products increased their processing requirements a computer would soon begin to feel sluggish and need replacing.  Clearly this is no longer true as both my existing and previous computers date from about 2015 and aren't lacking in specification.  In fact both the HP Pavilion and 800 G1 are still available to purchase refurbished on eBay for around £60.
Over that time period processors have not become significantly faster, instead they have many more cores/threads and can handle more simultaneous activities but I believe, for most people, that isn't really necessary.  For me there are only a few areas which feel slow: compiling FPGA images (Quartus), compiling guest Operating systems (linux guests) and 3D modelling software (Autodesk).
The two hardware factors which do make a difference are SSDs and memory capacity.  An SSD for the C: drive is vital to prevent the OS chuntering away for ages. Plenty of memory needs to be available as applications (particularly chrome) gobble it up and it is usually best to keep many apps loaded.

Both these PCs run Windows 10 and neither of them has the TPM 2.0 hardware required to run Windows 11.  As yet there is nothing in Windows 11 that I might need to use.
Windows 10 support, including security fixes is supposed to be terminated in 2025 as Microsoft try to force people to upgrade their PC and OS.  You would have thought that after 10 years there are no more bugs to discover but I guess there are!

The title of this post is "EOL kicker" and the reason for this is C: drive space.  Previous PCs have 128GB SSD C: drives which seems quite a lot.  However, software tends to be installed on C and uses it for data storage.  Over time I have tried to move files to D wherever possible and each time C fills up I look for more opportunities.
However, I finally gave up looking for more ways to save space and purchased a Crucial 256GB SSD  for the princely sum of £16.  I have used Crucial drives before and really like the software and instructions to copy and replace a system drive.  It only takes a few minutes work and an hours copying time.


I hope / believe my problems are now over, at least until we see what happens in October as millions of people moan at Microsoft.  In fact I have a little sympathy for Microsoft in this respect, they have done a good job keeping the software working for ten years - without me (and others) providing extra revenue by upgrading our systems.




Thursday, 1 August 2024

Space Desk : A Touch Screen for Windows

 It is very rarely that I find a computer gizmo which is truly amazing.  Spacedesk falls into this category.

1) Install the DRIVER app on your PC

2) Install the VIEWER app on your iPad

3) Connect the iPad to your PC

Five minutes after you started you have an extra screen on your PC and can drag some apps across to them.  Here is my windows explorer session.  Wow 😀


I still use a traditional PC with screen and mouse, I haven't moved forward/sideways to touch screens for Windows.  However, my iPAD is now a TOUCH SCREEN.  I can click on a file to open it etc.


😂Awesome 😂

Saturday, 2 April 2022

WSL2 and Windows Terminal

 There are some good reasons for using Windows Subsystem for Linux (WSL) version 2 over WSL version 1.  Unfortunately I cant remember what they are at present.  I do recall some frustration in the past when it wasn't available to me.  Anyway, I spent a short while yesterday setting up WSL 2, which turns out to be very easy .  WSL2 provides a VM with a Linux kernel as opposed to WSL1 which uses an Ubuntu flavour with Windows System Calls, so WSL2 should provide a more "real" linux experience.  I installed a Debian flavour VM to run WSL2 and I was pleased to find out that I can run WSL1 and WSL2 alongside each other as I don't want to redo/convert/check what I have done before.  I had a minor bug to investigate / fix before the Debian distro could be converted to WSL2 but once completed the distro looked fine.

As an afterthought the WSL2 tutorial recommends Windows Terminal - they are quite right; it is is an excellent addition to my environment.  It is open-source software which you can install from the Microsoft Store.  At its simplest it provides a tabbed window which allows you to run a number of Windows Command line and Powershell sessions.  As I have WSL1 and WSL2 configured it automatically provides me with the option to start WSL1 and WSL2 sessions.  Already it sounds good.

Even better you can easily customise its configuration using the settings.json configuration file.  Until now I have used WSL for RPI and RISC-V SSH sessions and Putty for RISC-V console and Arduino serial port sessions.  However, within a few minutes, I was able to customise WT allowing me access to all these systems as tabs in a WT window.  RISC-V console sessions are the easiest, they just use Windows cmdline SSH.  I have set up keys in WSL1 for my Raspberry PIs to for passwordless sign on so I use a WSL+SSH command line to start RPI sessions.  For Serial ports we use minicom running on WSL1 to access COM ports courtesy of a helpful tutorial by Scott Hanselman, and I can use a WT WSL1+minicom command to start the consoles.

This is wonderful, I have all my terminal access in one place, working seamlessly and easily configurable.




Wednesday, 11 August 2021

Windows 10 Pro

Why

One of the good things about using RPis is that we can SSH into them remotely so it is easy to use multiple systems for different purposes with a single screen (or two) and keyboard.

I am planning to purchase a new PC but I am not looking forward to it  because of all the tasks involved in switching over from the old one.  It would be much simpler and satisfying to run old and new in parallel.  I could set up the new PC and transfer over important and frequently used applications and data.  There are lots of apps, data, configurations on the old one which I probably don't need and I could leave them in place initially.

Unfortunately running two Windows PCs with separate screens and keyboards is a pain.  They take up a lot of space and aren't convenient to use.  I could use KVM style screen / keyboard switch but good ones are expensive and I find them messy.

I could use TeamViewer, splash top  or VNC to access the old PC from the new one.  In the past I have found them a bit clunky but that is probably my lack of familiarity.  However I decided to try Microsoft Windows Remote Desktop which I would hope is well integrated.

How

To use RDP I need my existing Win10 PC to be running Win10 Pro.  Win10 Pro doesn't have many useful features but RDP and bit locker disk encryption are good.  

Buying direct from Microsoft is quite expensive but a quick Google showed me that there are plenty of third-party suppliers who can provide a product key for about £20.  These sites can be dodgy so I picked one called unitysoft, which has an office address and support available.  On purchase I received a product key and some straightforward instructions.

All you really have to do is change the product key in Settings > System >  About.
The computer then spends a couple of minutes reconfiguring existing software so you have Windows 10 Pro.  You can check this in Settings > System > About 😀😊😊

To access the PC remotely just download the Microsoft Remote Desktop app onto Macbook, iPad etc and connect to the system with your current userid and password.  If you are logged on locally you will be logged off.

So

This is wonderful, just what I always wanted.  I can install my new PC, transfer over what I want to it and leave the old box in the corner connected to network but without screen / keyboard.  If there is something I need over the next few months (and there will be) I can turn on the old PC and sort it out.

In the example below you see my lovely Macbook M1 with a Windows Remote Desktop.  Normally I would run it as a full screen, but this shows the Apple background and apps as well as the Windows desktop.  At the moment I am debugging a 6502 program with my board attached to the PC using a COM port.  I can sit in comfort with no cables or hardware attached attached to my Macbook and happily use Windows functions. Bliss.



Sunday, 21 March 2021

C graphics programs

 For some reason I had a sudden urge to work out how to write graphics programs.  The natural place to start is on Windows.  I have Mingw installed so I can run X11 programs, in particular X11 programs written under WSL can be run in a window.  The Xeyes sample is shown in the screen shot below.

I also have code::blocks installed so I had a quick look at whether it could do anything for me.  C::B includes a number of openGL related templates.  I tried the openGL template first, it compiled cleanly and gave me a lovely rotating triangle.  I then tried to use GLUT which is mentioned in a number of Google articles on the subject.  GLUT is obsolete and replaced by freeglut which needs some tweaking to get working under C::B (directions provided by GeekforGeeks). Again it provides a lovely demo, in this case some pretty wire frame demos.

In summary I have some great tools at my finger tips when I get an urge to actually write graphics programs.


Shortly after finishing this little investigation on how to write C graphics programs, I stumbled across HTML5 Canvas which provides you with space in your web page where you can put graphics.  The graphics commands themselves are written in javascript.  This is definitely an easier way of doing simple graphics.  A bit of cutting and pasting and I could do a sample on my website.




Wednesday, 15 April 2020

Tiny Core Linux

Intro

Recently we have looked at Linux in a variety of ways.  Buildroot has been used to tailor and build a distribution, we have compiled Linux to run on the Atlas board, we have created many different systems on Qemu.  Along the way I came across Tiny Core Linux (TCL)  which provides a Linux system in 11MB. Kudos to Robert Shingledecker who developed it in 2008 and those who have supported it since then.  It has an extensive user manual and an active forum.

Core System

The simplest variant of TCL is called Core.  This comprises two files a recent linux kernel (5.4.3) and core.gz a compressed file system.  It is available as an ISO.  I could quickly boot from the iso file in Qemu and bring up a small system.  It looks like linux, feels like linux and quacks like linux.

PiCore

A version of the system has been provided to run on RPi.  I simply copied the iso to an SD card and booted on my RPI 1B.  It comes complete with network access and SSH.  Initially I connected a screen and keyboard but it was soon reliable enough to run headless.

TinyCore

The next step is to setup a windows manager FLWM (fast light windows manager) so that we have a working X system.  Again we have a small amount of software.  Using X under Qemu was a bit of a pain and I don't want to use an RPi like this so I installed on Roy's old laptop.  A 2GB partition is vast overkill for a system which is now about 50MB but it enabled me to run some variants.

Linux Structure

The irresistable attraction of a tiny system is that it is small enough to have a crack at understanding the overall makeup of linux.  The TCL manual was a big help as it describes the boot process initiated by the kernel which lays out the file system, sets up devices and hands over to init which is part of busybox.  Init provides utilities for all the processes running on the system and makes requests to the kernel where necessary.  Applications / programs can be added as necessary but aren't essential for a running system.  TCL minimises the ones provided by default but has a good variety of extensions available for download and install.
So we really just have the kernel, Busybox binaries, some libraries and a few start up scripts which make up our system.  As the icing on the cake Busybox has a link to Fabrice Ballards, linux in a browser running busybox.

Monday, 11 February 2019

XWindows on WSL

I generally use linux headless as the functions I need can be initiated and controlled from the command line.  It occured to me that there are potentially some GUI functions which would be useful and my initial reaction is to have an RPI build with a desktop.
However the idea is very uninspiring and it then occured to me that using Xwindows software on Windows I could get GUI sessions without an  RPI desktop.
Xming provides a simple popular solution which works as expected.
Mobaxterm also provides an Xserver which is integrated into its other functions.

Clearly an Xwindows server is not much use without software.  As my RPIs dont have desktop programs installed I cant do much with them by default.

It occured to me that WSL (Windows Sub-system for Linux) would be much better as a source for client applications at least for playing/testing.  WSL doesn't include a GUI so Xming Xserver can be used on Windows show windows, the server should be started automatically at startup or before using any sessions.    
To get a terminal window you can use Putty.  Simply create a new putty session and in Connection>SSH>X11 tick "enable X11 forwarding" and specify "X display location" as localhost 0:0.  The connection userid and password are john/secret. 

WSL doesn't have any GUI software either so we have to install some for testing. I found this article very helpful.  I can get some sample GUI programs by installing x11-apps.  Before I did that I had to do an apt update/upgrade on Windows and this took a couple of attempts and quite a lot of CPU time for installation.
Once x11-apps is installed I can add "export DISPLAY=:0" at the end of .bashrc.
xeyes is a nice first program and xclock is useful.
I then installed a terminal window (xterm) and editor (gedit), both of which required significant further software additions to WSL.

I now have a basic useful Xwindows system to use a basis for understanding better how it works.

As I run RPIs headless I dont have x-windows installed  cant run x-windows based programs.  However as I now have x-windows on Windows-10 and x-windows is famous for being able to run windows on remote machines.
1) On Windows-10 WSL install x-utilities: apt-get install x11-xserver-utils
2) On Windows-10 WSL permit RPI to start sessions:  xhost +
3) On RPI install some x-windows apps: apt-get install x11-apps xterm
4) On RPI command line send remote display: export DISPLAY=192.168.0.5:0
5) On RPI command line run x-app: xeyes &
6) App now runs and displays a window on Windows-10
I tested this successfully with paprefs, which is one of the programs I have "missed"
This article maybe useful





Monday, 17 September 2018

Floureon Pan Tilt IP Camera

Why?

A floureon Pan Tilt wifi ipcam only costs £20 on eBay.  I was intrigued whether it would be any good and whether I could control it from RPi based software.  It echoes my first linux project challenge from 2002 when I had a logitech webcam controlled by an Eagle Pan Tilt mechanism and used it at work to see whether my program to turn a  home light on and off was working.
I am not sure what I would use this for - I think I will just experiment with it and see what I can make it do.

Installation

A short but helpful pamphlet tells you how to set up the webcam.  You download the CamHi app to an iPad or Android device first.  You then add a camera.  The install procedure can find the webcam through wifi and you then put your phone next to the camera and it has an audio hand-shaking procedure to link the app with the phone - it sounds somewhat like old modems talking to eachother.
The app shows you a webcam feed and you can swipe up / down / left / right to move it - however it is very ungainly.

Documentation on the floureon website is rather sparse but contains useful info on features.
Motion tracking, IR and two-way sound all should be investigated.  It says that the movement controls have no lag but that was not my experience.  
It says that the windows client is CMS software.  I downloaded what seemed the appropriate software from the website but I couldn't get either utility, DeviceViewer or SriCam, to see the web cam.

There is an option to check for firmware upgrades, so I upgraded firmware.

Extra Software

I looked briefly at ISpyConnect to see if that would work on windows.  It has some good documentation and I managed to get the URL rtsp://hostname:554/11 to view the video feed.  It seemed a bit cumbersome to use so I installed a nice utility anycam instead.  I could also see the video feed using vlc with this url.

Other URLs which work are rtsp://hostname:554/1/h264major (in VLC) and http://hostname/tmpfs/auto.jpg in Chrome.  The directory tmpfd/* is visible in chrome but doesn't have much of interest in it.  However it does confirm that the webcam contains an embedded linux server.

In fact I found that http://hostname/ gives access to an inbuilt webserver and also allows pan / tilt control.  The buttons remain pressed whilst you click down on them.  Unfortunately there is a 2 second lag on the picture update so it isn't practical to adjust the camera this way.  However there are 8 presets which can be used to set positions and you then "call" them.  In practice this should be enough.

Using Chrome Developer tools you can look at the programs used on the webserver.  I managed to copy all the files I could find down to a Windows folder to see whether they would work locally.    The server uses flash to show video in the browser and I couldn't (easily) get flash to work locally on my Windows PC running video from the IPCAM.  However I did see that the site is written in html/css/javascript.
In particular the commands to control the webcam work through cgi.  Thus I can move the camera left a bit using http://hostname/cgi-bin/hi3510/ptzctrl.cgi?-step=1&-act=left.  This would allow me to set up webcam control very easily.  Googling hi3510 gave me a list of commands that can be used.

Verdict

The camera gives a very nice picture but the lag is quite irritating when you are in the same room.  It would be simple to setup a web page to control the camera and keep the image in a separate session in vlc or anycam.
It would also be easy to setup periodic room scans.
It is also an amazing package a pan-tilt camera accessed via in built webserver for £20.


Wednesday, 6 September 2017

Windows Sub-system for linux

Windows Sub-system for Linux (WSL) was released about a year ago as a new feature for Windows 10 64-bit.  It is the result of a partnership between Canonical (makers of Ubuntu) and Microsoft. WSL implements a linux userspace which is based on Ubuntu linux binaries. So the file system (/usr, /lib, /home etc) is very familiar and you can use linux commands (cp, grep, apt, gcc).  When you first enable WSL you run apt-get update && apt-get upgrade and install other packages just as you would on any other system.
Win10 provides the kernel functions, Microsoft don't use the linux kernel, instead the Windows kernel is invoked to carry out those activities.  This means the overheads are much lower than those provided by a Virtual Machine which needs a linux kernel and an extra layer of software to translate to Windows.  On the downside, any kernel functions that Microsoft haven't implemented can't be used.
WSL is intended to provide linux command line rather than a graphical interface. You access WSL by starting a bash shell, a very similar experience to opening a cmd command prompt.  You can then use bash and linux functions as normal (using exe's provided by Canonical).  You can access and write to Windows using mount point /mnt/c.  You have your own copy of the linux filesystem in appdata/lxss/... but you should not write from Windows into the linux filesystem.
Installation is just a matter of enabling the WSL feature.
A very informative 20 minute video by Scott Hanselman provides all you need to know to get started.

Tuesday, 5 September 2017

Cross-Compiling using WSL


Almost by accident I found this weblog by Eswar Prakash which describes how to install a linux sub-system under Windows.  He provides a very clear explanation and comprehensive instructions to create the environment, install and update software.  Once the Linux subsystem has been enabled in Windows it looks very realistic to me.  linux directory structure is in the usual place, I have /home/john to store information and I can use standard linux commands (e.g. df, apt-get, ps -ef).  Windows C: and D: are mounted as /mnt/c and /mnt/d so I can move information between linux and Windows.
The gcc compiler works fine as an assembler for me as well so I can create kernel.img for Baking Pi tutorial with:
arm-linux-gnueabi-gcc -c main.s -o kernel.img -mcpu=arm1176jzf-s -mfloat-abi=soft
As previously I can load kernel.img onto my RPi and run the program with an OS.
I think this is wonderful, I have the power of linux with the ease of a command prompt and there isn't a learning curve to get started.