Skip to content

Commit

Permalink
use partition.Mountpoint instead of .Device
Browse files Browse the repository at this point in the history
Under Windows both properties carry the same value, yet under Linux
.Device is the name of the block device like /dev/sdc1 and mountpoint is
the place in the filesystem where this device is mounted and where one
can access the data in it - like /mnt/insta-sdcard.

Hence when trying to access files like MISC/version.txt,
DCIM/fileinfo_list.list or MISC/GIS/dji.gis it will not work.

Switching to .Mountpoint means file access under Linux will start to
work, and keep working under Windows.
  • Loading branch information
klaernie committed May 18, 2024
1 parent 51a4268 commit 0936909
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/list_devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var listDevicesCmd = &cobra.Command{
color.Yellow("📷 Devices:")
}
for _, partition := range partitions {
color.Cyan(fmt.Sprintf("\t🎥 %v (%v)\n", partition.Device, utils.CameraGuess(partition.Device)))
color.Cyan(fmt.Sprintf("\t🎥 %v (%v)\n", partition.Mountpoint, utils.CameraGuess(partition.Mountpoint)))
}

ctx := context.Background()
Expand Down
4 changes: 2 additions & 2 deletions pkg/gopro/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ func Detect() (string, utils.ConnectionType, error) {
return "", "", err
}
for _, partition := range partitions {
if utils.CameraGuess(partition.Device) == utils.GoPro.ToString() {
return partition.Device, utils.SDCard, nil
if utils.CameraGuess(partition.Mountpoint) == utils.GoPro.ToString() {
return partition.Mountpoint, utils.SDCard, nil
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/insta360/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ func Detect() (string, utils.ConnectionType, error) {
return "", "", err
}
for _, partition := range partitions {
if utils.CameraGuess(partition.Device) == utils.Insta360.ToString() {
return partition.Device, utils.SDCard, nil
if utils.CameraGuess(partition.Mountpoint) == utils.Insta360.ToString() {
return partition.Mountpoint, utils.SDCard, nil
}
}
return "", "", mErrors.ErrNoCameraDetected
Expand Down

0 comments on commit 0936909

Please sign in to comment.