Skip to content

Commit

Permalink
[Harddisk]
Browse files Browse the repository at this point in the history
* improve internal disk detection
  • Loading branch information
jbleyel committed Jan 14, 2025
1 parent 553a9b7 commit 7195ed0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/python/Components/Harddisk.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def getBlockDevInfo(self, blockdev):
partitions = []
try:
if exists(join(devpath, "removable")):
removable = bool(int(readFile(join(devpath, "removable"))))
removable = bool(int(readFile(join(devpath, "removable")))) #TODO: This needs to be improved because some internal disks have removable = 1
if exists(join(devpath, "dev")):
dev = int(readFile(join(devpath, "dev")).split(":")[0])
else:
Expand Down Expand Up @@ -533,7 +533,14 @@ def parseDeviceData(inputData):
device = eventData["DEVNAME"].replace("/dev/", "")
shortDevice = device[:7] if device.startswith("mmcblk") else sub(r"[\d]", "", device)
removable = fileReadLine(f"/sys/block/{shortDevice}/removable", source=MODULE_NAME)
eventData["SORT"] = 0 if ("pci" in eventData["DEVPATH"] or "ahci" in eventData["DEVPATH"]) and removable == "0" else 1
internal = ("pci" in eventData["DEVPATH"] or "ahci" in eventData["DEVPATH"])
if internal and removable == "1": # This is probably a driver bug
for physdevprefix, pdescription in list(getDeviceDB().items()):
if eventData["DEVPATH"].startswith(physdevprefix) and "SATA" in pdescription:
removable = "0" # Force removable to 0 if SATA
if removable == "1":
print("[Harddisk] Warning! internal and removable = 1")
eventData["SORT"] = 0 if internal or removable == "0" else 1
devices.append(eventData)
remove(fileName)

Expand Down

8 comments on commit 7195ed0

@Dima73
Copy link
Contributor

@Dima73 Dima73 commented on 7195ed0 Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbleyel
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, but this will also not fix the driver bug because removable is 1 and not 0

@fairbird
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is some thing wrong with mounting drives ...
For example if install multiboot plugin such as (Barryallen) and the image boot from external flash look the mount is wrong ..
even if I add manual mount in fstab like

/dev/sda1 /media/ba auto defaults 0 0

The mounted incorrectly

root@dm800se:# cat /etc/fstab
rootfs / auto defaults 1 1
proc /proc proc defaults 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0
tmpfs /var/volatile tmpfs defaults 0 0
#/dev/mtdblock2 /boot jffs2 ro 0 0
/dev/sda1 /media/ba auto defaults 0 0
root@dm800se:#
root@dm800se:# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 1.9G 1.3G 501.6M 72% /
devtmpfs 155.1M 16.0K 155.1M 0% /dev
/dev/sda1 64.0K 0 64.0K 0% /media/ba
devtmpfs 155.1M 16.0K 155.1M 0% /dev
/dev/sda1 64.0K 0 64.0K 0% /media/ba
tmpfs 64.0K 0 64.0K 0% /media
tmpfs 66.0M 224.0K 65.8M 0% /run
tmpfs 66.0M 152.0K 65.8M 0% /var/volatile

But on old my images no problem with /media/ba the mounted correctly

root@dm800se:# cat /etc/fstab
rootfs / auto defaults 1 1
proc /proc proc defaults 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0
tmpfs /var/volatile tmpfs defaults 0 0
/dev/sda1 /media/ba auto defaults 0 0
root@dm800se:#
root@dm800se:# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 1.9G 1.3G 501.8M 72% /
devtmpfs 155.1M 4.0K 155.1M 0% /dev
/dev/sda1 1.9G 1.3G 501.8M 72% /media/ba
devtmpfs 155.1M 4.0K 155.1M 0% /dev
tmpfs 64.0K 0 64.0K 0% /media
tmpfs 66.0M 164.0K 65.8M 0% /run
tmpfs 66.0M 640.0K 65.4M 1% /var/volatile
/dev/sda1 1.9G 1.3G 501.8M 72% /media/ba

Even if using Device manager to mount the drive still same issue (incorrect mounted)

Image

root@dm800se:# cat /etc/fstab
rootfs / auto defaults 1 1
proc /proc proc defaults 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0
tmpfs /var/volatile tmpfs defaults 0 0
#/dev/mtdblock2 /boot jffs2 ro 0 0
UUID=42531840-0652-423e-a883-741782791c34 /media/ba auto defaults 0 0
root@dm800se:
#
root@dm800se:~# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 1.9G 1.3G 501.8M 72% /
devtmpfs 155.1M 16.0K 155.1M 0% /dev
/dev/sda1 64.0K 0 64.0K 0% /media/ba
devtmpfs 155.1M 16.0K 155.1M 0% /dev
/dev/sda1 64.0K 0 64.0K 0% /media/ba
tmpfs 64.0K 0 64.0K 0% /media
tmpfs 66.0M 228.0K 65.8M 0% /run
tmpfs 66.0M 136.0K 65.9M 0% /var/volatile

@atvcaptain
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since BA is closed-source, we can't provide assistance with that.
I assume you mean that /dev/sda1 shows 1.9 GB in the old image but now only 64K in the new image. There’s no information on why it appears this way. Is /dev/sda not the same drive under BA? Is the blkid UUID identical?

@fairbird
Copy link
Contributor

@fairbird fairbird commented on 7195ed0 Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is same driver because only on driver connected with box (Usb Flash)

root@dm800se:~# blkid
/dev/sda1: LABEL="ba" UUID="42531840-0652-423e-a883-741782791c34" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="00020d9b-01"

And this is from old image

/dev/sda1: LABEL="ba" UUID="42531840-0652-423e-a883-741782791c34" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="00020d9b-01"

@atvcaptain
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, is the view just different while the free HDD space is still available? Are there any technical limitations on usage, or is it purely a visual difference?

@fairbird
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New image

root@dm800se:# ls -n /media/ba
root@dm800se:
#

Old image

root@dm520:~# ls -n /media/ba
drwxr-xr-x 2 1000 1000 4096 Feb 20 2024 BarryAllen
drwxr-xr-x 8 1000 1000 4096 Jan 1 1970 ba
-rwxr-xr-x 1 1000 1000 125901 Apr 19 2018 ba.sh
-rw-r--r-- 1 0 0 15 Jan 14 23:03 baboot.ini
drwxr-xr-x 4 0 0 4096 Jan 1 1970 backup
drwxr-xr-x 2 1000 1000 4096 Jan 1 1970 bin
-rw-r--r-- 1 0 0 1272 Nov 15 2023 epg.dat
drwxr-xr-x 2 1000 1000 4096 Jan 1 1970 fonts
drwxr-xr-x 2 1000 1000 4096 Jan 1 1970 lcd
drwxr-xr-x 2 1000 1000 4096 Jan 1 1970 logos
drwx------ 2 0 0 16384 Jan 1 1970 lost+found
drwxr-xr-x 2 1000 1000 4096 Jan 1 1970 script

Maybe the issue from this commit ..
oe-alliance/oe-alliance-core@515e2e3

@fairbird
Copy link
Contributor

@fairbird fairbird commented on 7195ed0 Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have solved with this commit
fairbird/openpli-dreambox-oe-core@49971eb

........

Also one more thing in custom option for mount feature cannot write more than one letter.
fairbird/enigma2-dreambox@1031c25

Please sign in to comment.