MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / device_add

Function device_add

TactilityKernel/source/device.cpp:111–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111error_t device_add(Device* device) {
112 LOG_D(TAG, "add %s", device->name);
113
114 // Already added
115 if (device->internal->state.started || device->internal->state.added) {
116 return ERROR_INVALID_STATE;
117 }
118
119 // Add to ledger
120 ledger_lock();
121 ledger.devices.push_back(device);
122 ledger_unlock();
123
124 // Add self to parent's children list
125 auto* parent = device->parent;
126 if (parent != nullptr) {
127 device_add_child(parent, device);
128 }
129
130 device->internal->state.added = true;
131 return ERROR_NONE;
132}
133
134error_t device_remove(Device* device) {
135 LOG_D(TAG, "remove %s", device->name);

Callers 5

DeviceTest.cppFile · 0.85
create_child_deviceFunction · 0.85
device_construct_addFunction · 0.85
createKernelDeviceHolderFunction · 0.85

Calls 1

device_add_childFunction · 0.85

Tested by

no test coverage detected