Macbook Pro Keyboard and Trackpad not working after battery change
If before replacing battery, your Mac's keyboard &amp; trackpad were working fine, then generally after replacing old battery, Mac MUST work fine, provided you've placed+inserted new battery correctly+completely, and you've made sure (old) keyboard &amp; trackpad connectors are properly connected.
KB = Keyboard . TP = Trackpad (aka: Touchpad).
Mac = Macintosh = MacBook Pro/Air/etc.
Replacing hardware parts (especially the TP), again, seems to be the remaining last option for your case.
Just do this extra step: Once you attach the ribbon flex cable connector (of KB, TP or battery, etc) onto Mac board's socket, then fully INSERT &amp; slide it in completely into the socket, then use the lock mechanism in the socket, and put a tape on it, (tape piece should cover the socket and bit more area around it, and some portion of the flex-cable as well.)
The reason I'm suggesting that, as I'm suspecting, this connection is not stable in your case, and some pins are disconnecting when you're re-assembling back, as your comment indicates that you later also obtained new keyboard &amp; trackpad, (so problem is not inside the keyboard or trackpad itself).
Low-Quality and/or older-generation Lithium battery packs in Mac can degrade very quickly when HEAT or high-temperature is applied or around the Mac.
When battery swell-up it pushes/expands upward, few components that suffer from this, one of them is Trackpad (aka: Touchpad), etc.
Trackpad's touch sensor may have developed cracks or some circuit has disconnected partially, so replacing atleast Trackpad may be necessary.
Heat expands different type of materials at different rate, so electrical disconnect, etc can occur from this.
Your sentence is not clear enough what exactly you've ordered-for, is it just the &quot;ribbon flex&quot; cable-conector, Or new keaboard &amp; trackpad ? i would guess that you've ordered new keyboard &amp; new trackpad (which includes new ribbon-flex connector).
New ones should work, &amp; you may need to reset SMC and reset NVRAM/PRAM, see below details.
If new ones (new battery, new keayboard, new trackpad) are correct item for your exact Mac model# and still not working, then my remaining deduction would be, that, your Mac board itself has disconnected/faulty circuits near the area where battery pack is.

KB = Keyboard . TP = Trackpad (aka: Touchpad).
Mac = Macintosh = MacBook Pro/Air/etc.
You may be already aware-of and already applied the solutions mentioned in this answer, but I'm including it anyway, so that other users with a similar problem can understand what options are there, and how to do it systematically.

When the keyboard and trackpad stops working, are unresponsive or partially not-working, then in problem(s) like this, Mac owners have to use USB based mouse and keyboard.

After attaching external, wired/hardware based USB Mouse, Mac owner MUST do these:

Click the Apple () icon in top menu bar → select ⚙ System Preferences from your menu bar.
Open Accessibility → select the &quot;Pointer Control&quot; in left-side column → select &quot;Mouse and Trackpad&quot; Tab → find this option line &quot;Ignore built-in trackpad when mouse or wireless trackpad are present&quot; and select it.
inside Accessibility, select the &quot;Keyboard&quot; in left-side column → select &quot;Accessibility Keyboard&quot; Tab → find this option line &quot;Enable Accessibility Keyboard&quot; and select it. Then it lets you type and interact with macOS without using a hardware keyboard.
if you have a hardware based Keyboard with USB connector, then skip this number 4 step, Or else, if you only have a USB-Mouse, then follow these steps: go back to the ⚙ System Preferences → click &quot;Keyboard&quot; icon → select &quot;Keyboard&quot; Tab → then select the &quot;Show keyboard and emoji viewers in menu bar&quot; option. In top Apple menu bar you will see a keyboard icon ⌨ or you will see your country/location  Flag icon, click on it, choose the &quot;Show Keyboard Viewer&quot; option. A small ⌨ window will appear which will display keyboard's key-buttons. To use this software keyboard, click on key-buttons with your USB-mouse.
turn-off Bluetooth in Mac.


KB = Keyboard . TP = Trackpad (aka: Touchpad).
( Few unicode symbols from IEC : Power - &amp;#x23FB; - | ⏽ . Toggle Power - &amp;#x23FC; - ⏼ . Power On - &amp;#x23FD; - ⏽ . Power Off - &amp;#x2B58; - ⭘ . Sleep Mode - &amp;#x23FE; - ⏾ )

TROUBLESHOOT:
After you've done ⚙ System Preferences configuration shown above, then take below troubleshoot steps (before getting/ordering hardware parts)

Update System Firmware: load all updates from Apple, &amp; also all Security updates from Apple.
Unplug USB-mouse &amp; KB, and check if internal KB &amp; TP are working or not.
If internal KB &amp; TP are working then NO need to follow any other steps, but if NOT-working then plug back in your USB-mouse &amp; KB.

if previous (firmware update) step did not work, then Reset SMC: detail instruction is here, and a brief summary is shown below:

if your Mac model's battery is removable, then: Turn off Mac; Unplug power adapter; Open bottom/backside (P5 pentalobe) screws that are keeping the lower-case attached with internal frame &amp; board, remove (all) battery pack(s); then press &amp; hold-down ⏽ Power button for 10 seconds. Mac will be discharged completely, &amp; SMC will reset. Re-attach the battery pack(s), connect power supply adapter &amp; plug.
if your Mac model's battery is NOT-removable (that is, it is inside the laptop, &amp; so opening-up lower-case is necessary to remove battery packs, then do not unscrew &amp; do not remove lower-case), keep power supply connected to Mac, then first press these THREE buttons altogether (left-side) ^ Control + (left-side) ⌥ Option + (right-side) ⇧ Shift for 7 to 10 seconds, then also press &amp; hold the FOURTH button, the ⏽ Power button, and keep press &amp; hold these FOUR buttons altogether for 7 to 10 seconds more, then you will see that Mac has began shutdown process, and in this stage it will also automatically reset SMC.

if your Mac computer's specific model has Apple T2 Security Chip then above instruction is valid for that type of Macs.
if your specific Mac model has no T2 chip, then press &amp; hold all of those FOUR button altogether from beginning, &amp; just use left-side ⇧ Shift button, instead of right-side.


Unplug power cord/plug, for around 15-seconds.
Unplug external USB mouse &amp; KB, &amp; wait for around 5-seconds.
Turn ON Mac with ⏽ Power button.
Check, if internal KB &amp; TP are working or not: if internal KB &amp; TP are working then NO-need to follow next steps,
but if internal KB &amp; TP are still not working, then plug back in your external USB-mouse &amp; KB.




if above/previous steps did not work, then Reset (Parameter RAM) PRAM: detail instruction is here, and a brief summary is shown below:

shutdown Mac completely, use ⏽ Power button. Sometime shutdown process needs time, so wait around 60-seconds for shutdown. And after 15-seconds of shutdown, press ⏽ Power button (to start the Mac), &amp; immediately after pressing ⏽ Power button, press &amp; hold down these FOUR buttons altogether: ⌘ Command + ⌥ Option + P + R, and keep on holding all of those buttons for 20 seconds. Based on your Mac model# during those 20-seconds you will either hear the STARTUP sound for 2nd-time, Or you will see the Apple LOGO  (or a GRAY-SCREEN) appearing &amp; going-away, twice. When you will hear STARTUP sound SECOND-TIME Or when you will see Apple LOGO () DISAPPEARING SECOND-TIME, then release all those FOUR buttons. Then you should see, Mac is restarting/rebooting, and starting with normal boot process, (if this does not happen by itself in your specific Mac model# , then press ⏽ Power button once).
Unplug external USB-mouse &amp; KB,
Check, if internal KB &amp; TP are working or not, (if internal KB &amp; TP working then NO-need to follow next steps), but if internal KB &amp; TP are still not working then plug in your external USB mouse &amp; KB back.




.plist = Property-List .  cmd = Command .
KB = Keyboard . TP = Trackpad (aka: Touchpad).

FEW MORE TROUBLESHOOT OPTIONS:

Safe-Mode : in safe mode, macOS disables all 3rd-party extensions &amp; software, some (Apple)-system extensions (which are not required in safe-mode), etc, etc.
Began to shutdown Mac and wait for around 60-seconds to complete shutdown. Then, wait around 15-seconds, and turn ON Mac with ⏽ Power button, and immediately after that Press &amp; hold onto the ⇧ Shift button, until you reach login credential (username &amp; password) entering screen, then release ⇧ Shift button.
(if you've disabled login into Mac to reach Mac Desktop mode quickly, then hold onto ⇧ Shift button for around 90-seconds after you see Mac desktop, then release ⇧ Shift button.)
In &quot;Safe-Mode&quot; you'll see the words ”Safe Boot” in top-right corner of screen.
Check if internal KB &amp; TP are working or not, if working then (try to) find out which 3rd-party software's extension is causing this conflict that in normal-mode KB &amp; TP stop working. (Follow the &quot;REMOVE .plist FILES&quot; step in below).
If internal KB &amp; TP still did not work/response in &quot;Safe mode&quot;, then this step indicated, problem is NOT related with any 3rd-party extensions or any (3rd-party) startup software,
So plug back in USB-mouse &amp; KB, and Shutdown or &quot;Restart&quot; Mac, and goto next step.
MOVE .plist FILES FROM ~/Library/Preferences/ (aka: &quot;User Library/Preferences&quot; folder) INTO ~/Desktop/Backup/MyLibraryPreferences/ FOLDER:

first source folder you have to go in is ~/Library/Preferences/, so follow these steps : open &quot;Finder&quot; (file browser) → click/select your Mac storage drive → find &amp; go inside &quot;Users&quot; folder → then go inside the folder that has your UserName, f.e. in my case its &quot;atErik&quot; → press ⌘ Command + ⇧ Shift + &gt;̣ buttons (Command+Shift+dot) altogether for once, it will goto &quot;Unhide Files and Folders&quot; mode (aka: Unhide/Unhidden Files and Directories mode, aka: show hidden files &amp; folders mode) temporarily. Find &amp; go inside the &quot;Library&quot; folder, then find &amp; go inside the &quot;Preferences&quot; folder.
• Here, the beginning ~ (tilde) symbol means: inside your HOME directory/folder. The ~ is a shortened form of, for-example: /Users/atErik/ folder, Or /Users/&lt;UserName&gt;/ folder (aka: &quot;HOME&quot; folder/directory).
• So ~/Library/Preferences/ in its expanded form, indicates to /Users/atErik/Library/Preferences/ folder (or /Users/&lt;UserName&gt;/Library/Preferences/ folder).


Move below .plist files into a &quot;Backup&quot; folder on your Mac Desktop:
• Select all of these below property-list files (they have .plist filename-extension) and also select other .plist files related to any (KTM) keyboard, trackpad, touchpad or mouse, then select &quot;Copy&quot; option for all selected files by using ⌘ Command + C ( or use &quot;Copy&quot; option in Finder's &quot;Edit&quot; menu. )
• Then in &quot;Finder&quot; goto your &quot;Desktop&quot;, create a folder &quot;Backup&quot; (if it does not exists), then inside the &quot;Backup&quot; create another sub-folder &quot;MyLibraryPreferences&quot;.
• Now you MUST MOVE those selected .plist files into ~/Desktop/Backup/MyLibraryPreferences/ folder, by using ⌘ Command + ⌥ Option + V buttons ( Or goto &quot;Edit&quot; menu in &quot;Finder&quot; file-browser, &amp; press &amp; hold ⌥ Option button in software/hardware KB, you will see that &quot;Paste&quot;-mode will change, &amp; &quot;Move&quot;-mode will appear &amp; available, so select &quot;Move&quot; option. )
• You may have to enter a privileged admin type of user's username &amp; password, to complete the &quot;Move&quot; process.
SELECT .plist FILES:
• com.apple.driver.AppleBluetoothMultitouch.trackpad.plist1 (Magic Trackpad)
• com.apple.driver.AppleBluetoothMultitouch.mouse.plist (Magic mouse)
• com.apple.driver.AppleBluetoothMultitouch.trackpad.plist
• com.apple.AppleMultitouchTrackpad.plist
• com.apple.preference.trackpad.plist
• com.apple.driver.AppleHIDMouse.plist (wired USB mouse)
• com.apple.AppleMultitouchMouse.plist
(to select multiple files, you have to press ⌘ Command button before clicking on next/another .plist file)
(Mac will auto-create above files with default settings, after a restart/start)

3RD-PARTY : 1st-party is you (your own developed software/scripts, etc). 2nd-party is Apple developed software running on Apple developed macOS. And 3rd-party is who is not you/1st-party &amp; is not Apple/2nd-party, so it is OTHER software developer.
3rd-party software often uses their parent company (or developer) name or their own company (or one of the developer's) name or uses the software name for their software files &amp; directories/folders.
So to detect 3rd-party software files, you will need to know 3rd-party software's company name or developer name also.
3rd-party can+may use these set of folders, which can+may reside inside here (&quot;/Library/&quot;) or here(&quot;~/Library/&quot;) or both : &quot;.../Application Support/&quot;, &quot;.../Caches/&quot;, &quot;.../Containers/&quot;, &quot;.../Frameworks/&quot;, &quot;.../Logs/&quot;, &quot;.../Preferences/&quot;, &quot;.../Saved/&quot;, &quot;.../Application State/&quot;, &quot;.../WebKit/&quot;, etc.
Disable (temporarily) all 3rd-party AUTO STARTUP items, &amp; Login-time auto-start items, services, applications, etc:
• We will disable those (by using CLI+GUI, etc) temporarily after making backup (so that they can be retrieved/restored easily later).
• Open the &quot;Terminal&quot; (press Fn + F4 &gt; click on &quot;Other&quot; icon &gt; click on &quot;Terminal&quot;) : To view hidden files &amp; folders in &quot;Finder&quot;, in Terminal run this
cmd: sudo defaults write com.apple.finder AppleShowAllFiles -bool true
To apply the above new settings, we have to stop all running &quot;Finder&quot; instances/sessions, (macOS will auto start a new instance of &quot;Finder&quot; after we stop all), do that with cmd: killall Finder
• NOTE: Do Not Use The Word &quot;cmd:&quot; Itself, When You Copy Or Paste A Command From Here, I Used &quot;cmd:&quot; Here To Make It Clear That Words Used After &quot;cmd:&quot; (inside grey box) are (&quot;Terminal&quot;) commands.
• run cmd: launchctl list to view various STARTUP items. Keep a backup list what items are set as STARTUP item, with
cmd: dt=&quot;/bin/date +'%Y-%m-%d_%H-%M-%S'&quot; ; dv=`$dt` ; launchctl list &gt; ~/launchctl-list_${dv}.txt ; unset dt; more ~/launchctl-list_${dv}.txt &amp;&amp; unset dv;
• These (AUTO-STARTUP) type of software items/componenets are placed inside these folders usually : &quot;/Library/StartUpItems/&quot; (items in it are launched by system when Mac system starts-up), &quot;/Library/LaunchDaemons/&quot; (launched by system &quot;root&quot;-user when system starts-up, with bit more detail or specific options), &quot;/Library/LaunchAgents/&quot; (items in it are launched by user-account when user logins, so these are LOGIN-time AUTO-START items), macOS also starts various system &amp; other software items from &quot;/System/Library/LaunchDaemons/&quot; folder (items are launched by &quot;root&quot;-user at system startup) &amp; &quot;/System/Library/LaunchAgentsitems/&quot; folder (items are launched by user-account when user logins), but these two &quot;/System/...&quot; folders are usually for CORE system components &amp; must not-be changed/touched by any general users, unless you're capable to work in that level. 3rd-party software must-not be inside &quot;/System/...&quot;.  And 3rd-party LOGIN AUTO-START items are also inside &quot;~/Library/LaunchAgents/&quot; or &quot;/Users/&lt;UserName&gt;/Library/LaunchAgents/&quot; folders (items in it are launched by user-account when user logins).
• Move (all 3rd-party &amp; risky 2nd-party) items from LaunchDaemons &amp; LaunchAgents, etc into a backup folder after disabling them, (and also save attribute &amp; property list of all files in those folders), with this shell script/program here: https://GitHub.com/atErik/Disable-MacOS-3rd-Party-Startup
• after moving above items, make another backup list of STARTUP items, with
cmd: dt=&quot;/bin/date +'%Y-%m-%d_%H-%M-%S'&quot; ; dv=`$dt` ; launchctl list &gt; ~/launchctl-list_${dv}.txt ; unset dt; more ~/launchctl-list_${dv}.txt &amp;&amp; unset dv; 
• Below PLIST files also contain STARTUP items (and not-disabled even in Safe-Mode, so these can be RISKY/abused) and these MUST-NOT be used by any 3rd-Party, unless it has SHOWN you this (below &quot;/private/var/db/launchd.db/...&quot;) data &amp; informed you &amp; obtained your fully-aware full &amp; explicit consent to use it:
 /private/var/db/launchd.db/com.apple.launchd.peruser.501/overrides.plist
 /private/var/db/launchd.db/com.apple.launchd/overrides.plist
Run this cmd to view list of these PLIST files: sudo ls -Gal /private/var/db/launchd.db/
User can view items in them with these
 cmd: nano /private/var/db/launchd.db/com.apple.launchd.peruser.501/overrides.plist
 cmd: sudo nano /private/var/db/launchd.db/com.apple.launchd/overrides.plist
Run this: launchctl list &amp; findout which &quot;Label&quot; does NOT begin with &quot;com.apple...&quot;, so those are 3rd-party STARTUP items, and use below commands to disable them.
Disable 3rd-party and RISKY 2nd-Party items in above two PLIST files, with such EXAMPLE commands:
 disable &quot;rexecd&quot;: sudo defaults write /private/var/db/launchd.db/com.apple.launchd/overrides.plist 'com.apple.rexecd' -dict Disabled -bool true ; 
now with &quot;nano&quot; open the plist, and apply similar &quot;Disabled&quot; pattern of XML-codes, on other entries that are 3rd-party or risky 2nd-party items.
Some (harmful) developer's App/pkg installer sets-up various non-standard (and constitutional amendment violating) ways (one of such shown in above) to start various (fishy, aka: Anti-Privacy, etc) items (by violating the Privacy-Rights, human-rights, etc to SPY &amp; data-collect, etc), So one way to quickly &amp; temporarily disable these fishy/immoral/unethical activities is, MOVE them in a different folder :  with &quot;Finder&quot;, go inside &quot;Applications&quot;, select all apps that are 3rd-party apps (installed by you), (to multi-select, use ⌘ Command button each time before you select/click on an app), then in &quot;Finder&quot; select &quot;Copy&quot; option in &quot;Edit&quot; (or press ⌘ Command + C altogether for once), then on your Mac &quot;Desktop&quot; create a new folder &quot;Backup&quot;, then create a sub-folder &quot;Apps&quot; inside the &quot;Backup&quot;. Go inside that &quot;Apps&quot; &amp; press ⌘ Command + ⌥ Option + V buttons altogether once (or goto &quot;Edit&quot; menu in &quot;Finder&quot;, press ⌥ Option &amp; then select &quot;Move&quot; option), you may have to enter a privileged admin type of user's username &amp; password to complete the MOVE process. (Don't forget to restart Mac once, after below steps).
Remove/Delete 3rd-party auto startup items, login-items, services, applications, etc software items, (if you prefer to use GUI for it, &amp; if you don't want to make backup) : Goto ⚙ System Preferences → click on &quot;Users &amp; Groups&quot; icon → select your username (or nickname) on left side column/pane → select &quot;Login Items&quot; Tab → you'll see list of startup items, select an item &amp; press the “–” sign below to remove it → Done. Later by using the “+” you can add some (not-all) items back.




MOVE .plist FILES FROM /Library/Preferences/ (aka: &quot;Mac Library/Preferences&quot;) INTO ~/Desktop/Backup/MacLibraryPreferences/ FOLDER:
• In &quot;Finder&quot; → click/select your Mac storage drive → press ⌘ Command + ⇧ Shift + &gt;̣ buttons (Command+Shift+dot) altogether for once to show hidden files &amp; folders, → find &amp; go inside &quot;Library&quot; folder, → then find &amp; go inside &quot;Preferences&quot; folder, → and check-for &amp; find &amp; select .plist files (that are shown &amp; listed in above), → also find &amp; select any other (KTM) keyboard &amp; trackpad &amp; touchpad &amp; mouse related .plist files, → then select &quot;Copy&quot; option for all selected files by using ⌘ Command + C (or use &quot;Copy&quot; option in Finder's &quot;Edit&quot; menu).
• Goto your &quot;Desktop&quot; folder, find &amp; go inside &quot;Backup&quot; folder, create a sub-folder &quot;MacLibraryPreferences&quot; inside the &quot;Backup&quot;.
• Now you MUST MOVE those selected .plist files into ~/Desktop/Backup/MacLibraryPreferences/ folder, by using ⌘ Command + ⌥ Option + V buttons ( Or goto &quot;Edit&quot; menu in &quot;Finder&quot; file-browser, &amp; press &amp; hold ⌥ Option button in software/hardware KB, you will see that &quot;Paste&quot;-mode will change, &amp; &quot;Move&quot;-mode will appear &amp; available, so select &quot;Move&quot; option. )
• You have to enter a privileged admin type of user's username &amp; password, to complete the &quot;Move&quot; process.
Shutdown or &quot;Restart&quot; your Mac, and unplug USB-mouse &amp; KB (immediately after clicking on &quot;Restart&quot;/shutdown). Wait around 15-seconds.
Boot/Start your Mac, and check if internal KB &amp; TP are working or not, if yes then NO-need to follow next steps,
if internal KB &amp; TP are still not-working after SAFE-MODE &amp; PLIST-REMOVAL, then follow (shown in above) SMC-reset &amp; PRAM-reset steps AGAIN,
and again check if internal KB &amp; TP are working or not, if yes then NO-need to follow next steps,
if internal KB &amp; TP are still not-working, then plug back in (external) USB-mouse &amp; KB, &amp; Restart Mac.
HARDWARE INFO: run below shown commands inside Terminal. NOTE: output is obtained from an old MacBook-Pro, so your Mac output will be different based on your MacBook model#:

cmd:  ioreg | grep Keyboard
normally, when internal keyboard works, then you should see (6-Lines of) similar output shown below, with above command:
•     | |   |       |     |   +-o Apple Internal Keyboard / Trackpad@1d183000  &lt;class IOUSBHostDevice, id 0x100012c9c, registered, matched, active, busy 0 (7371 ms), retain 33&gt;
•     | |   |       |     |     +-o Apple Internal Keyboard@0  &lt;class IOUSBHostInterface, id 0x100012ca7, registered, matched, active, busy 0 (7357 ms), retain 11&gt;
•     | |   |       |     |     | +-o AppleUSBTCKeyboard@1d183000,0  &lt;class AppleUSBTCKeyboard, id 0x100012cb1, registered, matched, active, busy 0 (7349 ms), retain 8&gt;
•     | |   |       |     |     |     +-o AppleEmbeddedKeyboard  &lt;class AppleEmbeddedKeyboard, id 0x100012d0d, registered, matched, active, busy 0 (0 ms), retain 8&gt;
•     | |   | +-o Apple Internal Keyboard / Trackpad@1d183000  &lt;class AppleUSBDevice, id 0x100012c9e, registered, matched, active, busy 0 (1 ms), retain 15&gt;
•     | |   | | +-o Apple Internal Keyboard@0  &lt;class AppleUSBInterface, id 0x100012caa, registered, matched, active, busy 0 (0 ms), retain 5&gt;
cmd:  ioreg | grep Trackpad
normally, when internal trackpad works, then you should see (2-Lines of) similar output shown below, with above command:
•     | |   |       |     |   +-o Apple Internal Keyboard / Trackpad@1d183000  &lt;class IOUSBHostDevice, id 0x100012c9c, registered, matched, active, busy 0 (7371 ms), retain 33&gt;
•     | |   | +-o Apple Internal Keyboard / Trackpad@1d183000  &lt;class AppleUSBDevice, id 0x100012c9e, registered, matched, active, busy 0 (1 ms), retain 15&gt;
cmd:  ioreg | grep Touchpad
normally, when internal trackpad (aka: Touchpad) works, then you should also see (4-Lines of) similar output shown below, when above command is run:
•     | |   |       |     |     +-o Touchpad@1  &lt;class IOUSBHostInterface, id 0x100012ca8, registered, matched, active, busy 0 (551 ms), retain 11&gt;
•     | |   |       |     |     +-o Touchpad@2  &lt;class IOUSBHostInterface, id 0x100012ca9, registered, matched, active, busy 0 (10 ms), retain 11&gt;
•     | |   | | +-o Touchpad@1  &lt;class AppleUSBInterface, id 0x100012cad, registered, matched, active, busy 0 (0 ms), retain 5&gt;
•     | |   | | +-o Touchpad@2  &lt;class AppleUSBInterface, id 0x100012caf, registered, matched, active, busy 0 (0 ms), retain 5&gt;
if similar lines (like above) are not-present in your output, then obviously the hardware has failed or is disconnected.
If similar lines are present, (and internal KB &amp; TP are still not-working properly), then thats indicating: some software/settings, etc are causing conflict, Or there is a partial hardware malfunction.
NOTE/REQUEST TO OP @esqarrouth (if you want to, then) please EDIT your post and put a word &quot;EDIT:&quot; at bottom-side of your top/1st post message, and then show output of above three &quot;ioreg&quot; commands, so that others can see the output &amp; analyze.
Please use one ` backtick symbol (aka: back-quote, aka: grave-accent) in beginning of each &quot;output&quot; code-line (Backtick button  ̀̃ is in top-left corner of keyboard, under the esc). Any text or code inside 2-Backticks creates an &quot;inline&quot;-mode code-line which can wrap at-edge without crossing-over &amp; all text or code is also viewable without sliding left/right. And at-end of each code-line please also use one-more ` backtick-symbol and two &quot;space&quot; characters. Two-spaces at-end of a text/code line, creates a Line-Break(LB) &lt;br /&gt;.
so i.e. the `a ̪test ̪code-line` ̪ ̪ ( &quot;space&quot; character is shown as  ̪ )
will become: a test code-line




f.e. = for example . i.e. = in example . e.g. = example goes.
KB = Keyboard . TP = Trackpad (aka: Touchpad).

REPLACE HARDWARE:
if troubleshoot steps (mentioned in above) did not solve problem,
Replace hardware parts (at-least replace keyboard) by yourself. Its better to replace both KB &amp; TP at same time.
When you have a chance, read-up on these, watch videos on YouTube, etc: it will become very easy to you once you watch few videos &amp; read docs, then if you're confident to do it by yourself, order hardware parts.
So begin with the sites below:

MacBook Pro 15&quot; Retina Display Mid 2015 Repair
especially read this answer to &quot;z&quot; Key not working, Command key also, and;
here is a YouTube video: Macbook Pro 15&quot; Retina A1398 Change Keyboard.

After you've replaced (internal) keyboard/trackpad, unplug external USB-mouse &amp; KB, and check+test if internal KB &amp; TP are working or not, if working then NO-need to plug back in USB-mouse &amp; KB, and go back to previously mentioned options in &quot;Accessibility&quot;, and change/suite with your preference/choice.
But if internal KB &amp; TP are not-working then plug back in (external) USB mouse &amp; KB.