Not sure where to post this, so if mods think it should go elsewhere, feel free to move.
I've been working on a project, and was going to save posting it until I'd finished up, but I came across a few posts about people having issues with their NAS, and thought I'd share an easier way. Or, for anyone else who's interested in a tiny, low powered NAS that they can connect their headset to directly.
What you see is a Raspberry Pi B3+, a 4TB Western Digital My Passport drive, a 4-port powered USB 3.0 hub, a dual 3A 5V power plug and USB-C cables it came with, standoffs, screws, and panel mount extension ports for ethernet, HDMI, and micro USB. It's all getting mounted in an old gutted out ATX power supply box, modified to fit the components in the back, as by the cutout I already did. You obviously don't need to go this elaborate, but this is just what I do. Oh...and a wireless keyboard/mouse and dongle. You also need a microSD card, 8GB's or more. The dual power supply, is so I can feed both the Pi and the USB hub with 3A each...I'm splitting one of the micro USB cables and wiring a plug end on it to connect directly to the hub. For more portability, it can be powered by a dual 3A Anker battery.
* scroll down to '##### Authentication #####' and add below: (use [CTRL]+, enter search string, hit [enter])
security = user
* now scroll/search to [homes] and add:
read only = no
* then scroll to very bottom and add:
[public]
comment = public storage
path = /home/shares/public
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
read only = no
* then save: [CTRL]+, [Enter] then [CTRL]+, [Enter]
$ sudo /etc/init.d/smbd restart
$ sudo smbpasswd -a pi
* enter new password and verify
* then shut the pi down, attach external drive and power back on:
$ sudo init 0
* back to the terminal:
$ sudo gparted
* look for external drive from drop-down tab to the right...by default it should be sda1, but can change if more than 1 usb drive attached.
* copy /dev/sd*, then right-click the drive (not the unallocated partition), then select 'information' at the bottom. Now, copy the UUID: number, then close both the information window, and gparted window. You should now be back at the terminal.
UUID=Your-UUID-Number /home/shares/public/disk1 auto defaults,user,nofail 0 2
* then save: [CTRL]+, [Enter] then [CTRL]+, [Enter]
$ sudo reboot
* digital clock settings: (right-click clock)
%a %d %b %y %I:%M %p
$ sudo raspi-config
* scroll down to '5 Interfacing Options'
* select P2 SSH
* scroll down to '5 Interfacing Options'
* select P3 VNC
* select finish
$ sudo reboot
* the network up-down arrows should now be 2 red X's... right-click, 'remove wireless...from panel', then right-click the space it leaves, and 'remove spacer from panel'.
* right-click the network cable icon on the panel
- edit connections
- add
- wifi
- Connection name: whatever you choose
- SSID: whatever you choose
- Mode: Hotspot
- Band: A (5 GHz)
- Channel: 40
- Device: wlan0
- wifi security tab:
- Security: WPA & WPA2 Personal
- Password: whatever you like
* save .. should now see your Access Point, and it should say 'now' under 'last used'.
$ sudo reboot
* to link contents from multiple directories into 1 shared directory, do the following for each directory:
That's it. After that, put your headset on, go to Wifi settings, and find the Pi...whatever you called it, and connect to it using the password you set. After that, go to the Quest library, open Skybox, and select Network on the side panel. Open the directory with your files, and it will fill the screen with thumbnails of the files. You are done and ready to stream using the Pi.
Also, I sideloaded VNC, and enabled VNC in the Pi, creating a remote desktop connection, controlling the Pi from the Quest. I also got streaming working, from the Quest to the Pi...but unfortunately, it's slow as hell. That's using adb and scrcpy. The author of scrcpy thinks it might be ffmpeg, or that it's just not optimized for the Pi. I'm still testing with it, thinking I 'might' be able to stream directly to Kodi. If not, I'm getting a Raspberry Pi 4B in another month...they just came out. The Pi3B+ has 1GB DDR2 RAM, 4 USB 2.0 ports, onboard dual band WIFI, bluetooth, and a 4 core 1.4GHz ARM processor. The RAM is shared between the CPU and GPU, so the GPU gets 512MB at the most. But...the Rapsberry Pi 4B....up to 4GB's DDR4 RAM, a 1.5GHz processor, wifi and bluetooth, and now has 2 USB 2.0 ports, with another 2 USB 3.0 ports. Use a Sandisk Extreme portable SSD drive for the OS, running at USB 3.0 speeds, and this little beast will be pretty fast. It's also supposedly capable of 4K @ 60fps, so I'm hoping streaming on it will be a bit smoother. Once I've got that down, I'll post that up as well. Cheers.
Whatever works best for you. Copy and pasting's pretty easy. I wound up getting this going on the Raspberry Pi 4, with 4 GB's of RAM, and it runs pretty damn smooth. It took a few more steps and configuring to get it running on an external SSD, but it gets more than 200 MB/s read and write, and after setting scrcpy to cast using a 720p resolution, I can crank the bitrate to at least 50MB, and still have it run in real time, with zero latency. From my understanding, the Quest casts in 720p anyway, or at least looks like it in any gameplay videos uploaded to youtube. I also picked up a $20 sound card for the Pi, and just need to DIY a ribbon cable to mount the card beside the Pi, rather than mount on top of the GPIO pins of the Pi. I have a 60mm Noctua fan mounted over top, so there's no room for the audio card on top as well. After that's set up, I'll plug my bluetooth audio receiver into the line-in port of the audio card, then attach the bluetooth audio transmitter to the Quest's right arm, then plug into the right audio jack, with the DAS speakers plugged into the left audio jack. I'll be able to cast the audio as well as listen to it at the same time. I even made an application launcher to automatically run my quest_casting.sh script, and gave it an Oculus icon, grabbed from google images. I added that to the taskbar in Raspbian, and I can launch directly from the taskbar. Unfortunately though...the icon disappears after a reboot. The taskbar settings manager says it's still there, it's just not visible. I'll have to work on that. 😛 Until then, I just launch from the start menu instead.
edit: Forgot to mention...there's an app for the Pi, called Lazycast. It makes the Pi work as a Miracast device. The onboard wifi chip works out of the box, but finding an external dongle capable of being a P2P-device isn't as easy. P2P-GO and P2P-client, yes, but not P2P-device. A Windows 10 pc with the right dongle can also do Wifi Direct...but so far, it only sees my Android phone, not my Quest. I guess the Quest still doesn't do Miracast.
It started out as a simple portable NAS and 5 GHz hotspot, so you could take your videos with you on the go, as well as having a dedicated 5GHz wifi connection that doesn't drop out like it does on many people's routers who have both 2.4GHz and 5GHz connections. But I also wanted casting capabilities, with the possibility of capturing gameplay directly on the Pi. The NAS works, and with an external wifi dongle (TP-Link Archer T4UH), the 5GHz hotspot has an 866 Mb/s connection, which should be good enough for connecting more than 1 headset at a time, though I haven't tested yet. I could only get 72Mb/s with the onboard wifi chip, which is why I bought the external dongle. That, and I'm mounting the Pi and hard drives in a gutted out metal power supply box, so the external dongle for better signal. As for casting...the older Raspberry Pi 3B+ only had 1GB of RAM, so casting was limited to only 320x320, with only 5MB/s. With the RPi4 and it's 4GBs of RAM, I can cast using 1000x1000, with a 720p output resolution, and a bitrate of 35MB/s, without any noticeable lag whatsoever. As soon as I figure out the audio portion, I'll work on capturing. Hopefully.
In case anyone wants to play along, here's my steps for the RPi4. It gives a 5GHz hotspot, a wireless NAS, and casting capabilities using scrcpy, but only video casting...I'm still working on the audio portion. I'm using an external wifi dongle (TP-Link Archer T4UH), but the steps are the same if using the onboard wifi chip. You just need to comment out the 'dtoverlay=pi3-disable-wifi' line in the config.txt. You also comment out the bluetooth line if you want to use it as well.
3) Copy these instructions to a text file, then copy to the microSD so you can transfer to the Pi's desktop once booted, so you can then copy and paste the instructions into the terminal.
4) Look for the config.txt on the microSD, and add the following to the bottom of the file:
max_usb_current=1
#over_voltage=4
#arm_freq=1750
#gpu_freq=600
dtoverlay=pi3-disable-wifi
dtoverlay=pi3-disable-bt
disable_overscan=1
* If you have heatsinks and a fan, then uncomment over_voltage, arm_freq, and gpu_freq to overclock from 1.5 GHz to 1.75 GHz. Also, I disabled the onboard wifi and bluetooth, as I'm using an external wifi adapter with a higher data rate than the onboard chip, and I don't need the bluetooth, as I'm using a bluetooth audio receiver for the casting. If you prefer to use the onboard wifi and bluetooth for a keyboard or something, then just comment them out in the config, or delete them altogether.
5) Once you've saved the file, safely eject the microSD card, insert into the Pi, connect your keyboard/mouse/dongle, connect your monitor, connect your ethernet cable, and power up the Pi. It can take up to a minute for the first boot, as it resizes the system partition to use the entire microSD, then you're greeted at the desktop with an installer GUI. Set your preferences, then let it do it's update. It may give a time out error or some other repository issues, but we're going to manually update everything anyway, so no worries.
6) Once the update's finished, choose to reboot. Then back at the desktop, plug your usb stick in, open it up, and copy the readme to the desktop. Then click the eject icon on the right side of the taskbar, and eject the usb stick.
Then click the black terminal icon on the left side of the taskbar, and c&p the following commands...everything 'after' the $ sign:
7) disable screen saver:
$ sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
* Edit to look like below:
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
# @xscreensaver -no-splash
#Disable screensaver:
@xset s noblank
@xset s off
@xset -dpms
point-rpi
* Then save: [CTRL]+, [Enter] then [CTRL]+, [Enter]
$ sudo reboot
😎 Update system if needed:
$ sudo apt update
$ sudo apt upgrade
$ sudo apt dist-upgrade
$ sudo apt autoremove
$ sudo apt autoclean
9) set cpu to 'performance' mode:
$ sudo apt install cpufrequtils
$ echo 'GOVERNOR="performance"' | sudo tee /etc/default/cpufrequtils
$ sudo systemctl disable raspi-config
$ cd /sys/devices/system/cpu
* for the next 4 steps, c/p the first line, press enter, then use the page up key to recall the command you just entered, then use the page left key to edit the 'cpu0/' to 'cpu1/', then 'cpu2/', then finally 'cpu3/'. It's quicker than c/p'ing all 4 lines, but just make sure to press enter after each.
$ sudo sh -c "echo performance > cpu0/cpufreq/scaling_governor"
$ sudo sh -c "echo performance > cpu1/cpufreq/scaling_governor"
$ sudo sh -c "echo performance > cpu2/cpufreq/scaling_governor"
$ sudo sh -c "echo performance > cpu3/cpufreq/scaling_governor"
UUID=Your-UUID-Number /home/shares/public/disk1 auto defaults,user,nofail 0 2
* ex: UUID=D65099E95099D09B /home/shares/public/disk1 auto defaults,user,nofail 0 2
* Then save: [CTRL]+, [Enter] then [CTRL]+, [Enter]
$ sudo reboot
* Upon reboot, open home folder..that should put you in /home/pi. Select home from left panel, or click the up arrow to the left of the address bar, then open the shares folder. Check to see all your videos appear. Full directory is /home/shares/public/disk1.
* To link contents from multiple directories into 1 shared directory, do the following for each directory: