hoerbert-software icon indicating copy to clipboard operation
hoerbert-software copied to clipboard

SD card is not properly recognized under Linux (possible fix attached)

Open fmauch opened this issue 1 year ago • 7 comments

Hi,

On my Linux system the SD card is not properly recognized inside the software (tested version 2.1.5 built from source and version 3.1.3 from AppImage on Archlinux with systemd=253). As the Software FAQ already notes the workaround of specifying the mountpoint manually, this seems to be a known and common problem.

When skimming through the source code, it seems to fail in the isRemovable method of the DeviceManager. I noticed, that the check for ID_USB_DRIVER='usb-storage' indeed is not in the output of the udevadm info call regarding my mounted drive. My output of udevadm info --query=property --export --name=/dev/mmcblk0 is

DEVPATH='/devices/pci0000:00/0000:00:02.1/0000:02:00.0/rtsx_pci_sdmmc.0/mmc_host/mmc0/mmc0:aaaa/block/mmcblk0'
DEVNAME='/dev/mmcblk0'
DEVTYPE='disk'
DISKSEQ='6'
MAJOR='179'
MINOR='0'
SUBSYSTEM='block'
USEC_INITIALIZED='1384769046'
ID_SERIAL='0x535809eb'
ID_NAME='SN64G'
ID_PATH='pci-0000:02:00.0-platform-rtsx_pci_sdmmc.0'
ID_PATH_TAG='pci-0000_02_00_0-platform-rtsx_pci_sdmmc_0'
ID_PART_TABLE_TYPE='dos'
MMC_TYPE='SD'
ID_DRIVE_FLASH_SD='1'
ID_DRIVE_MEDIA_FLASH_SD='1'
DEVLINKS='/dev/disk/by-path/pci-0000:02:00.0-platform-rtsx_pci_sdmmc.0 /dev/disk/by-id/mmc-SN64G_0x535809eb /dev/disk/by-diskseq/6'
TAGS=':systemd:'
CURRENT_TAGS=':systemd:'

When replacing the regex in the code with

    return output.contains(QRegExp("ID_DRIVE_FLASH_SD='1'", Qt::CaseSensitive));

the drive is properly recognized. I'm not sure whether that change would fix things on other systems, as well.

It would be nice to have the latest version here on Github, btw. It does not feel right to open a PR on a 3 year old version, which is why I created this issue instead.

fmauch avatar Mar 03 '23 21:03 fmauch

It looks like checking /sys/block/mmcblk0/removable might be the preferred way. Does a path like that exist?

https://stackoverflow.com/a/73302717

It would be nice to have the latest version here on Github, btw.

Someone figured out that the feedback branch is the current one: https://github.com/winzkigermany/hoerbert-software/tree/feedback

jmr avatar Mar 04 '23 08:03 jmr

Yes, for historical reasons, the feedback branch is the most recent. I've never changed that so far, "works for me" (TM). ;-)

Thank you for your feedback. Still I'm "slow to respond" and it will take me a while to incorporate your research.

winzkigermany avatar Mar 04 '23 09:03 winzkigermany

Glad to hear that the feedback branch is actually the recent version :-)

@jmr cat /sys/block/mmcblk0/removable contains a 0 for me, so this seems not to be working that reliably?

fmauch avatar Mar 04 '23 10:03 fmauch

cat /sys/block/mmcblk0/removable contains a 0 for me

Maybe report this as a bug to your distribution. Do fixed and unknown files exist, and what do they contain?

jmr avatar Mar 04 '23 10:03 jmr

Maybe report this as a bug to your distribution. Do fixed and unknown files exist, and what do they contain?

fixed and unknown do not exist.

Who is responsible for filling this? Is this also coming directly from systemd?

fmauch avatar Mar 04 '23 10:03 fmauch

fixed and unknown do not exist.

I just saw those strings here, so I thought maybe there were files for them, too:

https://mjmwired.net/kernel/Documentation/ABI/testing/sysfs-devices-removable

Who is responsible for filling this?

I believe /sys comes from the kernel.

jmr avatar Mar 11 '23 07:03 jmr