{"action":"created","issue":{"url":"https://api.github.com/repos/mbuesch/razer/issues/60","labels_url":"https://api.github.com/repos/mbuesch/razer/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/mbuesch/razer/issues/60/comments","events_url":"https://api.github.com/repos/mbuesch/razer/issues/60/events","html_url":"https://github.com/mbuesch/razer/pull/60","id":127032007,"number":60,"title":"WIP Writing conf","user":{"login":"mjtorn","id":78427,"avatar_url":"https://avatars.githubusercontent.com/u/78427?v=3","gravatar_id":"","url":"https://api.github.com/users/mjtorn","html_url":"https://github.com/mjtorn","followers_url":"https://api.github.com/users/mjtorn/followers","following_url":"https://api.github.com/users/mjtorn/following{/other_user}","gists_url":"https://api.github.com/users/mjtorn/gists{/gist_id}","starred_url":"https://api.github.com/users/mjtorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjtorn/subscriptions","organizations_url":"https://api.github.com/users/mjtorn/orgs","repos_url":"https://api.github.com/users/mjtorn/repos","events_url":"https://api.github.com/users/mjtorn/events{/privacy}","received_events_url":"https://api.github.com/users/mjtorn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-16T15:31:49Z","updated_at":"2016-01-18T17:23:29Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mbuesch/razer/pulls/60","html_url":"https://github.com/mbuesch/razer/pull/60","diff_url":"https://github.com/mbuesch/razer/pull/60.diff","patch_url":"https://github.com/mbuesch/razer/pull/60.patch"},"body":"Related to #49, I flexed my meager C skills to proof-of-concept this.\r\n\r\nI need help with at least the following:\r\n\r\n  1. Where should I save the options? The profile emulation code looked very disjointed from confs\r\n  1. Where is the configuration struct updated? It always writes out the exact same conf\r\n\r\nAt least it doesn't crash or leak memory ;)\r\n"},"comment":{"url":"https://api.github.com/repos/mbuesch/razer/issues/comments/172597350","html_url":"https://github.com/mbuesch/razer/pull/60#issuecomment-172597350","issue_url":"https://api.github.com/repos/mbuesch/razer/issues/60","id":172597350,"user":{"login":"mbuesch","id":3619761,"avatar_url":"https://avatars.githubusercontent.com/u/3619761?v=3","gravatar_id":"","url":"https://api.github.com/users/mbuesch","html_url":"https://github.com/mbuesch","followers_url":"https://api.github.com/users/mbuesch/followers","following_url":"https://api.github.com/users/mbuesch/following{/other_user}","gists_url":"https://api.github.com/users/mbuesch/gists{/gist_id}","starred_url":"https://api.github.com/users/mbuesch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbuesch/subscriptions","organizations_url":"https://api.github.com/users/mbuesch/orgs","repos_url":"https://api.github.com/users/mbuesch/repos","events_url":"https://api.github.com/users/mbuesch/events{/privacy}","received_events_url":"https://api.github.com/users/mbuesch/received_events","type":"User","site_admin":false},"created_at":"2016-01-18T17:23:29Z","updated_at":"2016-01-18T17:23:29Z","body":"Well, just writing the parsed config back to disk (it's what the code does) is not going to help. In fact, if that was the only thing missing, I'd long have implemented this. :)\r\n\r\nThe real part that is missing is synthesizing the configuration (the struct config_file tree) from the configuration structures that are hidden within the hardware drivers (hw_xxx.c/h files). _After_ that is done, the config tree can be written back to disk (which you do in this patchset).\r\n\r\nSo I didn't review razer_save_config() in detail, yet, but for sure I don't like the WRITE_... macros.\r\nAnd `/* Allocate extra memory to be sure */` is never going to work. :) It's always going to be not enough, no matter how much extra space you add. Reallocate, if it's not enough.\r\n\r\nAnyway, before we get the write function, we need the config-tree-synthesize/build (whatever you call it).\r\n\r\nSome other minor things:\r\nConfig things must go into config.c/h and not into librazer.c/h.\r\nAnd calling config write from reconfigure-mice call is completely bogus. What is that supposed to do?"}}