vault backup: 2023-02-09 10:15:32

This commit is contained in:
2023-02-09 10:15:32 +08:00
parent 2df85850d1
commit 77cefc1b5c
2 changed files with 42 additions and 18 deletions

View File

@@ -70,9 +70,25 @@
"source": true
}
}
},
{
"id": "2aeedceb130f867a",
"type": "leaf",
"state": {
"type": "canvas",
"state": {
"file": "00. Inbox/vc-fwUpdate code trace(Meetup).canvas",
"viewState": {
"x": 1552.3897794741633,
"y": 910.7442852486145,
"zoom": -1.102208107762325,
"snapToGrid": false
}
}
}
}
],
"currentTab": 2
"currentTab": 5
}
],
"direction": "vertical"
@@ -130,7 +146,7 @@
"state": {
"type": "backlink",
"state": {
"file": "01. 個人/01. Daily/2023-02-08(週三).md",
"file": "00. Inbox/vc-fwUpdate code trace(Meetup).canvas",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
@@ -174,7 +190,7 @@
"state": {
"type": "outline",
"state": {
"file": "01. 個人/01. Daily/2023-02-08(週三).md"
"file": "00. Inbox/vc-fwUpdate code trace(Meetup).canvas"
}
}
}
@@ -200,7 +216,7 @@
"periodic-notes:Open today": false
}
},
"active": "0b6b6ed3e2bd92d0",
"active": "2aeedceb130f867a",
"lastOpenFiles": [
"05. 資料收集/HEIF.md",
"01. 個人/01. Daily/2023-02-08(週三).md",

View File

@@ -5,40 +5,44 @@
{"id":"58150c82625254cd","x":233,"y":-462,"width":662,"height":215,"type":"text","text":"`vc-fwUpdate\\Backends\\MeridianBackend\\registration.cpp`\n```cpp\nlogitech::fwupdate::backend::RegisterBackend(IUpdateController& controller) {\n\n}\n```\n\n這邊開始建立所有的 update task以下所列的 task 都繼承自 `class UpdateTask`\n使用 `controller.RegisterTask(...)` 來註冊各個 task"},
{"id":"e01a865b5a13d6e9","x":-247,"y":-537,"width":480,"height":51,"type":"text","text":"`controller_ = controller::CreateUpdateController();`"},
{"id":"7d8839591c30f61a","x":-247,"y":-462,"width":406,"height":60,"type":"text","text":"`backend::RegisterBackend(*controller_);`"},
{"id":"c1122f185b292a7c","x":-247,"y":-227,"width":480,"height":145,"type":"text","text":"`vc-fwUpdate\\Frontends-developer\\LogiFWUpdate\\Ui\\LogiFWUpdateDlg.cpp:2761`\n\n--------------------------------------------\n\n`InitializeImageProviders()`"},
{"id":"6aab61cd927b9307","x":-434,"y":-48,"width":311,"height":60,"type":"text","text":"`Impl::RegisterForPnpNotification()`"},
{"id":"dade636ce2d72147","x":-434,"y":40,"width":250,"height":60,"type":"text","text":"`Impl::InitializeTasks()`"},
{"id":"5f57db192293a0ec","x":257,"y":-537,"width":168,"height":51,"type":"text","text":"`Impl() d_`"},
{"id":"5e7c147cd533a922","x":453,"y":-537,"width":289,"height":51,"type":"text","text":"`d_->CreatePnpProvider();`"},
{"id":"7ff8bac3fc3253f1","x":-434,"y":642,"width":311,"height":55,"type":"text","text":"`Impl::InitializeDynamicControls()`"},
{"id":"c1122f185b292a7c","x":-247,"y":-227,"width":480,"height":145,"type":"text","text":"`vc-fwUpdate\\Frontends-developer\\LogiFWUpdate\\Ui\\LogiFWUpdateDlg.cpp:2761`\n\n--------------------------------------------\n\n`InitializeImageProviders()`"},
{"id":"cd7947e8636e6b51","x":779,"y":-596,"width":347,"height":110,"type":"text","text":"建立一個看不見的window背後會有一個 thread 來接收 device notification events`WM_DEVICECHANGE`"},
{"id":"5db0c6d04d6655c7","x":1007,"y":-462,"width":269,"height":60,"type":"text","text":"`AudioDeviceUpdateTask`"},
{"id":"f3ccd922e41c8fa2","x":1007,"y":-396,"width":250,"height":60,"type":"text","text":"`BLEDeviceUpdateTask`"},
{"id":"3668ba992c38b26a","x":1007,"y":-330,"width":250,"height":60,"type":"text","text":"`AudioCodecUpdateTask`"},
{"id":"aa2444242b481f93","x":1007,"y":-247,"width":250,"height":55,"type":"text","text":"`VideoDeviceUpdateTask`"},
{"id":"eca2584c45b6e6d5","x":1007,"y":-167,"width":250,"height":60,"type":"text","text":"`VideoEepromUpdateTask`"},
{"id":"ce300adbc95c5a4b","x":-7,"y":40,"width":369,"height":113,"type":"text","text":"```cpp\nfor (...) {\n task->GetDeviceInfo(initialQuery)\n}\n```"},
{"id":"cb5dc2c4eb714d15","x":-7,"y":231,"width":369,"height":223,"type":"text","text":"`vc-fwUpdate\\Frontends-developer\\LogiFWUpdate\\Ui\\LogiFWUpdateDlg.cpp:2117`\n\n----\n```cpp\nfor (...) {\n task->GetImageInfo();\n}\n```"},
{"id":"b272fd16c8f236a3","x":-7,"y":499,"width":432,"height":60,"type":"text","text":"```cpp\ncontroller_->SetTaskEnabled(taskId, enable);\n```"},
{"id":"7ff8bac3fc3253f1","x":-434,"y":642,"width":311,"height":55,"type":"text","text":"`Impl::InitializeDynamicControls()`"},
{"id":"b2215d89fc0b5735","x":-600,"y":-1160,"width":3450,"height":312,"type":"group","label":"GUI Update Procedure"},
{"id":"bca845f9b6b579f8","x":699,"y":-1041,"width":397,"height":117,"type":"text","text":"```cpp\nfor (auto& p : tasks_) {\n task->PerformUpdate();\n task->GetUpdateResult(taskSuccessful);\n}\n```"},
{"id":"dd3394779b454c65","x":1134,"y":-1093,"width":413,"height":222,"type":"text","text":"`vc-fwUpdate\\Backends\\CommonBackend\\UpdateTask.cpp`\n\n----\n先 `DoOpenDevice()` ,確認裝置 ok。\n然後 `d_->imageProvider_->Open();`\n\n最後 `DoPerformUpdate();`"},
{"id":"1b43952d80e220e4","x":1607,"y":-1098,"width":502,"height":230,"type":"text","text":"`vc-fwUpdate\\Backends\\CommonBackend\\VideoEepromUpdateTask.cpp`\n\n----\n```cpp\nvoid\nlogitech::fwupdate::backend::VideoEepromUpdateTask::DoPerformUpdate() {\n d_->PerformUpdate();\n}\n```"},
{"id":"798d72cd46e3502b","x":-579,"y":-1075,"width":398,"height":52,"type":"text","text":"`CLogiFWUpdateDlg::OnBnClickedUpdateDevice()`"},
{"id":"f6cfbfc1376ca01e","x":-121,"y":-1140,"width":424,"height":182,"type":"text","text":"`d_->PerformUpdate();`\n⬇\n```cpp\nbool CLogiFWUpdateDlg::Impl::PerformUpdate() {\n\n}\n```"},
{"id":"a659de4263799b85","x":364,"y":-1138,"width":291,"height":50,"type":"text","text":"`controller_->StartUpdate();`"},
{"id":"b398a6dd7e91ef4e","x":405,"y":-1008,"width":250,"height":50,"type":"text","text":"`d_->StartUpdate();`"},
{"id":"5d03eb8ecaadd1dd","x":-970,"y":-911,"width":339,"height":181,"type":"text","text":"`vc-fwUpdate\\Frontends-developer\\LogiFWUpdate\\Ui\\LogiFWUpdateDlg.cpp`\n\n----\n`BOOL CLogiFWUpdateDlg::OnInitDialog()`"},
{"id":"3668ba992c38b26a","x":1007,"y":-330,"width":250,"height":60,"type":"text","text":"`AudioCodecUpdateTask`"},
{"id":"aa2444242b481f93","x":1007,"y":-247,"width":250,"height":55,"type":"text","text":"`VideoDeviceUpdateTask`"},
{"id":"eca2584c45b6e6d5","x":1007,"y":-167,"width":250,"height":60,"type":"text","text":"`VideoEepromUpdateTask`"},
{"id":"bca845f9b6b579f8","x":699,"y":-1041,"width":397,"height":117,"type":"text","text":"```cpp\nfor (auto& p : tasks_) {\n task->PerformUpdate();\n task->GetUpdateResult(taskSuccessful);\n}\n```"},
{"id":"dd3394779b454c65","x":1134,"y":-1093,"width":413,"height":222,"type":"text","text":"`vc-fwUpdate\\Backends\\CommonBackend\\UpdateTask.cpp`\n\n----\n先 `DoOpenDevice()` ,確認裝置 ok。\n然後 `d_->imageProvider_->Open();`\n\n最後 `DoPerformUpdate();`"},
{"id":"1b43952d80e220e4","x":1607,"y":-1098,"width":502,"height":230,"type":"text","text":"`vc-fwUpdate\\Backends\\CommonBackend\\VideoEepromUpdateTask.cpp`\n\n----\n```cpp\nvoid\nlogitech::fwupdate::backend::VideoEepromUpdateTask::DoPerformUpdate() {\n d_->PerformUpdate();\n}\n```"},
{"id":"ed5fc2b9d34dbdd7","x":713,"y":-55,"width":1587,"height":307,"type":"group","label":"DoOpenDevice()"},
{"id":"551e749e0cf332d3","x":733,"y":-27,"width":635,"height":249,"type":"text","text":"```cpp\nDoOpenDevice()\n⬇\nd_->OpenDevice();\n⬇\nUvcDeviceFactory().CreateUvcDevice({ UsbVidLogitech, UsbVideoPid });\n⬇\nWindowsUvcDevice::FindDevice(usbId);\n⬇\nImpl::OpenUvcDevice(usbId.Vid, usbId.Pid, devicePath, friendlyName);\n```"},
{"id":"18c6dbc9cf46e214","x":1438,"y":-32,"width":333,"height":260,"type":"text","text":"`Impl::OpenUvcDevice` 會使用\n```cpp\nSetupDiGetClassDevs(...)\nSetupDiEnumDeviceInterfaces(...)\n```\n等 API 來列舉裝置。\n\n----\n在 `Impl::OpenUvcDevice` 也會打開 XU 。\n在 `uvcDevice->d_->Init();` 裡面。"},
{"id":"c0e439a5140dbceb","x":1837,"y":-35,"width":443,"height":267,"type":"text","text":"`vc-fwUpdate\\UpdateController\\WindowsUvcDevice.cpp`\n\n----\n\n`uvcDevice->d_->Init();` 也就是 `Impl::Init()`\n會呼叫 `InitExtensionUnits();`,其呼叫順序:\n```cpp\nInitExtensionUnits();\n⬇\nEnumNodePropertySets();\n⬇\nDeviceIoControl(...)\n```\n\n"},
{"id":"ce300adbc95c5a4b","x":-7,"y":40,"width":369,"height":113,"type":"text","text":"```cpp\nfor (...) {\n task->GetDeviceInfo(initialQuery)\n}\n```"},
{"id":"cb5dc2c4eb714d15","x":-7,"y":231,"width":369,"height":223,"type":"text","text":"`vc-fwUpdate\\Frontends-developer\\LogiFWUpdate\\Ui\\LogiFWUpdateDlg.cpp:2117`\n\n----\n```cpp\nfor (...) {\n task->GetImageInfo();\n}\n```"},
{"id":"b272fd16c8f236a3","x":-7,"y":499,"width":432,"height":60,"type":"text","text":"```cpp\ncontroller_->SetTaskEnabled(taskId, enable);\n```"},
{"id":"eed51d8e5331c29c","x":2160,"y":-1061,"width":664,"height":156,"type":"text","text":"```cpp\nbool\nlogitech::fwupdate::backend::VideoEepromUpdateTask::Impl::PerformUpdate() {\n SendImage(ActionProgress(progress_, 90));\n ...\n RebootDevice();\n}\n```"},
{"id":"5d03eb8ecaadd1dd","x":-970,"y":-911,"width":339,"height":181,"type":"text","text":"`vc-fwUpdate\\Frontends-developer\\LogiFWUpdate\\Ui\\LogiFWUpdateDlg.cpp`\n\n----\n`BOOL CLogiFWUpdateDlg::OnInitDialog()`"},
{"id":"4d601b6034046222","x":-474,"y":777,"width":861,"height":205,"type":"text","text":"```cpp\nbool silentUpdate = ci.GetOption(L\"silentupdate\") ? true : false;\nbool forceUpdate = ci.GetOption(L\"force\")? true: false;\n\nauto cli = make_unique<cliwrapper>(logfile, version, forceUpdate, recovery, launcher, restartUpdate);\n\nbool success = cli->Initialize();\ncli->InitializeTasks();\nret = cli->PerformUpdate();\n```"},
{"id":"12867a0e216a1bc9","x":-970,"y":784,"width":420,"height":192,"type":"text","text":"`vc-fwUpdate\\Frontends-developer\\LogiFWUpdate\\Ui\\LogiFWUpdate.cpp`\n\n----\n```cpp\nBOOL CLogiFWUpdateApp::InitInstance() {\n ...\n}\n```"},
{"id":"60b67cb8ae948ca8","x":-964,"y":1053,"width":855,"height":410,"type":"group","label":"namespace: clifrontend"},
{"id":"37bf2c4c95808bcf","x":-944,"y":1078,"width":533,"height":365,"type":"text","text":"```cpp\nclass cliwrapper\n{\n struct Impl;\n\npublic:\n cliwrapper(...);\n ~cliwrapper();\n\n bool Initialize();\n int\t PerformUpdate();\n void InitializeTasks();\n void InitializeTask(string taskID, string imagePath);\n void Log(string message);\nprivate:\n std::unique_ptr<Impl>\td_;\n};\n```"},
{"id":"87dcc9769cfa192f","x":-390,"y":1078,"width":256,"height":365,"type":"text","text":"```cpp\nstruct cliwrapper::Impl\n{\n\t\n};\n```"}
{"id":"87dcc9769cfa192f","x":-390,"y":1078,"width":256,"height":365,"type":"text","text":"```cpp\nstruct cliwrapper::Impl\n{\n\t\n};\n```"},
{"id":"28a3f76dba8f2283","x":584,"y":605,"width":544,"height":129,"type":"text","text":"```cpp\nbool cliwrapper::Impl::Initialize() {\n\tcontroller_ = controller::CreateUpdateController();\n\t...\n}\n```"},
{"id":"162f50d1dd604161","x":584,"y":777,"width":544,"height":205,"type":"text","text":"```cpp\nvoid cliwrapper::InitializeTasks()\n{\n\td_->SetImageProvider();\n\t...\n\td_->EnableTasks();\n\t...\n\td_->ListTasks();\n}\n```"},
{"id":"ac73b0f38a1fad67","x":1264,"y":555,"width":818,"height":650,"type":"text","text":"`d_->EnableTasks();`\n\n-----\n```cpp\nvoid cliwrapper::Impl::EnableTasks()\n{\n\t...\n\tconst auto tasks = controller_->GetTasks();\n\tfor (auto task : tasks)\n\t{\n\t\tbool bMiracast = false;\n\t\tconst auto& taskId = task->GetId();\n\t\t...\n\t\tconst auto deviceInfo = task->GetDeviceInfo();\n\t\tconst auto imageInfo = task->GetImageInfo();\n\n\t\t// Enable or disable the task according to the following rules:\n\t\t// - Disable the task unconditionally if there is either no device or no image.\n\t\t// - If a command-line override is present apply it.\n\t\t// - Otherwise compare the image and device versions.\n\t\tbool enable = false;\n\t\tif (deviceInfo.Present && imageInfo.Present)\n\t\t{\n\t\t\t...\n\t\t\trel = compare(deviceInfo.Version, imageInfo.Version);\n\t\t\t...\n\t\t}\n\t\tcontroller_->SetTaskEnabled(taskId, enable);\n\t}\n}\n```"},
{"id":"72f0552d9251b235","x":2197,"y":602,"width":844,"height":556,"type":"text","text":"```cpp\nconst auto tasks = controller_->GetTasks();\n```\n↓\n```cpp\nvector<const IUpdateTask *>\nlogitech::fwupdate::controller::UpdateController::GetTasks() const\n{\n return d_->GetTasks();\n}\n```\n\n-----\n以下是 `d_->GetTasks();` 的 code\n\n```cpp\nvector<const IUpdateTask *>\nlogitech::fwupdate::controller::UpdateController::Impl::GetTasks() const\n{\n\tvector<const IUpdateTask *> tasks(tasks_.size());\n\n\ttransform(cbegin(tasks_), cend(tasks_), begin(tasks),\n\t\t[] (const pair<IUpdateTask::IdType, TaskInfo>& p) { return p.second.Task.get(); });\n\n\treturn tasks;\n}\n```"}
],
"edges":[
{"id":"b621a476fd748a7d","fromNode":"35301ec811a15aa2","fromSide":"bottom","toNode":"e01a865b5a13d6e9","toSide":"left"},
@@ -73,6 +77,10 @@
{"id":"c8bf7d8b482bfe48","fromNode":"dd3394779b454c65","fromSide":"right","toNode":"1b43952d80e220e4","toSide":"left"},
{"id":"04fcccc24a59d13e","fromNode":"1b43952d80e220e4","fromSide":"right","toNode":"eed51d8e5331c29c","toSide":"left"},
{"id":"1fa5f7d458e72c17","fromNode":"dd3394779b454c65","fromSide":"bottom","toNode":"ed5fc2b9d34dbdd7","toSide":"top","color":"#ffdd00","label":"DoOpenDevice()"},
{"id":"742e84e0e8003c92","fromNode":"12867a0e216a1bc9","fromSide":"right","toNode":"4d601b6034046222","toSide":"left"}
{"id":"742e84e0e8003c92","fromNode":"12867a0e216a1bc9","fromSide":"right","toNode":"4d601b6034046222","toSide":"left"},
{"id":"f8737a0fce99043d","fromNode":"4d601b6034046222","fromSide":"right","toNode":"28a3f76dba8f2283","toSide":"left"},
{"id":"e88c921961a6c0e3","fromNode":"4d601b6034046222","fromSide":"right","toNode":"162f50d1dd604161","toSide":"left"},
{"id":"5ac5aaa4291a990d","fromNode":"162f50d1dd604161","fromSide":"right","toNode":"ac73b0f38a1fad67","toSide":"left"},
{"id":"753699a3a9e8f59c","fromNode":"ac73b0f38a1fad67","fromSide":"right","toNode":"72f0552d9251b235","toSide":"left"}
]
}