mirror of
https://github.com/aaru-dps/aaruremote.git
synced 2025-12-16 19:24:37 +00:00
Condition compilation of Linux SDHCI to be able to find the include files for UAPI.
This commit is contained in:
@@ -8,6 +8,7 @@ set(MAIN_SOURCES main.c list_devices.c device.c scsi.c hex2bin.c usb.c ieee1394.
|
|||||||
if ("${CMAKE_SYSTEM}" MATCHES "Linux")
|
if ("${CMAKE_SYSTEM}" MATCHES "Linux")
|
||||||
set(PLATFORM_SOURCES linux/list_devices.c linux/linux.h linux/device.c linux/scsi.c linux/usb.c linux/ieee1394.c linux/pcmcia.c linux/ata.c linux/sdhci.c)
|
set(PLATFORM_SOURCES linux/list_devices.c linux/linux.h linux/device.c linux/scsi.c linux/usb.c linux/ieee1394.c linux/pcmcia.c linux/ata.c linux/sdhci.c)
|
||||||
find_library(HAS_UDEV NAMES udev)
|
find_library(HAS_UDEV NAMES udev)
|
||||||
|
find_path(UAPI_MMC ioctl.h /usr/include/linux/mmc/)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_executable(dicremote-${CMAKE_SYSTEM_PROCESSOR} ${MAIN_SOURCES} ${PLATFORM_SOURCES})
|
add_executable(dicremote-${CMAKE_SYSTEM_PROCESSOR} ${MAIN_SOURCES} ${PLATFORM_SOURCES})
|
||||||
@@ -17,6 +18,10 @@ if (HAS_UDEV)
|
|||||||
add_definitions(-DHAS_UDEV)
|
add_definitions(-DHAS_UDEV)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
if (UAPI_MMC)
|
||||||
|
add_definitions(-DHAS_UAPI_MMC)
|
||||||
|
endif ()
|
||||||
|
|
||||||
if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64")
|
if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64")
|
||||||
add_executable(dicremote-x86 ${MAIN_SOURCES} ${PLATFORM_SOURCES})
|
add_executable(dicremote-x86 ${MAIN_SOURCES} ${PLATFORM_SOURCES})
|
||||||
set_target_properties(dicremote-x86 PROPERTIES LINK_FLAGS -m32)
|
set_target_properties(dicremote-x86 PROPERTIES LINK_FLAGS -m32)
|
||||||
|
|||||||
@@ -15,12 +15,15 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef HAS_UAPI_MMC
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <linux/major.h>
|
#include <linux/major.h>
|
||||||
#include <linux/mmc/ioctl.h>
|
#include <linux/mmc/ioctl.h>
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int32_t LinuxSendSdhciCommand(int device_fd,
|
int32_t LinuxSendSdhciCommand(int device_fd,
|
||||||
uint8_t command,
|
uint8_t command,
|
||||||
@@ -36,6 +39,9 @@ int32_t LinuxSendSdhciCommand(int device_fd,
|
|||||||
uint32_t* duration,
|
uint32_t* duration,
|
||||||
uint32_t* sense)
|
uint32_t* sense)
|
||||||
{
|
{
|
||||||
|
#ifndef HAS_UAPI_MMC
|
||||||
|
return -1;
|
||||||
|
#else
|
||||||
struct mmc_ioc_cmd mmc_ioc_cmd;
|
struct mmc_ioc_cmd mmc_ioc_cmd;
|
||||||
int32_t error;
|
int32_t error;
|
||||||
*duration = 0;
|
*duration = 0;
|
||||||
@@ -68,4 +74,5 @@ int32_t LinuxSendSdhciCommand(int device_fd,
|
|||||||
memcpy((char*)response, (char*)&mmc_ioc_cmd.response, sizeof(uint32_t) * 4);
|
memcpy((char*)response, (char*)&mmc_ioc_cmd.response, sizeof(uint32_t) * 4);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user