Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: Add smbd to Tweaks for Samba file sync #973

Merged
merged 40 commits into from
Jul 10, 2023
Merged

FEAT: Add smbd to Tweaks for Samba file sync #973

merged 40 commits into from
Jul 10, 2023

Conversation

XK9274
Copy link
Member

@XK9274 XK9274 commented Jul 2, 2023

Samba

Allows for the use of networked folder access.

Features/additions:

  • Samba related files & libraries
  • Pre-set folder paths to Roms/Saves/SD Root & Screenshots. (More can be added in .tmp_update/config/smb.conf)

Issues

Currently only works correctly if the call to start it comes from runtime.sh. There seems to be an environment/permissions issue which causes smbd to run but not allow access into subdirectories. ~ Confirmed fixed.
#973 (comment)

TO-DO

  • Do not share rootSD by default
  • Implement shares toggles in Tweaks (possibly dynamically from the contents of smb.conf)

Test process

  • Boot up with samba disabled
  • Go to tweaks, network, enable Samba with the master toggle (using default config)
  • Browse to the network share (windows: \\x.x.x.x\ in explorer window, where x is the IP of the MMP)
  • Check you have root directory access
  • Check you can transfer a file to any of the folders, verify the file exists on the MMP with a ls
  • Check files are visible from windows when a touch command is made
  • Make a change to the file on windows, cat the file on the MMP - make sure changes synchronise
  • Rename the file, make sure the change propagates across
  • Check you have subdirectory access (EG, open Roms, open a folder that has Roms in it, make sure they're visible)
  • Go down into the Samba submenu
  • Disable some shares & refresh your explorer window when in the root location - observe the folders are removed
  • Enable the shares & refresh your explorer window when in the root location - observe the folders are restored
  • Disable wifi, return to tweaks - observe samba is disabled
  • Enable wifi, return to tweaks, enable samba - observe samba is enabled and directory access restored

Media

Tweaks_016

Tweaks_002

image

image

image

@XK9274 XK9274 changed the title Add smbd samba Add smbd to tweaks for samba file sync Jul 2, 2023
XK9274 and others added 6 commits July 2, 2023 00:19
There's currently an issue, where if runtime.sh starts the process it all works fine, but if tweaks starts it, it does not. (This seems wrong has runtime.sh is the parent of tweaks).

The current code on this branch requires you to:

Open tweaks
Turn samba on
Exit tweaks

This causes a naturally start to Samba.

If you remove start_smbd from check function, and move line 135 down into check_smbdstate it causes a situation where smbd will start but the shares aren't browsable.

If you add a call to "check" function in "check_smbdstate" it also doesn't work.. the call to start needs to come from runtime.sh

It's either an env var issue or a permissions issue.
…cluded.

Path is set when starting bin, no need to possibly add this many libs to our path.
@Aemiii91 Aemiii91 changed the title Add smbd to tweaks for samba file sync FEAT: Add smbd to tweaks for samba file sync Jul 2, 2023
When runtime.sh starts smbd directory access is restored.

Currently tweaks cannot start smbd instantly (on on exit)
@XK9274 XK9274 marked this pull request as ready for review July 2, 2023 11:37
Preloading libpadsp.so (which is inherited from the parent shell) is the cause for the issues with smbd not displaying subdirectories, why? i don't know - either libpadsp.so contains conflicting symbols or it breaks the environment that smbd spawns in somehow.
@XK9274
Copy link
Member Author

XK9274 commented Jul 2, 2023

Test process number 1 complete on 215 - Looking like bc3f576 has resolved directory issues.

@XK9274
Copy link
Member Author

XK9274 commented Jul 2, 2023

Confirmed fixed on formatted SD card & fresh build of branch on MMP 149
image

@XK9274
Copy link
Member Author

XK9274 commented Jul 2, 2023

Confirmed fixed on formatted SD card & fresh build of branch on MMP 217
image

@XK9274 XK9274 requested a review from Aemiii91 July 2, 2023 20:01
@Aemiii91 Aemiii91 added this to the v4.2 milestone Jul 5, 2023
@XK9274
Copy link
Member Author

XK9274 commented Jul 9, 2023

Added some functions to allow management of the shares instantly - smbcontrol didn't end up being requiredas smbd is actively watching the config file (or appears to be, changes are instant)

  • Need to find a home for:
    free(shares);
    If it's in the menu it causes problems due to how I've handled the action..... (maybe not the best way) - the smb.conf will run away (gets filled with garbage/junk) - It could be called when we exit the menu (returning back to "Network") or when we quit tweaks.

  • When you go down into the Samba submenu, coming back up looks like you've also disabled the Master toggle for samba (it's aesthetic, smbd is still running)

  • I've added whitespace after the "no " in "browseable" within smb.conf so the put clears the full line (instead of it being "nos" at the end when we toggle it..) could probably clear the line and rewrite it as the location is stored in browseablePos within the Share struct

  • Error handling needs fixing as it'll segfault currently if smb.conf doesn't exist.

@Aemiii91
Copy link
Member

All done ✅

@Aemiii91 Aemiii91 changed the title FEAT: Add smbd to tweaks for samba file sync FEAT: Add smbd to Tweaks for Samba file sync Jul 10, 2023
@Aemiii91 Aemiii91 added this pull request to the merge queue Jul 10, 2023
Merged via the queue into main with commit 67fc5a6 Jul 10, 2023
3 checks passed
@Aemiii91 Aemiii91 deleted the add-smbd-samba branch July 10, 2023 18:42
@DocMAX
Copy link

DocMAX commented Jul 16, 2023

I have the latest beta on miyoo mini plus but no samba in "tweaks" menu

@tGecko
Copy link
Member

tGecko commented Jul 16, 2023

The latest beta is not the same as the main branch, Samba will be included in the next beta realease.

@Aemiii91 Aemiii91 added the enhancement New or improved feature label Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New or improved feature
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

4 participants