0 Comments

Yet another day I tried to play a video from an SMB share using OSMC. Must say so – this player is just amazing and works great on Raspberry Pi 2 (although on Pi 1 whole stack was far too slow for HD content). So what could go wrong here?

I am a bit paranoid about sharing and access rights. That’s why I setup that share with a dedicated user on a server and guarded with a strong password. The user could only list folders and read files, so even if the password gets somehow compromised, it shouldn’t allow to cause any harm on server. But then I couldn’t find the way of mounting such a share though GUI of the OSMC player. After several tries I wanted to give up until I found the way of updating configuration manually.

PC with SSH client is required for that purpose. Let’s connect to the device (default user and password are ‘osmc’, what I recommend changing just after player installation). Then all settings about mapped drives are stored in an XML file at “/home/osmc/.kodi/userdata/sources.xml”. Simply edit this file adding following snippet at respective place. Of course replace the ‘user’, ‘password’ and server IP with the real values from your environment.

<sources>
    ...
    <video>
        <default pathversion="1"></default>
        <source>
            <name>Prime</name>
            <path pathversion="1">smb://user:password@10.0.0.111/video/</path>
        </source>
    </video>
    ...
</sources>

Save. Reboot. Enjoy!

0 Comments

Since I play a lot with IoT using my Raspberry Pi – on both – Windows and Raspbian, I ended up holding several SD cards, which don’t report almost any size on Windows. Somehow they are seen only as 70MB disks, even if they originally were 32GB cards. Where are then the missing bytes? Believe me, they are there and it’s simply the partition table (written on top of the SD card) that makes them hidden or treated even as unallocated space. And because Windows Explorer doesn’t allow any advanced management on that front, as its only feature - drive format - is not powerful enough, we need to go one level deeper.

Here is my recipe. If you browse the Internet, lots of people suggest using SD Association’s formatter tool. I confirm, it might be OK and it worked for me several times. But there is also another way, that uses build-in command-line utility called diskpart. This little tool will serve all our needs and we will feel like true admins. One *warning* before starting – it’s so powerful that I recommend double-checking all executed commands and their contexts to avoid accidental damages done to system disk and its partitions.

After that, all is more less straightforward. Run command-console in admin mode and execute (assuming the SD card is already somehow connected to the PC):

a) list available drives

b) select drive, where to restore full capacity

c) verify existing partitions

d) clear it

e) create a primary partition occupying whole available space

f) have fun!

 

Full listing from my sample session looks like following:

 

C:\WINDOWS\system32>diskpart

Microsoft DiskPart version 10.0.10240

Copyright (C) 1999-2013 Microsoft Corporation.
On computer: TAJFUN

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online           29 GB      0 B        *
  Disk 1    Online           29 GB    22 GB

DISKPART> select disk 1

Disk 1 is now the selected disk.

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online           29 GB      0 B        *
* Disk 1    Online           29 GB    22 GB

DISKPART> list part

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Primary             64 MB  2048 KB
  Partition 0    Primary           4276 MB    72 MB
  Partition 0    Primary            600 MB  4348 MB
  Partition 0    Extended          2424 MB  4948 MB
  Partition 0    Logical           1024 KB  4948 MB
  Partition 0    Logical           2420 MB  4952 MB

DISKPART> clean

DiskPart succeeded in cleaning the disk.

DISKPART> create part pri

DiskPart succeeded in creating the specified partition.

DISKPART> list part

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
* Partition 1    Primary             29 GB  1024 KB

Once done, this partition on SD card can be formatted as FAT32, NTFS or anything else.

0 Comments

Few days ago I ordered Raspberry Pi 2 and unboxed it just today. After a lecture of few videos on Channel9 about Microsoft //Build/ 2015 I was very excited and wanted to test the latest Windows 10 for IoT myself. Then I simply hit obstacle after obstacle and wasted more than 10 hours of my life to simply get the image written on microSD card. That was a real nightmare, but maybe because I am not a typical Windows user. Please treat the rest of this post as a warning and also as a guide to make the whole process straight to the point.

Before I start painting everything with my grief, compare, how easy it is to use Raspbian. 4 steps:

1) download an OS image (without signing anything)

2) download a burning tool, that doesn’t need installation and works on any version of Windows

3) burn the image on an microSD card using your favorite card-reader

4) put the card into Raspberry and and power it on!

10 minutes and you are ready to write your programs.

Now let’s install Windows 10 IoT and see, if the Universal Windows Platform is really as awesome as they say. There is a step-by-step guide on the IoT project website. I also found a nice post on Scott Hanselman’s blog, but they both seemed to skip a few quite important details. Let me bring them to light.

1) Yes, here it’s also required to download the image (.ffu), but to get it, you need to sign into Microsoft beta-testers program. The same time, you claim not to reveal any bugs etc., found during the usage of the software. OK, this approach I understand.

2) & 3) But what about the other actions? How to put the image on microSD card?

What you need:

1. Windows 10 Insider Preview- must be a physical Windows machine (not a VM).

Shocking, but true. You need to have a preview version of the desktop OS installed on physical hardware, to actually be able to burn image for Raspberry Pi 2. Confirmed, I tried to create it from a Hyper-V virtual machine and failed to do so. Hyper-V used to access host plugged-in USB card-reader can’t make it at enough low level to perform the image writing. Still I was forced to install 20GB OS to simply use a small command-line utility program that will prepare the microSD card. It really sounds ridiculously and the person, who had this idea at Microsoft should be promoted ;) Couldn’t the utility be ported back to Windows 8.1 and occupy 2MB?

Well, installation of Windows 10 (version 10074) and using it on Hyper-V at least gave me an idea, how the new OS will look and work like. It was fairly OK. However it setup my mind with a sentence – ‘do not install it yet on any of PCs that are used to make money!’. That eliminated my 3 quite new and powerful machines.

UPDATED: version 10130 is much stable and pleasant to work. Although I prefer to use it via Hyper-V (and remote desktop) than on a physical old hardware as described below, which is much slower than i7 with 32GB of RAM and SSD.

The one that left was a Pentium IV 4GHz Prescott from 2005 I suppose. With Windows XP on-baord it was a nice testing machine. It turned out it can’t be easily upgraded to Windows 10 Preview as this is the last processor, which doesn’t support NX instruction set and causes 0x000000005D failure during installation. Thankfully I found this video explaining, how to overcome this issue. As a result I ended up with a machine with Hyper Threading disabled, enabled legacy USB support in BIOS, modified kernel, which required starting Windows in safe-mode after each reboot and had digital signatures integrity checks disabled. At least it had 2GB of RAM to start! Running on regular HDD was killing any performance the machine had, but I though I was so close the goal. Then I could simply format it as soon as the microSD card is flashed and forget.

So close is sometimes far enough. Execution of flashing:

1
dism.exe/Apply-Image /ImageFile:flash.ffu
/ApplyDrive:\\.\PhysicalDriveN/SkipPlatformCheck

(N is a drive number assigned to card reader)

finished with magic “error 1168”. Turned out external card readers are not supported! If I had a build-in one, like when using Surface Pro or other tablet, I wouldn’t have problem like that. Once again Internet helped me with this forum thread. Komarov (whoever he is) found the root cause and explained, how to edit another system library with hex editor.

You can patch x86 version of FfuProvider.dll with HEX editor.
File offset 0x7312, replace B8 90 04 07 80 with B8 00 00 00 00 (valid for 10074 and 10075)

Job done. Image written.

4) After longer fist boot, Raspberry Pi 2 is now able to run Windows 10 IoT. That’s just great.

I still believe Microsoft won’t leave it that way and will simplify the whole process and this was just hard-core for beta testers.

On the other hand – lesson learned – buy the cheapest Windows 8.1 tablet, which is most probably faster and better supported than 10-years old PC!