flipperzero-firmware
flipperzero-firmware copied to clipboard
iButton: Add support for Dallas DS1971
What's new
Added support to one_wire lib to read and write Dallas DS1971 chip. DS1971 is an iButton with 8 bytes fixed key (without CRC and starting with 0x14) and it contains 3 memory areas, one 8 byte application register (writeable only once), a temporary 32 bytes scratchpad and a 32 bytes re-writable memory. The code added allow a user to read key and memory from a DS1971 and save it as file then write memory contents saved into the file on the same iButton or on a different one.
Verification
Read a DS1971, save contents to sd-card, modify it, write it back on the DS1971 (or on a different one) and the read it again to check new data written on the memory.
Checklist (For Reviewer)
- [x] PR has description of feature/bug or link to Confluence/Jira task
- [x] Description contains actions to verify feature/bugfix
- [x] I've built this code, uploaded it to the device and verified feature/bugfix
Hi.
In order to accept this PR we need 2 things:
- emulation support
- example dumps (flipper should be able to read another flipper that emulating)
Hi, thanks for the update.
I've 2 flippers :-) so i'll proceed to implement emulation and provide dumps.
I'll update the code on PR as soon as it's ready.
Il sab 8 ott 2022, 15:39 あく @.***> ha scritto:
Hi.
In order to accept this PR we need 2 things:
- emulation support
- example dumps (flipper should be able to read another flipper that emulating)
— Reply to this email directly, view it on GitHub https://github.com/flipperdevices/flipperzero-firmware/pull/1815#issuecomment-1272322921, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPF4Y4CERYLVZ5VRBMKAWDWCF2SHANCNFSM6AAAAAAQ3BPA6Q . You are receiving this because you authored the thread.Message ID: @.***>
Updated code to fix emulation support for DS1971 and tested it with my flippers. Attached 2 dumps one took reading a "real" DS1971 with one flipper, then emulate the saved key. The other is read from the 2nd flipper while the other is emulating the original key. ds1971_dumps.zip
Please see my comment in PR thread.
Hello, i see that build fails, is there anything i should do? Is is a problem with API VERSION?
I had to change a signature on OneWrireDevice:
ApiEntryFunction(name='onewire_device_alloc', returns='OneWireDevice*', params='uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t')
Thanks.
@DrZlo13 got some ideas on architecture, we'll postpone this PR a little bit.
Ok, thank you for the update. Please let me know if you need anything from my end to make things easier for you.
Il giorno mar 18 ott 2022 alle ore 17:32 あく @.***> ha scritto:
@DrZlo13 https://github.com/DrZlo13 got some ideas on architecture, we'll postpone this PR a little bit.
— Reply to this email directly, view it on GitHub https://github.com/flipperdevices/flipperzero-firmware/pull/1815#issuecomment-1282587635, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPF4Y46AIL2GQ4ERXCNHD3WD27KJANCNFSM6AAAAAAQ3BPA6Q . You are receiving this because you authored the thread.Message ID: @.***>
Hello, and sorry for the long wait. I looked at the code and in its current form it is not ready enough for the merge. First we need to separate the ibutton_key from the ibutton app. Next - onewire_slave should be allocated with something like a "command list". But this will require rewriting the architecture and operation principle of the onewire_slave library, since it currently does not have a cmd receiver loop, and I will take on this task as soon as I finish the important ones.
Hello, thanks for the update and your findings.
While you work at the onewire_slave library cmd receiver what should i do? Remove the ibutton app part from the PR?
PLease let me know.
Il giorno gio 27 ott 2022 alle ore 17:27 Sergey Gavrilov < @.***> ha scritto:
Hello, and sorry for the long wait. I looked at the code and in its current form it is not ready enough for the merge. First we need to separate the ibutton_key from the ibutton app. Next - onewire_slave should be allocated with something like a "command list". But this will require rewriting the architecture and operation principle of the onewire_slave library, since it currently does not have a cmd receiver loop, and I will take on this task as soon as I finish the important ones.
— Reply to this email directly, view it on GitHub https://github.com/flipperdevices/flipperzero-firmware/pull/1815#issuecomment-1293705286, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPF4Y24KLNCHCOMXXQCO23WFKNOLANCNFSM6AAAAAAQ3BPA6Q . You are receiving this because you authored the thread.Message ID: @.***>
Hello, and sorry for the long wait. I looked at the code and in its current form it is not ready enough for the merge. First we need to separate the ibutton_key from the ibutton app. Next - onewire_slave should be allocated with something like a "command list". But this will require rewriting the architecture and operation principle of the onewire_slave library, since it currently does not have a cmd receiver loop, and I will take on this task as soon as I finish the important ones.
Hello, did you have time to look into onewire_slave? Thanks.
@DrZlo13 still waiting for you ;-)
What should i do on my side? Remove app code from the PR?
Please let me know.
Il sab 10 dic 2022, 21:23 あく @.***> ha scritto:
@DrZlo13 https://github.com/DrZlo13 still waiting for you ;-)
— Reply to this email directly, view it on GitHub https://github.com/flipperdevices/flipperzero-firmware/pull/1815#issuecomment-1345377438, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPF4Y6NH4IFTKPSJLMWBA3WMTRETANCNFSM6AAAAAAQ3BPA6Q . You are receiving this because you authored the thread.Message ID: @.***>
@baconlive nothing, @DrZlo13 will take care of it soon.
Thanks.
Il sab 10 dic 2022, 21:38 あく @.***> ha scritto:
@baconlive https://github.com/baconlive nothing, @DrZlo13 https://github.com/DrZlo13 will take care of it soon.
— Reply to this email directly, view it on GitHub https://github.com/flipperdevices/flipperzero-firmware/pull/1815#issuecomment-1345380034, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPF4Y2OZ5HZ4QTKFJKRIWDWMTS2ZANCNFSM6AAAAAAQ3BPA6Q . You are receiving this because you were mentioned.Message ID: @.***>
@baconlive nothing, @DrZlo13 will take care of it soon.
Any progress?
@baconlive I am currently working on 1-Wire and iButton refactoring, it'll take another couple of weeks.
Thanks. I'll wait for an update as soon as you're ready
Il lun 9 gen 2023, 11:05 Georgii Surkov @.***> ha scritto:
@baconlive https://github.com/baconlive I am currently working on 1-Wire and iButton refactoring, it'll take another couple of weeks.
— Reply to this email directly, view it on GitHub https://github.com/flipperdevices/flipperzero-firmware/pull/1815#issuecomment-1375367962, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPF4Y4AQFX7FIRNDYAGJMLWRPPGVANCNFSM6AAAAAAQ3BPA6Q . You are receiving this because you were mentioned.Message ID: @.***>
Hello Georgii, any progress on this?
Thanks
Il giorno lun 9 gen 2023 alle ore 11:42 Guido Giorgi @.***> ha scritto:
Thanks. I'll wait for an update as soon as you're ready
Il lun 9 gen 2023, 11:05 Georgii Surkov @.***> ha scritto:
@baconlive https://github.com/baconlive I am currently working on 1-Wire and iButton refactoring, it'll take another couple of weeks.
— Reply to this email directly, view it on GitHub https://github.com/flipperdevices/flipperzero-firmware/pull/1815#issuecomment-1375367962, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPF4Y4AQFX7FIRNDYAGJMLWRPPGVANCNFSM6AAAAAAQ3BPA6Q . You are receiving this because you were mentioned.Message ID: @.***>
@baconlive working on it right now, it is taking longer than expected, sorry!
I'll move this PR to draft while we prepare base for this PR
Ok, thank you!
Il mer 8 feb 2023, 12:36 あく @.***> ha scritto:
I'll move this PR to draft while we prepare base for this PR
— Reply to this email directly, view it on GitHub https://github.com/flipperdevices/flipperzero-firmware/pull/1815#issuecomment-1422455051, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPF4Y7VPRSUWGIMHFC2HQDWWOAMHANCNFSM6AAAAAAQ3BPA6Q . You are receiving this because you were mentioned.Message ID: @.***>
Any ETA for One wire library refactory?
Il mer 8 feb 2023, 13:32 Guido Giorgi @.***> ha scritto:
Ok, thank you!
Il mer 8 feb 2023, 12:36 あく @.***> ha scritto:
I'll move this PR to draft while we prepare base for this PR
— Reply to this email directly, view it on GitHub https://github.com/flipperdevices/flipperzero-firmware/pull/1815#issuecomment-1422455051, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPF4Y7VPRSUWGIMHFC2HQDWWOAMHANCNFSM6AAAAAAQ3BPA6Q . You are receiving this because you were mentioned.Message ID: @.***>
@baconlive At final stage, will be included in 0.79.
@baconlive Sorry for the long wait As you may have noticed, the refactoring is done (but hasn't been thoroughly tested yet) and is now in the dev branch.
To add support for DS1971, first create 2 files in lib/one_wire/ibutton/protocols/dallas
folder: touch protocol_ds1971.{c,h}
.
Use other protocols such as ds1992
or ds1990
as an example. You will need to implement all methods listed in protocol_dallas_base.h
, the only exceptions are write_blank
, write_copy
adn render_data
, in that case the corresponding protocol features must not be set.
Look into dallas_common
files to see if some of the code you need is already implemented there (for example, the reading of DS19xx ROM).
When done, add your new protocol to protocol_group_dallas_defs.{c,h}
files. Together with the 2 files you have created before, those are the only 4 files one needs to edit in order to add a new iButton key type.
@baconlive Sorry for the long wait As you may have noticed, the refactoring is done (but hasn't been thoroughly tested yet) and is now in the dev branch.
To add support for DS1971, first create 2 files in
lib/one_wire/ibutton/protocols/dallas
folder:touch protocol_ds1971.{c,h}
.Use other protocols such as
ds1992
ords1990
as an example. You will need to implement all methods listed inprotocol_dallas_base.h
, the only exceptions arewrite_blank
,write_copy
adnrender_data
, in that case the corresponding protocol features must not be set.Look into
dallas_common
files to see if some of the code you need is already implemented there (for example, the reading of DS19xx ROM).When done, add your new protocol to
protocol_group_dallas_defs.{c,h}
files. Together with the 2 files you have created before, those are the only 4 files one needs to edit in order to add a new iButton key type.
@gsurkov I've already tested the new implementation and successful added ds1971 "protocol" into my dev firmware, i'll have only to work out writing functions.
As soon as i finish i'll update the PR removing old updates and pushing the files.
Thanks you.
Hello , @gsurkov i finished setting up the code, but i made some mess on this PR so i preferred to open a new one:
iButton: Add support for Dallas DS1971 v2 #2492
As soon as you confirm everything is ok on the new PR i'll close this.
Thanks