2020-05-11 20:30:08 +00:00
|
|
|
#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) {
|
2020-05-11 20:30:08 +00:00
|
|
|
return serviceMitmDispatch(s, 1,
|
|
|
|
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
|
2020-05-22 10:29:36 +00:00
|
|
|
.out_handles = out_handle,
|
2020-05-11 20:30:08 +00:00
|
|
|
);
|
|
|
|
}
|
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-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} }
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
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)} }
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-06-02 21:24:40 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
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} }
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Result btdrvRegisterHidReportEventFwd(Service* s, Handle *out_handle) {
|
2020-06-12 21:25:09 +00:00
|
|
|
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,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-06-12 21:25:09 +00:00
|
|
|
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);
|
|
|
|
}
|