basic osfp support, combine the powers of reads/parse#305
basic osfp support, combine the powers of reads/parse#305rcgoodfellow wants to merge 2 commits intomainfrom
Conversation
bnaecker
left a comment
There was a problem hiding this comment.
Thanks for putting this up! I've got a few nits and one bigger question, let me know if something isn't clear.
| fn parse<'a>(id: Identifier, reads: impl Iterator<Item = &'a [u8]>) -> Result<Self, Error>; | ||
|
|
||
| /// Use `reads` and `parse` together to collect data from a buffer. | ||
| fn from_buf(id: Identifier, data: &[u8]) -> Result<Self, Error> { |
There was a problem hiding this comment.
How is this being or going to be used? It looks like data needs to already have the entire memory map of the module in order for the offsets in the reads to correctly index it. Also, this doesn't take into account the page information in the reads, so I'm not sure how this would be used to parse that spans more than one page.
There was a problem hiding this comment.
I'm currently using this to parse EEPROM data made available by a Linux kernel driver as a file in sysfs.
There was a problem hiding this comment.
I don't know the details of the Linux implementation there, but I don't understand how that can work. The datapath information is spread across many different pages, for example. How does the driver expose the idea of a page?
This PR adds
from_bufconvenience method toParseFromModuleto simplify client code a bit.Also makes a correction to Identifier value
0x19QSFP 8X -> OSFP 8X from SFF-8024 table 4.2.Example use can be found here. I've tested this on an Nvidia MCP7Y00-N001 DAC and it seems to be working well.