MissionControl/btdrv-mitm/source/btdrv_shim.c

123 lines
3.6 KiB
C
Raw Normal View History

#include "btdrv_shim.h"
#include <stratosphere/sf/sf_mitm_dispatch.h>
2020-05-22 10:29:36 +00:00
Result btdrvInitializeBluetoothFwd(Service* s, Handle *out_handle) {
return serviceMitmDispatch(s, 1,
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
2020-05-22 10:29:36 +00:00
.out_handles = out_handle,
);
}
2020-05-22 10:29:36 +00:00
Result btdrvFinalizeBluetoothFwd(Service* s) {
return serviceMitmDispatch(s, 4);
}
/*
2020-06-09 19:58:32 +00:00
Result btdrvCancelBondFwd(Service* s, const BluetoothAddress *address) {
const struct {
BluetoothAddress address;
} in = { *address };
return serviceMitmDispatchIn(s, 12, in);
}
*/
2020-06-09 19:58:32 +00:00
/*
2020-05-22 10:29:36 +00:00
Result btdrvGetEventInfoFwd(Service* s, BluetoothEventType *type, u8 *buffer, size_t size) {
return serviceMitmDispatchOut(s, 15, *type,
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_Out },
.buffers = { {buffer, size} }
);
}
*/
2020-05-22 10:29:36 +00:00
Result btdrvInitializeHidFwd(Service* s, Handle *out_handle, u16 version) {
return serviceMitmDispatchIn(s, 16, version,
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
.out_handles = out_handle,
);
}
Result btdrvWriteHidDataFwd(Service* s, const BluetoothAddress *address, const BluetoothHidData *data) {
const struct {
BluetoothAddress address;
} in = { *address };
return serviceMitmDispatchIn(s, 19, in,
.buffer_attrs = { SfBufferAttr_FixedSize | SfBufferAttr_HipcPointer | SfBufferAttr_In },
.buffers = { {data, sizeof(BluetoothHidData)} }
);
}
/*
Result btdrvGetPairedDeviceInfoFwd(Service* s, const BluetoothAddress *address, BluetoothDevicesSettings *device) {
const struct {
BluetoothAddress address;
} in = { *address };
return serviceMitmDispatchIn(s, 25, in,
.buffer_attrs = { SfBufferAttr_FixedSize | SfBufferAttr_HipcPointer | SfBufferAttr_Out },
.buffers = { {device, sizeof(BluetoothDevicesSettings)} }
);
}
*/
2020-05-22 10:29:36 +00:00
Result btdrvFinalizeHidFwd(Service* s) {
return serviceMitmDispatch(s, 26);
}
/*
2020-05-22 10:29:36 +00:00
Result btdrvGetHidEventInfoFwd(Service* s, HidEventType *type, u8 *buffer, size_t size) {
return serviceMitmDispatchOut(s, 27, *type,
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_Out },
.buffers = { {buffer, size} }
);
}
*/
2020-05-22 10:29:36 +00:00
Result btdrvRegisterHidReportEventFwd(Service* s, Handle *out_handle) {
return serviceMitmDispatch(s, hosversionBefore(4, 0, 0) ? 36 : 37,
2020-05-22 10:29:36 +00:00
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
.out_handles = out_handle,
);
}
Result btdrvGetHidReportEventInfoDeprecatedFwd(Service* s, HidEventType *type, u8 *buffer, size_t size) {
return serviceMitmDispatchOut(s, hosversionBefore(4, 0, 0) ? 37 : 38, *type,
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_Out },
.buffers = { {buffer, size} }
);
}
2020-05-22 10:29:36 +00:00
Result btdrvGetHidReportEventInfoFwd(Service* s, Handle *out_handle) {
return serviceMitmDispatch(s, 38,
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
.out_handles = out_handle,
);
}
Result btdrvInitializeBleFwd(Service* s, Handle *out_handle) {
return serviceMitmDispatch(s, 46,
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
.out_handles = out_handle,
);
}
Result btdrvFinalizeBleFwd(Service* s) {
return serviceMitmDispatch(s, 49);
}
/*
Result btdrvGetBleManagedEventInfoFwd(Service* s, BleEventType *type, u8 *buffer, u16 length) {
if (hosversionBefore(5, 0, 0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatchOut(s, hosversionBefore(5, 1, 0) ? 78 : 79, *type,
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_Out },
.buffers = { {buffer, length} }
);
}
*/