Welcome to my blog, starting again!

Dear reader,

Welcome, nice to see you found your way here. I haven’t been writing blog for quite some time. I have had life and living, and I have been working in  a job that gives basic life support, in exchange of too many hours of being present in the office.

I’m testing AI assistant at work, but I’m not going to discuss work related subjects here or elsewhere, because I’m under non-disclosure agreements.

Instead, I will discuss things that I’m interested in, that is technology including embedded systems development, software programming, AI usage, extending at times to electronics, requirements and even project management.

I have a started an electronics DIY project, which I intend to make in a professional but fun way. I wish to write weekly.

See you in the next post! 🙂

 

FIX: [Android build error] Failed to notify project evaluation listener

Context

I picked up some quite recent Android sample code, and it failed to build with the error message:

Failed to notify project evaluation listener. 
> org.gradle.api.file.ProjectLayout.directoryProperty(Lorg/gradle/api/provider/Provider;)Lorg/gradle/api/file/DirectoryProperty;

Context

Android Studio 4.1.1 / Korlin 1.3.21 . The answer not wasn’t found rightaway anywhere so far… so I decided to post here for someone to find.


Solution

In the high level build.gradle, update Gradle version to the latest! In the case:

buildscript
{
...
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
...
}
}

Then, if and when the Android Studio GUI prompts for Gradle plugin update, run it then to get to 4.1.1 and beyond.
For me, it did not work just by directly changing the com.android.tools.build:gradle to 4.1.1 directly!

If your PowerPoint is slow, check this

The problem

My wife was editing a PowerPoint document with a new template made by someone else and experienced slowness in editing. When typing, one had to wait the effect of action or every key press for seconds, because loaded had sudden 100% peaks. No, this was not about any sluggishness of the computer.

A quick search in the Google produced a list of problem candidates:

  • Uncheck spelling check => Uncheck spelling as you type
  • Incorrect printer driver => Too much trouble to try
  • Enabled hardware graphics acceleration => No it was not enabled for Intel Graphics
  • Shading and transparency on slide master => Looked prominent, no effect
  • Potential incompatibility with Mac and Windows versions => Correct and compatible set of fints were used
  • Graphics on slide master, put in a wrong way => How can you find these?

To save you from too much suspense, the last one was the actual culprit!

How you can avoid it?

Mitigation

In the Home tab, there is a Slide preview (thumbnails(/ Outline column on the left, which may as well be hidden behind the left edge. Take it visible and select Outline! because then no computing power is wasted drawing thumbnail pictures of every slide.

You may also choose to Hide background graphics in the Slide Master.

Best fix

But the above only mitigate the problem, they don’t remove it. In the case the above tricks helped, the root cause is likely to be bitmap graphics objects in the slide master. If you have taken a .jpg or .png picture and inserted it as a graphic object in the Slide Master or any of the Slide Layouts, that was a wrong thing to do. Instead,  you should use Format background > Picture or texture fill > From file.. . Then select the picture file to insert as the slide master background and adjust the stretch settings as necessary. You’ll want to press “Apply to all” to set the background of all slides.

This way the background doesn’t charge load to thumbnail view. In the case you want to set a different background to individual slide, you can insert the graphic object to the slide and send it back of other objects.

Why did it happen?

My theory is that the slide thumbnails are generated in a such way, that first the slide master base is rendered once to thumbnail and used in all. Then the additional  objects in the slide master and the slide are rendered individually for each slide. Rendering a miniature version of a bitmap of size of a full slide is a quite heavy operation, and the operation will be executed for each and every slide.

Is it a bug?

I consider this as an unconvenient feature, not really a bug. Everybody should educate themselves how to use tools correctly, not just use them.

Watch TV on PC, using VLC and old ARTEC T14BR DVB Stick

Watch TV on PC, using VLC and old ARTEC T14BR DVB Stick

Background

I was looking for something in the storage of my archived gadgets (i.e. in my junk boxes), and I found the precious Artec T14BR. It’s a USB stick with a digital TV tuner (DVB-T) capable of one channel in Full HD at a time. It’s over 10 years old now, and I wondered, if it’s of any use now. It turned out that it works great to watch TV on PC! Too good to throw away, but probably you won’t get these as new anywhere.

My system config is here quite irrelevant, but anyway, it’s a desktop with i7-4790K and GTX 950, so it’s not presenting any limitations for watching TV. The operating systems I have are Linux Mint 18.3 and and updated Windows 10.

After some research (trial and error), I found that the free VLC media player was a very good option to view TV, in addition that it can also view video and playback audio.

Setting up Linux – as if everything worked like in TV

Plug the DVB-T stick in a free USB 2.0 port, preferrablu with a shor extension cable to reduce PC created RF interference to reception, and checked if it can be found with command line:

$ lsusb
...
Bus 003 Device 009: ID 05d8:810f Ultima Electronics Corp.

In order to access the stick and view tv, one needs some tools: VLC the VideoLAN media player and w-scan to scan TV channels.

sudo apt-get install vlc
sudo apt-get install w-scan

Then, you can make a channel configuration file with w_scan. It has the option -L to make a file suitable for VLC. VLC will digest the produced .xspf as a playlist. Option -c ES stands for country, and here it’s ES fro Spain, GB for great Britain, US for United States of America, DE for Germany, Fi for Finland and so on…

$ w_scan -c ES -L > ~/tvchannelsvlc.xspf

Then you can start VLC from command line like:

$ vlc ~/tvchannelsvlc.xspf

You may want to create a launcher for your new VLC TV. Just right click desktop, pick “Create new launcher” and copy and paste the above command line to Command.

Usage hints

You can change channel via the right-click menu: Playlist, and there you have the channels you found with w_scan.

Watch TV on PC
Playlist menu that contains pre-tuned TV channels.

If it didn’t work

Well, the DVB-T stick needs a couple things. The antenna signal and connection must be good, it’s not. I improved mine by making a very short cable of about 1 m, just enough to reach nearest wall outlet. The signal quality may also improve by placing a short USB extension cable between the stick and computer, in order to reduce RF interference.

VLC auto-tune doesn’t work too well

It seems that VLC has also a possibility to auto-tuning, setting frequency to 0 kHz, but I did not get it to work well; a list of channels were found, but the scan got stuck at 66% and I had to cancel it. Then, only the first channel found was operational.

Kernel Configuration Issues

Modern Ubuntu-based linux kernels seem to have driver modules readily available for the DVB-T stick DiBcom 7000PC, that has the USB id 05d8:810f.  Here’s some information on my configuration with Linux Mint 18.3 64-bit. I had some related kernel modules in place:

$ lsmod

...

rc_dib0700_rc5 16384 0
dib7000p 40960 1
dvb_usb_dib0700 151552 12
dib7000m 24576 1 dvb_usb_dib0700
dib0090 36864 1 dvb_usb_dib0700
dib0070 20480 2 dvb_usb_dib0700
dib3000mc 20480 1 dvb_usb_dib0700
dibx000_common 16384 3 dib7000p,dib7000m,dib3000mc
dvb_usb 24576 1 dvb_usb_dib0700
dvb_core 122880 2 dib7000p,dvb_usb
rc_core 36864 4 dvb_usb,dvb_usb_dib0700,rc_dib0700_rc5

I hope this helps, DiB7000 is the DVB-T device in Artec T14BR. If you build your own kernel these are part of CONFIG_DVB_DIB7000P. The modules with rc are related to remote controller.

How about Windows 10, would it work there?

As I have a dual-boot machine, I checked out if I could get it work just like that, with the same hardware. Yes, that was also quite easy.

You can see the ARTEC device there, but Windows 10 does not include drivers. Ultima Electronics that made the devices is nowhere to be found. The drivers can be found in the “minefield” sites sites, where you will stumble to possibly unwanted downloads of unnecessary driver updaters. You can find decent drivers for ARTEC T14BR from Driver Scape and Softpedia. Do yourself a favour and don’t download a driver updater,  nothing from the Ad immediately below.Just keep focused to download the right item, the T14BR drivers archive file.  It’s a oddly named .zip file that contains:

  • mod7700.cat
  • mod7700.inf
  • mod7700.pnf
  • mod7700.sys

Unpack the files with File Manager and  use Device Manager to update the drivers of the other device “ARTEC”. Search the location where you unpacked the .zip to.

After reboot, VLC will find its as a capture device!

Comments on other things I tried

On Linux there are a couple of other pieces of software that can be used to view TV from a TV stick. My experiences weren’t very positive, so I’d say that VLC is the easiest one to get along with.

  • Me-TV is great, just install and tune, worked “out of the box”. However, HD channels got no audio in my set-up.
  • MythTV is a digital personal video recorder. It is not designed to use as just a simple TV viewer, it is horrible to configure, as it has separate frontend and backend, and requires installation and configuration of MySQL. It also tends to pop up as a full screen app without no handles to make it smaller, so it is more suitable for stand-alone one-purpose PVR machines, not for general desktop computers.

Ubuntu 20.04 (Focal Fossa)

It won’t work right away, but for the use of Snapcraft, vlc must be connected to dvb. Maybe that’s a security thing? One line in command line is enough:

$ snap connect vlc:dvb :dvb

Update 27.1.2024: Linux Mint 21.3 and still working

I found the dongle again in my drawers. It still works, as described. BTW, I corrected a typo in a command above. Nobody had commented it, so nobody had read it…

One can also wathc IP TV with the client Hypnotics, and it has quite many (1648 at the moment) pre-installed channels. It’s simple to use, out-of-the box

Part 4, Install Scanner Server

– How to add WiFi to a multifunction printer using Raspberry Pi –

PART 4: INSTALL SCANNER SERVER

In the previous part we configured the IP address of the Raspberry Pi. In this article, instructions are given to install scanner server software SANE. Configuration makes it accessible from the local network.

23) Install internet daemon xinetd

sudo apt-get install xinetd

As a result, your has the better intenet daemon, which makes managing sevices provided via sockets easier.

24) Install Scanner server software SANEwith some utilities

sudo apt-get install sane-utils

The package contains sane utilities including saned SANE daemon.

25) Installing scanner server requires to add / edit new udev rule for scanner, to enable access:

sudo nano /etc/udev/rules.d/65-libsane.rulesprinter

contents of the new rule line:

ACTION==”add”, ENV{DEVTYPE}==”usb_device”, ENV{libsane_matched}==”yes”, RUN+=”/bin/setfacl -m g:scanner:rw $env{DEVNAME}”

26) find path of saned

which saned

Presuming, it is /usr/sbin/saned , as it shoud be with Raspbian Buster Lite

27) Check that saned is added to services

sudo cat /etc/services | grep sane

EXPECTED OUTPUT:

sane-port 6566/tcp sane saned  # SANE network scanner daemon

28) Add saned to xinetd config, so internet daemon will listen and provide sane-daemon service:

sudo nano /etc/xinetd.d/sane-daemon

Add/Edit contents to:

service sane-port
{
  socket-type = stream
  server = /usr/sbin/saned
  protocol = tcp
  user = saned
  group = saned
  wait = no
  disable = no
}

29) Edit sane daemon config, adding your current wlan subnet as permitted.

sudo nano /etc/sane.d/saned.conf 
# Leaving only uncommented line as
192.168.1.0/24

30) Add user lp to saned group 

sudo adduser saned lp

31) Enable saned socket to receive and send

sudo systemctl enable saned.socket
32) Check saned socket status

sudo systemctl status saned.socket

33) Get free client software: SwingSane

I recommend SwingSane. It is quite functional. Eve so, on Windows the custom scanning settings had to be used always to get good scanning results.

Color mode and resolution 200 (dpi), br-x 215, br-y 297
Working Swing Sane Custom Settings

Install SwingSane to a client computer. Then, configure it by adding new scanner by IP address. In this point, you can give it any name you want. The Remote Address is the address of the Raspberry Pi, and the SANE port number is 6566. 

34) Do a test scan

As a result, of the installs and configuration, you should have now a printer – scanner with a WiFi connection, that can be reached over the wireless local area network.

I didn’t make this all up by myself. Some partial instructions were helpful. Therefore, I give them credit and backlinks:

How to add WiFi to a multifunction printer with USB using Raspberry Pi – Part 3, Set Fixed IP Address

PART 3: SET FIXED IP ADDRESS

In the previous part, we configured the printer server, now we may want to set a fixed IP address, which makes configuring the scanner software easier, and also facilitates printer search too. The IP address range used by router’s DHCP should not be used for fixed addresses, but you may be able to set a fixed DHCP address for the raspberry in the router’s config, so that the DHCP always gives the same address to the device (which it reconginzes in WLAN by its MAC address).

21) Plan the place of the Raspberry Pi in your Local Area Network

Let’s think about configuring your RPi to have a fixed IP address in the WLAN. You can either program your WLAN router to always give the same IP address to the RPi:s WLAN adapter, or select an address within the subnet and out of the DHCP range in use. In this writing, we take the latter route, i.e. setting the IP address out of the DHCP range; assuming that DHCP is giving addresses starting from 192.168.1.10 and ending to 192.168.1.200, we pick an address in range 201-254, say, 192.168.1.245. This depends of course of your subnet configuration. If you have router management IP in 192.168.1.1 and the IP V4 net mask is 255.255.255.0, and you have nothing in your net with IP address 192.168.1.245, you’re good to go with my settings.

22) Configure the IP V4 address via DHCP

Configure the dhcp daemon to make the IP address a static one; consult iwconfig to get the name of your connected wlan interface. In the system configuration step, raspi-config , section Network – 2, you should have  set “Enable Predictable names” to get wlan0 instead of something like wlx01234678ABCD. Now, edit dhcp configuration file:

sudo nano /etc/dhcpcd.conf

#Add to beginning:

nohook lookup-hostname
interface wlan0 # wlan0 is the typical name for the wireless lan (wifi) interface, but it may be also longer
static ip_address=192.168.1.245/24
static routers=192.168.1.1
static domain_name_servers=1.1.1.1 # of whichever DNS you want, for example, 192.168.1.1, 8.8.8.8 will also do.

Save and then restart DHCPD, or just reboot.

Now we have set fixed IP address for the Raspberry Pi. Please note that if you configured the printer in the PC using IP address, you may want to reconfigure the address now.

In the next part we will configure the scanner server.

How to add WiFi to a multifunction printer using Raspberry Pi – Part 2

The previous article gave instructions how to prepare Raspberry Pi for installation of the required software, when adding WiFi to a printer. Now we proceed to installation of CUPS.

PART 2: INSTALL PRINTER SERVER WITH LAN ACCESS

11) Install printer server CUPS with a shell command:

sudo apt-get install cups

12) Configure CUPS by editing its configuration file with nano editor:

sudo nano /etc/cups/cupsd.conf

Edits:

# NOT Only listen for connections from the local machine. 
#Listen localhost:631 #CHANGED TO LISTEN TO LOCAL LAN 
Port 631 
# Restrict access to the server... 
<Location />   
  Order allow,deny   
  Allow @Local </Location>  
# Restrict access to the admin pages... 
<Location /admin>   
  Order allow,deny   
  Allow @Local 
</Location> 
# Restrict access to configuration files... 
<Location /admin/conf>   
  AuthType Default   
  Require user @SYSTEM   
  Order allow,deny   
  Allow @Local 
</Location> 13)

Restart CUPS service to make the new configuration effective

sudo service cups restart

14) Add user pi to group lpadmin

To make administration easier, to work with the default user pi, it can be added to lpadmin (Line Printer Administrator) group:

sudo usermod -a -G lpadmin pi

15) Allow access to cups from network:

sudo cupsctl --remote-any
sudo /etc/init.d/cups restart

16) Test that you can access CUPS via your wireless LAN

If everything went OK, CUPS should be visible from other computers in your LAN. Try it by opening a browser, to the address the raspberry pi has in your lan, with the port 631. You can find the IP address of the RPi with the command:

hostname -I

If the ip address were 192.168.1.33 , then the URL to get to the CUPS page is for example: http://192.168.1.33:631 

17) Install Samba

Samba is necessary if you are about to use the printer/scanner/RPi in association with Windows clients. 

sudo apt-get install samba

When asked “Modify smb.conf to use WINS settings from DHCP?” answer YES

Edit config further:

sudo nano /etc/samba/smb.conf
in section [printers], change:

guest ok = yes
read only = no

18) Connect the printer via USB

See that your printer is connected to Raspberry Pi’s USB via USB hub (or directly but then you must use a Bluetooth keyboard or SSH to talk to your RPi if there’s no room for an USB keyboard)

19) Add Printer in CUPS configuration page

Go to the CUPS page, Administration tab and “Add Printer”. The browser is sure to complain about security, but in this case you can go ahead. Page is (in condition that the RasPi is has address 192.168.1.33):

https://192.168.1.33:631/admin/

Login with user pi and its password. If you see warnings, they come because the RasPi does not have SSH certificates in order. You’re good to go ahead to your admin page to accomplish what you’re doing.

You should see your connected printer there if it is supported by CUPS out-of-the-box. Most HP and many Epson should be. Remember to set Share this printer

20) Configure the printer

On the CUPS page, select your printer and configure it.

What could go wrong? 😉

Add the printer to your client machine as network printer. On Windows 10, you can add it from Settings > Add printer or scanner, and select the printer from the list where it appears.

If that fails, go to Control Panel > Printers and devices > Add printer . Select The printer I that I want isn’t listed option, then Add a printer using a TCP/IP address or hostname.

In the next part, we’ll look in to how to set the Raspberry Pi a fixed IP address, which makes it more accessible in your local network.

 

How to add WiFi to a multifunction printer using Raspberry Pi – Part 1

Add wifi to printer!

Dear reader, I got a good but old photo-quality printer, but it was missing wireless connectivity. Even if its tradeable value is around 50 euros, it still works very well. I also avoid generation of unnecessary waste, so you might think this a “greenish” project, as a no new printer needs to be produced in China and hauled to Europe. Now, add wifi to printer!

Printer scanner
Epson RX 520 printer scanner device

The raspberry Pi came to rescue, bought it from Amazon for about 22 euros and 4 euros for the case. Despite being an economical option, I’m glad that the original Raspberry Pi’s are made in Sheffield, England, which still qualifies to geographical Europe.

Raspberry Pi 3 A+
The fast but small Raspberry Pi 3 A+

This is a recipe how to make a wireless (WLAN/WiFi) printer and scanner from a plain USB printer/scanner. To accomplish this, a  Raspberry Pi with Raspbian Linux and free server software cups and sane are used. 

It’s is updated, completed and checked for Raspbian buster operating system, I have collected information from many sources as there were no single, updated source to accomplish my mission to equip a USB printer with WiFi. This is important, it saves a good printer to go prematurely to waste! You may save a tree, as you reduce the of use nonrenewable resources! Especially, if you don’t give up printing, use of computer, buying a Raspberry pi…. 😀 

The journey is lenghtly, so prepare to spend a few hours with this! I’ve split the story to four parts. Easy? Yes, if you can already do something with Raspberry shell. In other words, this is for those who are past the first beginner steps, and can work with a command line. For people who see this difficult or troublesome I’d be happy to make and sell these for… say for 90 €. Hence, when you get a new printer for 90€, the project is not commercially very attractive, better to think it in DIY basis.

PART 1: PREPARE A RASPBERRY PI

Obviously, a Raspberry Pi is needed. I tried it first with a Raspberry Pi [1] B+ v1.2, the old one from 2014, but it’s sluggish on large prints and scans, so I ordered a Raspberry Pi 3 A+, which has sufficient connectivity for this application and besides, is cheap (I paid 22 € on Amazon.es).

The USB charger can be almost any that can supply real 5 V / 2.4 A of current, but I got some low voltage warnings with an insufficient cable.

If you only have a RasPi without wifi, you can use many old adapters. While two decades ago, Linux WiFi compatibility was a nightmare, it no longer is. In my stocks of old junk, I found a Linksys WUSB54GV4 “Wireless-G” WiFi adapter which is no longer detected by Windows 10 but works perfectly with Linux!

1) Hardware list

This is what I had, you may consider it a recommendation but no obligation.

  • Raspberry Pi 3 A+ (other models would do as well), costs about 25 €.
  • A case for the Raspberry Pi, with slots for power and USB cable.  4 – 10 €. You may use even a cardboard box.
  • Phone usb Power supply 2.4 A with a good microUSB cable. Less than 10 €.
  • 4 GB microSD card (I had a 8 GB, no problem), Less than 10 €.
  • A USB printer-scanner, model supported by SANE: Epson Stylus Photo RX520
    (Printer has to be supported by the CUPS)
    (List of SANE supported scanners here: http://www.sane-project.org/sane-mfgs.html)

The acessories required to configure the conveniently the Raspberry Pi:

  • Display with a HDMI input, You should have one already…
  • HDMI cable or cable with HDMI adapter -> to the display type. Came with the monitor, didn’t it?
  • USB keyboard (I had a Logitech K400+). Any USB keyboard will do.
  • Optionally, a USB hub to if you want to connect the keyboard and the printer same time to a Raspberry Pi with one USB port same time. 10 €

At the moment, I don’t advertise or have affiliations for now (also thanks to the old-fashioned Spanish taxation system for extra income). To give a glue, where I have got the items: I often buy used stuff from CashConverteres, CeX or Ebay. You can get a new parts like Raspberry Pi and the SD card from kubii.fr, amazon.es or even Carrefour or Alcampo.

2) Download a free operating system for the Raspberry Pi

download raspbian buster lite from here: https://www.raspberrypi.org/downloads/raspbian/

3) Flash the operating system ISO image to a microSD card

For example, balenaEtcher from here: https://www.balena.io/etcher/ will do the job. Rufus is also good.

4) Connect your Raspberry Pi to peripherals

Plug in the microSD Card, connect a display via HDMI and a keyboard via USB.

Hint: there are HDMI to DVI-D and HDMI to VGA adapters to make use of old display units.

5) Add Wifi adapter if Raspberry Pi does not contain it

On a Rasberry Pi 1 type boards and some others, there is no WiFi adapter. In that case, plug in a supported WiFi adapter to a USB port.

6) Connect power

Power with 2 amp phone charger with microUSB connector.

7) Booting

Raspberry Pi should boot and you get the usual dump on your display.

8) Login from local console

Use the keyboard and display connected to the Raspberry Pi. 

Login: pi Password: raspberry

These are the login and passsword after fresh installation.

9) Make first fundamental configurations to RasPi.

Configure the RPi with 

sudo raspi-config
  • in 4) Localization options to get the right keyboard layout (Default is US keyboard)
  • At Network Options N1 you may want to give the print server a name
  • You must setup WiFi network connection in Network Options N2, This way you can connect to your WLAN 
  • in Network Options N3 you may want to set also predictable interface names. As a result, you’ll get network interface names like wlan0.
  • in Interfacing Options you may want to enable SSH access (if you don’t have an extra display or USB HUB, you’ll want to connect from your computer with e,g, PuTTY) . If you enable SSH, you should change the password for the default user pi with the command passwd

Finish raspi-config and reboot

10) Update the operating system and included software 

First get updates, remember you need the wlan connection. Reboot to take the updates to use

sudo apt-get update
sudo apt-get upgrade
sudo reboot 

The next article will show how to configure the CUPS printer server in Raspberry Pi.