-
-
Notifications
You must be signed in to change notification settings - Fork 568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for pronto codes on chuangmi.remote.h102a03 #495
Comments
Could you try to play pronto codes with 38400 baud? Could you provide the mDNS name of the device? I would like to add it to the list of supported/discoverable devices: https://github.com/rytilahti/python-miio/blob/master/miio/discovery.py#L53 |
Thanks for your quick response! I assume you mean a raw converted from the Pronto code? The Pronto method doesn't have a baud/frequency parameter. # My code
>>> ir.play_raw('6UzAFQCAACoBAAAUQkAAGxiAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAEBAQABAAEAAAAwAgABAQEAAQABAAAAMA==', 38400)
['ok']
# From specs
>>> ir.play_raw('Z6VHAD0CAACdBgAA2ggAAJsRAABQIwAAyZ8AAMF3AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAQEBAQEBAQAAAQABAAAAAAEAAQABAQEBBQJGA=', 38400)
['ok'] Same thing - no flashing, no transmission. The mDNS name as far as I can tell is EDIT: I realise I wasn't in debug mode for these two tests - let me know if you want me to run them again with debug logging on. |
following methods are also present in firmware: get_indicatorLamp i can share firmware file in case you are interested for analyze. |
|
@yawor Do you like to provide some support here? It's about pronto codes ;-) |
It looks like the LED of the devices can be controlled by:
If somebody likes to test these commands I will extend python-miio afterwards. |
"chuangmi-remote-h102a03_": ChuangmiIr, you should remove underscore. |
I used the underscore as separator here. |
for all miio wifi devices you can get model name like this: $model = str_replace("-",".",stristr($ssid,"_",true)); so underscore should be redundant here. |
If another model is called "chuangmi-remote-h102a03b" and incompatible with the |
OK, but with this logic you might as well add underscore to any device listed in discovery.py, because if they release for example zhimi-airpurifier-v10 (match zhimi-airpurifier-v1) it shouldn't be reported as supported ;) or model matching should be done like i wrote above, it's how miio sdk does it and how mi home builds model string to compare with model list for selected region. anyway it's fine for me, one underscore is not worth an argue ;) |
You are totally right. Any input is appreciated! :-) Feel free to provide additional feedback and/or PRs. :-) |
@syssi My suspicions were correct, this is the blue LED on the front which is usually on all the time and flashes when a command is sent. It's the light I'm referring to "not flashing" when the codes above are not understood. If you turn it off, it's off all the time even when successfully playing commands. This corresponds to the setting in the app called "Instruction light", but I think "Indicator light" is a more accurate English name. $ miiocli device raw_command get_indicatorLamp "[]"
Running command raw_command
['on']
$ miiocli device raw_command set_indicatorLamp "['off']"
Running command raw_command
['ok']
$ miiocli device raw_command get_indicatorLamp "[]"
Running command raw_command
['off'] $ miiocli device raw_command set_indicatorLamp "['on']"
Running command raw_command
['ok']
$ miiocli device raw_command get_indicatorLamp "[]"
Running command raw_command
['on'] |
@syssi this is not definitive as I've only glimpsed on what @nikrolls posted, but it seems that the IR format has changed. If I'm correct then this needs to be reverse engineered like the previous format for chuangmi. |
@nikrolls do you have an universal remote control by any chance? If yes it would be helpful to program it to a device of a known protocol, parameters and commands. |
chuangmi.ir.v2 does not support led methods, chuangmi.remote.v2 does. |
@yawor These were recorded off the universal remote that I have - an Xbox One with Kinect. I can enter a 4-digit TV code and it will play discreet codes for power on and off. I'm testing on a Sony Brava 32V4000, but codes as low level as these are standard across most Sony TVs. Raw codes below are captured using the Chuangmi H102A03, Pronto codes are according to an apparently reliable source on Remote Central.
I also have other codes I captured from the TV's own remote:
I should be able to set the Xbox to any other TV with a four digit code and capture at least power commands (and possibly volume commands) from it for reference. |
@nikrolls awesome. This should be enough to attempt reversing the format if it's not encrypted or compressed in any complicated way. |
Great! Also let me know if you want me to set my Xbox to a specific model and capture power codes. |
@nikrolls you could record few signals for example for LG and Samsung. |
Great - I'll record some from other manufacturers. I can also try recording the above signals again a few times to see if they change a lot every time. If they do, I wonder if there's some kind of hashing or encryption over a temporal value going on? I probably won't get any recordings done in the next 24 hours, but I'll try after that. |
you should probably check libcompression.so from plugin lib folder, that's where decode/encode is done. |
@rezmus that was awesome tip. It would take a lot longer if I had to do full analysis of the disassembled/decompiled code, but fortunately they've left names of functions which directed me to a heatshrink compression library. It is based on LZSS compression and has really low memory footprint so it's ideal for embedded applications like this. |
@rezmus BTW you can delete the link to the file. It's better not to keep it here longer than necessary (in case of some legal issues). |
Good news! At the bottom level, the format is still the same as before. Here's what they did here:
So all we need to do is to add the 2 last steps to the current pronto conversion to add support for this device. |
Fantastic news! That was quick 😊 |
My proposition is to subclass |
@nikrolls can you try these? |
Fixes rytilahti#495, rytilahti#619, rytilahti#811 Closes rytilahti#501 Partially covers rytilahti#1020
Fixes rytilahti#495, fixes rytilahti#619, fixes rytilahti#811 Closes rytilahti#501 Partially covers rytilahti#1020
Fixes rytilahti#495, fixes rytilahti#619, fixes rytilahti#811 Closes rytilahti#501 Partially covers rytilahti#1020
Fixes rytilahti#495, fixes rytilahti#619, fixes rytilahti#811 Closes rytilahti#501 Partially covers rytilahti#1020
Fixes rytilahti#495, fixes rytilahti#619, fixes rytilahti#811 Closes rytilahti#501 Partially covers rytilahti#1020
Fixes rytilahti#495, fixes rytilahti#619, fixes rytilahti#811 Closes rytilahti#501 Partially covers rytilahti#1020
Fixes rytilahti#495, fixes rytilahti#619, fixes rytilahti#811 Closes rytilahti#501 Partially covers rytilahti#1020
All kudos to original work by @yawor's on PR rytilahti#501. Fixes rytilahti#495, fixes rytilahti#619, fixes rytilahti#811 Closes rytilahti#501 Partially covers rytilahti#1020
All kudos to original work by @yawor's on PR rytilahti#501. Fixes rytilahti#495, fixes rytilahti#619, fixes rytilahti#811 Closes rytilahti#501 Partially covers rytilahti#1020
All kudos to original work by @yawor's on PR rytilahti#501. Fixes rytilahti#495, fixes rytilahti#619, fixes rytilahti#811. Closes rytilahti#501. Partially covers rytilahti#1020.
All kudos to original work by @yawor's on PR rytilahti#501. Fixes rytilahti#495, fixes rytilahti#619, fixes rytilahti#811. Closes rytilahti#501. Partially covers rytilahti#1020.
All kudos to original work by @yawor's on PR rytilahti#501. Fixes rytilahti#495, fixes rytilahti#619, fixes rytilahti#811. Closes rytilahti#501. Partially covers rytilahti#1020.
@rezmus could you give a link to the firmware pls? |
which model? |
chuangmi.remote.v2 |
Thank you! |
Do you know of any tool that extracts the elf file from the .bin image? I'm seeing 7 segments and will probably end up dumping all of them, but I was just wondering if there is a ready made tool that does this already. |
@mpsOxygen isn't it other way around? The firmware bin image should be a pure executable (just machine code + program data). ELF format defines a container for linkable execs (more or less) which is much more than what you have in the bin file. Microcontrollers usually don't use ELF, just pure machine code, as the entry point to the application is predetermined depending on the µC used. |
He explains it better than I can: https://www.youtube.com/watch?v=w4_3vwN_2dI So the initial app is just an elf then that gets converted to esp32 binary format. They also wrote a tool, you can find it here: https://github.com/tenable/esp32_image_parser Haven't used it yet. |
OK, it's more like a conversion between formats than extraction. |
I am using Ghidra and tried with this: https://github.com/tslater2006/esp32_flash_loader |
Do you also have this module? https://github.com/yath/ghidra-xtensa |
Can I also get the file? |
it's just ota, i don't have this model. |
Thanks for the file. This a content of an application partition (doesn't matter if it's a factory, OTA1 or OTA2, the application format itself is the same). It means it's a complete executable running on the device, so it should be possible to disassemble it, but it's going to require some work. I'll look into it. |
I've been able to convert the app image into ELF format after fixing the |
Looks like the yath Xtensa Processor for Ghidra is a bit lacking. Using this one I've had way better results: https://github.com/Ebiroll/ghidra-xtensa Also use this svd loader plugin with the esp32.svd file in order to get all the peripherals: https://github.com/leveldown-security/SVD-Loader-Ghidra Also using the C header files from esp-idf with Parse C source helps with some of the types. Unfortunately there are so many functions and no names that it is really hard to pick out the ones that handle IR. :( |
A lot of the code is from stdlib and ESP-IDF. Quite large part is the FreeRTOS code, which implement multi-threading. But recognising which parts of the binary contain what may be quite difficult task for sure. |
I have a model of the Xiaomi IR remote that reports as
chuangmi.remote.h102a03
. It works fine when capturing and replaying those captured raw commands, but any commands converted from Pronto do nothing - no flashing light, no response from the target device, but - quite puzzlingly - anok
response from the device's API.Here is the device on Ali Express.
Here are some examples:
Unfortunately I don't have a clue where to start, or I'd tinker with the code myself. I'm happy to work with you if you need to test things on my device.
The text was updated successfully, but these errors were encountered: