Skip to content

Commit

Permalink
Merge pull request xbmc#25805 from enen92/udev_fix_condition
Browse files Browse the repository at this point in the history
Linux/Udev: Fix optical detection logic
  • Loading branch information
enen92 authored Oct 24, 2024
2 parents 9a8d74b + e0c228b commit 1166fa4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions xbmc/platform/linux/storage/UDevProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,12 @@ bool CUDevProvider::PumpDriveChangeEvents(IStorageEventsCallback *callback)
if (strcmp(action, "change") == 0 && !(bd && strcmp(bd, "1") == 0))
{
const char *optical = udev_device_get_property_value(dev, "ID_CDROM");
bool isOptical = optical && (strcmp(optical, "1") != 0);
const bool isOptical = optical && (strcmp(optical, "1") == 0);
storageDevice.type =
isOptical ? MEDIA_DETECT::STORAGE::Type::OPTICAL : MEDIA_DETECT::STORAGE::Type::UNKNOWN;
storageDevice.path = devnode;

if (mountpoint && !isOptical)
if (mountpoint && isOptical)
{
CLog::Log(LOGINFO, "UDev: Changed / Added {}", mountpoint);
if (callback)
Expand Down

0 comments on commit 1166fa4

Please # to comment.