Wednesday, 25 October 2017

RPi for in-car video player - tasks remaining

Things are going ok with this project.

A reminder of requirements:
  1. Play on composite video screens using 4 wire connection (from RPi)
  2. Play DVDs from DVDs, using USB DVD player
  3. Web interface for controlling the gizmo
  4. Play stuff from Airplay or equivalent
  5. Provide an in-car wireless hub so it's easy to get into from phones etc.
What remains to be done?
  1. Attach DVD drive, check that DVDs play
    1. This might require purchasing an MPEG-2 key from RPi - £2.50 :-p
  2. Connect composite video screen, see how that works
  3. Fiddle with Airplay, but I suspect this is going to hard with Apple's proprietary protocol
  4. Do some power supply testing - I'm getting a lightning flash symbol on the upper right of the screen, which is an indication that the power supply is occasionally inadequate!
    1. This should include in-car testing from a USB supply thingy
Then package it all up somehow. Marv.

RPi for in-car video player Part Deux

Saved the previous SD card image, switched to LibreElec. Boots straight into Kodi, had to add lcd_rotate=2 to config.txt on the SD card itself (not inside Linux) to get it to be the right way up for the stupid Pi Official LCD Stand, which has the LCD the wrong way up. Bah.

Is this better? It's exactly the same... but let's check out the networking!

It appears to use connman, whatever that is... No sign of /etc/network/interfaces!

Checked connman man entry etc. Interesting. It appears to be possible to remove an interface from connman management, which presumably means one could then do something else with it.

Update: Wow!! There's a wireless AP option on the System/Networks page. Enabled it, can see AP on my iPhone and MBP, but it won't accept the passphrase!! Grrr...

Update: lots of looking for this and that - turned on logging, looked in journalctl, found a suspicious error, which I Googled... no joy. Then I switched on connman logging (touch /storage/.config/debug_connman) and rebooted. Now it works!! Coolio.

Monday, 23 October 2017

RPi for in-car video player




The g-kids have some DVD players in the car, so I thought it might be interesting to try building an RPi-based video streamer that would have some more flexibility in control and outputs.

Requirements:
  1. Play on composite video screens using 4 wire connection (from RPi)
  2. Play DVDs from DVDs, using USB DVD player
  3. Web interface for controlling the gizmo
  4. Play stuff from Airplay or equivalent
  5. Provide an in-car wireless hub so it's easy to get into from phones etc.
Checked out the Kodi options, and they are:
  1. Packaged distro - I'm concerned they won't meet requirement 5, because I won't be able to fiddle with the distro enough
    1. LibreElec
    2. OpenElec
    3. OSMC
  2. Raspbian with Kodi installed - maximum flexibility, so let's go with that.
Experimenting with my LCD-equipped RPi stack, including Digi+ ripoff digital interface...

Installed NOOBS on a 8GB SD card, opted for latest Raspbian install

Did 
  • sudo apt-get update
  • sudo apt-get install kodi - Version 17.4 Krypton apparently
  • waited for a bit...
  • plugged in USB keyboard
  • now trying to get some media installed somehow!
  • Tried adding Minimserver uPnP server, but entire system crashed!! Or at least, screen blanked and nothing happened...
  • Added USB_Storage from file server, as Pictures, and can now show a folder in a rotating slideshow - hurray!
  • Tried adding Server as music storage - crashed again!
    • Turns out it's not crashing - the display is blanking when running Kodi over the desktop, so did the following:
    • sudo vi /etc/lightdm/lightdm.conf
    • [Seat:*] uncommented and edited linexserver-command=X -s 0 dpms
    • This appears to have done the trick!
Requirement 3 - Web Interface: Enabled web interface Kodi options, connected to raspberrypi.local/8080 and bingo! UI here... It allows for playing stuff, but not a system-level interface, for that you need to go directly to the server. I'm really struggling with this... it's not intuitive at all! For example, I've added my USB memory stick to the library (I think) in Kodi, but I can't see my movies in the WebUI.

OK, added my Server/Music folder as a library and I can see it on the WebUI now. Hurray. Still can't see the content of the USB stick - it claims "no content" when it tries to index it! Strange.

Requirement X - Play stuff: Currently still trying to add some media files - trying a USB stick which I'll mount. Takes a long time to copy many GB! Works fine - added two movies, currently playing one - see above for indexing/access.

Requirement 2 - Play DVDs: Configuration menu provides for DVD playing, so all I need is an appropriate USB-connected DVD/Blueray drive! Ordered one off eBay for £8, should arrive Friday.

Requirement 1 - Connect using composite video 4 wires: I don't have a cable, but I do have an elderly in-car DVD player inherited off the guys with composite video in. I'll get a cable and try it out - the only problem is likely to be getting the connections right, so I might need 3.5 jack to 4 RCA and v.v. to enable easy switching around. Bought 3.5mm -> RCA Female, RCA Male -> 3.5mm on eBay, so can easily connect anything to anything.

Requirement 4 - Airplay: Just tried that out from MacBook Pro running iTunes and Mad Men DVD rip from HD. Oops. MBP said it was trying to play on Kodi, but Kodi froze, then stiffed - it's now restarted (?) and looking for me to tell it what to do. But the WebUI did declare it was playing airplay.m4v, which is pretty interesting.

Requirement 5 - Wifi hub: Using this helpful note I did
  • sudo apt-get install hostapd udhcpd
And then did a couple of other things, but noticed that the /etc/networks/interfaces file was nothing like the example, and after some delving in the /etc/dhcpcd.conf file, decided I needed a better documented approach that matched my RPi config!! Bugger.

This looks like a better approach... I note that this also assumes there are useful lines in the interfaces config file, unlike mine! Hey ho...
  • The usual
    • sudo apt-get update
    • sudo apt-get dist-upgrade
  • As previously with some extras
    • sudo apt-get install dnsmasq hostapd
  • Stop the new services...
    • sudo systemctl stop dnsmasq
    • sudo systemctl stop hostapd
  • Disable current wlan0 handling
    • sudo nano /etc/dhcpcd.conf
    • Add deny interfaces wlan0 somewhere...
    • Saved as /etc/dhcpcd.conf.new
  • Time to try editing the interfaces file!
  • Nope, that really isn't working. The dhcpcd demon quits declaring that it's not going to get involved because someone has configured a static IP address in interfaces - guilty as charged! Another post explains exactly why - apparently the latest Raspbian version (Stretch) has radically changed how the networking is organised, and none of the old stuff works. I can concur.
So - what to do? Frankly, Linux networking is a nightmare. It is almost impossible to untangle, and not explained anywhere sensible, with so many levels of indirection and files it's really not obvious what does what. Hmm... I wonder if one of the Kodi-specific builds is simpler? They are only Linux after all.