Microsoft Surface Pro 4 Screen Flicker

My nearly four year old Microsoft Surface Pro 4 recently developed a screen flicker issue. I’m sure it was some driver update that was installed, but I’m not exactly sure when. The observed activity is that a horizontal section at the bottom of the screen about the same size of the mouse cursor flickers with data that is duplicated from the top of the screen. The rest of the screen appears to be bouncing up and down by one scan line, making the text nearly unreadable.

I searched online, and found references to flicker problems with some cases being purely hardware related and requiring replacement by Microsoft. I also found references to the problem only occurring after the screen data had not changed for a few seconds. This static screen problem matched my problem exactly.

I found a workaround by enabling the seconds display in the clock in the task bar. This is done by creating a registry entry. If the following is in a “.reg” file it will set the value to show the seconds on the clock.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"ShowSecondsInSystemClock"=dword:00000001

I read that the seconds are not enabled by default because it saves a bit of processing power, which can be important on battery powered devices. For me the difference is minimal and worth not spending more time researching a probable driver issue that may be taken care of automatically in some future windows update.

2019-10-04 (1)2019-10-04

I hope that this helps someone else. The screen flicker/jitter was annoying and I wasn’t able to find the root cause.

 

Advertisements

Access Windows share from Raspberry Pi

I have a shared directory from my windows server that I’d like to read and write from my Raspberry Pi. I want the share to be automatically available on my Raspberry Pi whenever both the Raspberry and the Windows server are running, but I don’t want the system to spend too much time hung up if the windows server is not available. My easy solution is below.

My Windows servername is Acid. The share I want to connect to is Web. The IP address of the server is 192.168.0.12.

sudo echo 192.168.0.12 Acid>>/etc/hosts
sudo mkdir --parents /media/acid/web
sudo echo username=WindowsUsername >/etc/wimsworld.smb.credentials
sudo echo password=WindowsPassword >>/etc/wimsworld.smb.credentials
sudo echo domain=OptionalDomainName >>/etc/wimsworld.smb.credentials
sudo chmod 0600 /etc/wimsworld.smb.credentials
sudo echo //acid/web /media/acid/web/ cifs credentials=/etc/wimsworld.smb.credentials,noauto,x-systemd.automount,x-systemd.idle-timeout=1min,_netdev 0 0>>/etc/fstab

That series of commands, with the correct details in the credentials, and the system automounter will automatically attempt to connect whenever there’s an access under /media/acid/web and then disconnect again after it’s been idle for over a minute.

I needed to add Acid to my local hosts file because the name doesn’t resolve from the DNS server the raspberry pi is using.

I put the windows Username/Password and Domain in a file with only read/write permissions to root so that it wasn’t clear text in the fstab file for anyone on the machine to read.

I did all of this on a machine that had been built from the Raspian Buster Lite image from 2019-07-10. I didn’t explicitly install the cifs-utils package. It might be needed on other distributions.

My new favorite WiFi Analysis Program

I recently came across WinFi Lite, and while it claims to be in beta and for professionals only, it’s currently my favorite WiFi analysis program.  The fact that it was in the Microsoft store gives me the idea that it will uninstall cleanly if I decide to get rid of it later.

2019-09-10

The default view shows details about both 2.4 and 5 GHz networks nearby. The first picture was what it looked like when I ran it in my local Starbucks on my Microsoft Surface 4 Pro.  The next picture was what it looked like when I ran it in my apartment. In my apartment I was connected to my network via wired ethernet, so the Surface WiFi adapter wasn’t being used for my active connection. At Starbucks, I was connected to the WiFi.

2019-09-11 (1)

While I was at Starbucks, the number of networks it could see was 188. That number is visible in the top right of the image. Just to the left of that number are a set of buttons that allow you to look at 2.4GHz, 5GHz, or All available networks.

My apartment showed only 161 networks by comparison, but that number was bouncing around as it rescanned in both locations. I was surprised that the Starbucks had so many visible networks. There are a lot of details available in this tool, and it’s current price makes it an interesting tool to work with. I used to like inSSIDer, but the developers choice to dumb down the free version led me to drift away from it.

iTunes, Microsoft Store, COM Interface Type Library

Several years ago I’d written a program to manipulate data in the iTunes library using the approved Apple COM API. Part of the way this works in a C program is to include a type library in the headers defining all of the function calls. When iTunes is installed in the traditional way, Apple embedded the type library in the executable, and the executable was installed in a traditional location.

#import "C:/Program Files (x86)/iTunes/iTunes.exe"
using namespace iTunesLib;

With the installation of iTunes from the Microsoft store, the iTunes executable no longer lives in that location. Today my application builds properly with the following import command, but it may change mysteriously with version changes and automatic updates via the store.

#import "C:/Program Files/WindowsApps/AppleInc.iTunes_12093.3.37141.0_x64__nzyj5cx40ttqa/iTunes.exe"
using namespace iTunesLib;

My program builds and runs more reliably than it used to, which I’m assuming is in part due to the fact that I appear to now be using a 64 bit version of iTunes, and all the extra work Apple put in to make iTunes more reliable on windows in general.

Finding the iTunes application itself was the hardest part of the transition. I’m happy the API still exists because Apple no longer hosts easy access to the documentation for the API, and http://www.joshkunz.com/iTunesControl/ seems to be the most complete and searchable information.

iTunes, Microsoft Store, Microsoft Surface

Last year, Apple finally worked enough with Microsoft to get the iTunes program for windows available in the Microsoft Online Store. I’d always had problems with upgrading iTunes in windows in the past, requiring me to completely uninstall, reboot, and install the new version each time I wanted to upgrade. Often I had to not just uninstall iTunes, but search for other helper programs that Apple might have installed and uninstall them before rebooting.  I did the complete uninstall before I installed the version from the Microsoft store. Since that time, iTunes has almost magically been up to date on my desktop computer. The Microsoft store updates seem to get installed in downtime on my computer and everything just works.

I’m stuck in my ways a bit as far as music goes. I’ve get a large ripped CD collection, that I keep the originals all in a set of binders including the original paper inserts. My iPhone has 256GB of storage, more than half of which is my music.

I’ve kept my iPhone synchronized with my desktop computer because of the storage requirements of all of the music in the past, but at times have wished I was synchronizing with my Microsoft Surface Pro 4 tablet that I travel with, and use just as much as my desktop. My Surface has 256GB of storage in the internal SSD, and I’ve been using a 256GB micro sd card in the accessible storage slot for the past couple of years. That’s good for movies while traveling, but I didn’t want to allocate over half the space to iTunes.

2019-03-11

The falling price of flash cards recently convinced me to buy a new 512GB flash card to leave in the Surface. I was able to get all of my music transferred over to the SD card and iTunes installed from the Microsoft Store with very little impact on the internal storage on my Surface. I followed the Apple support ducument and had a few issues because my library had never been consolidated from my early MP3 ripping days.

I’ve been running my Surface SSD with between 50 and 70GB free, which from what I’ve read about SSD usage is good for both lifespan and performance. The iTunes directory on my micro SD card consists of 24,169 files and 137,859,861,360 bytes according to a simple dir /s command.

All was looking good until I got around to connecting my iPhone to the new machine and telling it to backup on the new machine. The backup completed correctly, but I then found out that it had used up all the free space on my internal SSD and I was now down to less than 3GB free space.

A quick search on the web led me to this page explaining how to relocate the backups to an external drive in windows. That seemed good, until I realized that the directory described does not exist on my machine. One more change that seems to have happened to iTunes locations in the Microsoft Store move. A search on my machine led me to find the MobileSync directory in my user profile directory. I used robocopy to move the backup directory to an appropriate directory on my flash card, which took a while because it consisted of 58,623 files and 77,743,703,474 bytes. I then created a directory junction from the SSD location to the flash location.

robocopy /COPYALL /E /MOVE C:\Users\Wim\Apple\MobileSync\Backup D:\Wim\Apple\MobileSync\Backup
mklink /J C:\Users\Wim\Apple\MobileSync\Backup D:\Wim\Apple\MobileSync\Backup

After all that had completed I started iTunes and connected my phone, initiating another backup. Everything now appears to be working properly, with iTunes storing both it’s library and device backups on my secondary storage device.

The only drawback I’ve currently run into is that I use Windows Server Essentials 2016 as a home server and it’s device backup feature to backup my machine for emergency file recovery. The microsd card is recognized as removable media, and the backup software doesn’t easily let me include it in the regular backup strategy.

Odd Wildcard Matching in Windows 10

I recently ran into an odd behavior of more files matching a pattern than I expected. I’d used exiftool to modify the dates on files my GoPro produced. It creates backup files of the original images when it modifies the tags. Here’s the command I ran.

exiftool.exe -r "-AllDates+=4:7:6 17:40:00" -ext jpg f:\GoPro\20170807

Now I had about 4000 files with the .JPG extension and another 4000 files with a .JPG_original extension.

I ran my program that parses the directory structure and turns all those images into a time lapse movie, and it seemed to be including both the file extensions, making a very disjointed movie.

I loaded my source code in the debugger and it seemed to be doing a findfirst / findnext specifically looking for .JPG files, and not some other extension, but it was definitely retrieving files both with .JPG and .JPG_original extensions.

I then ran a couple of commands at the windows command prompt and was surprised to find the same results there.

dir F:\GoPro\20170807\372GOPRO\G*.JPG /p
dir F:\GoPro\20170807\372GOPRO\G???????.JPG /p

Each command returned both the JPG and JPG_original files.

dir F:\GoPro\20170807\372GOPRO\G*.JPG_original /p

returned just the JPG_original files.

dir F:\GoPro\20170807\372GOPRO\G??????.JPG /p

had one less question mark and correctly returned no files.

This is all unexpected behavior, though I’m glad to see that it was consistent with the operating system and not something specific to the C runtime. I’d love an explanation of what’s going on.

exiftool to manage DJI media files

DJI Drones don’t seem to remember the image count between formats of a media card. This creates a problem for me when I’m trying to backup and maintain my images and video.

Because the dates are all correct in the media files, retrieved from GPS data, organizing the files by naming them based on the date works for me.

Using ExifTool by Phil Harvey is a great solution for pulling the metadata from the files and renaming the files.

The command line that I was initially using is:

exiftool "-FileName<${CreateDate}.$filetype" -d %Y%m%d-%H%M%S%%-c -ext mp4 -ext dng -ext jpg dji*

It’s problem is that it orphans the SRT subtitle files from my videos that I’d like to keep matching the video files.

I’ve tried this variation to do it in one step but it doesn’t work, because the SRT files get renamed as MP4 files.

exiftool -verbose "-FileName<${CreateDate}" -d %Y%m%d-%H%M%S%%-c.%%le -ext mp4 -ext dng -ext jpg dji* -srcfile %f.srt

If anyone has a suggestion for how to rename all the media files in one directory I’d appreciate it. Even running two commands in sequence would be fine.

Update:

I’ve figured out that running these two commands in sequence will get me the results I am looking for:

exiftool "-FileName<${CreateDate}" -d %Y%m%d-%H%M%S%%-c.srt -ext mp4 -srcfile %f.srt dji*
exiftool "-FileName<${CreateDate}" -d %Y%m%d-%H%M%S%%-c.%%le -ext mp4 -ext dng -ext jpg dji*

I’m still looking for a way of doing it in a single command that may leave less room for error, but this is working for now.