Title: Inconsistent data truncation of unsupported data types in SDO upload · Issue #436 · canopen-python/canopen · GitHub
Open Graph Title: Inconsistent data truncation of unsupported data types in SDO upload · Issue #436 · canopen-python/canopen
X Title: Inconsistent data truncation of unsupported data types in SDO upload · Issue #436 · canopen-python/canopen
Description: I'm having problems reading SDO objects that are using UNSIGNED48. It used to work before PR #395 by @ljungholm - but it turns out to be coincidental. https://github.com/christiansandberg/canopen/blob/24df6e846a4e71508fd82c378d1385d65f00...
Open Graph Description: I'm having problems reading SDO objects that are using UNSIGNED48. It used to work before PR #395 by @ljungholm - but it turns out to be coincidental. https://github.com/christiansandberg/canopen/b...
X Description: I'm having problems reading SDO objects that are using UNSIGNED48. It used to work before PR #395 by @ljungholm - but it turns out to be coincidental. https://github.com/christiansandberg/canop...
Opengraph URL: https://github.com/canopen-python/canopen/issues/436
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inconsistent data truncation of unsupported data types in SDO upload","articleBody":"I'm having problems reading SDO objects that are using UNSIGNED48. It used to work before PR #395 by @ljungholm - but it turns out to be coincidental.\r\n\r\nhttps://github.com/christiansandberg/canopen/blob/24df6e846a4e71508fd82c378d1385d65f000c94/canopen/sdo/client.py#L123-L133\r\n\r\nI believe the root cause is that canopen doesn't support the UNSIGNED48 type (which I'll contribute in another PR). The unfortunate behavior is that due to the unknown type, the data gets truncated to 1 byte. It didn't do that before #395 .\r\n\r\n```\r\n\u003e\u003e upload((8192, 2), {})\r\n\u003c-- 602 : 40 00 20 02 00 00 00 00\r\n--\u003e 582 : 41 00 20 02 08 00 00 00\r\n \u003c\u003c read_response() = b'A\\x00 \\x02\\x08\\x00\\x00\\x00'\r\n\u003c-- 602 : 60 00 00 00 00 00 00 00\r\n--\u003e 582 : 00 b2 01 20 02 91 12 00\r\n \u003c\u003c read_response() = b'\\x00\\xb2\\x01 \\x02\\x91\\x12\\x00'\r\n\u003c-- 602 : 70 00 00 00 00 00 00 00\r\n--\u003e 582 : 1d 00 00 00 00 00 00 00\r\n \u003c\u003c read_response() = b'\\x1d\\x00\\x00\\x00\\x00\\x00\\x00\\x00'\r\n data=b'\\xb2\\x01 \\x02\\x91\\x12\\x00\\x00'\r\n response_size = 8\r\n var.datatype = 25 # UNSIGNED48 (unsupported)\r\n var_size = 1 # Because len(var) on unknown datatypes is 8\r\n data = b'\\xb2' # Truncated due to ^\r\n\u003c\u003c upload() = b'\\xb2'\r\n```\r\n\r\nObservations:\r\n* Reading SDO objects _without_ OD record will preserve data as-is\r\n* Reading SDO objects _with_ OD, but of unsupported type will return data of size 1\r\n* `ODVariable.__len__()` return 8 on unknown types, while it reports number of bits in the other types. This is why it gets truncated to one byte.\r\n\r\nWould you agree that `upload()` should return the the full data for both of the first use cases? Is the fix that `ODVariable.__len__()` on unknown datatypes should return 64?\r\n","author":{"url":"https://github.com/sveinse","@type":"Person","name":"sveinse"},"datePublished":"2024-05-18T23:36:47.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":25},"url":"https://github.com/436/canopen/issues/436"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ce27fc9a-20fa-6583-aa75-efa7b99abdef |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8B8C:2A60AD:44E276D:5B26E61:6A5D7673 |
| html-safe-nonce | c0e3b18cac4c28d1f20bd812f45b1819c0e9d187131ad45198c396421fb774f3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjhDOjJBNjBBRDo0NEUyNzZEOjVCMjZFNjE6NkE1RDc2NzMiLCJ2aXNpdG9yX2lkIjoiNTA0OTkwMzIxNzA0OTk1ODAwMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a722c8c0fb409f22eead02033c2533471b5e45d8d354982207c1801d7df25477 |
| hovercard-subject-tag | issue:2304344615 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/canopen-python/canopen/436/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8f6c33721ff8bcb0c6832c9d31be03bdf3c677a7727b44920656a749b4a2db2c/canopen-python/canopen/issues/436 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8f6c33721ff8bcb0c6832c9d31be03bdf3c677a7727b44920656a749b4a2db2c/canopen-python/canopen/issues/436 |
| og:image:alt | I'm having problems reading SDO objects that are using UNSIGNED48. It used to work before PR #395 by @ljungholm - but it turns out to be coincidental. https://github.com/christiansandberg/canopen/b... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sveinse |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/canopen-python/canopen git https://github.com/canopen-python/canopen.git |
| octolytics-dimension-user_id | 200581454 |
| octolytics-dimension-user_login | canopen-python |
| octolytics-dimension-repository_id | 68737600 |
| octolytics-dimension-repository_nwo | canopen-python/canopen |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 68737600 |
| octolytics-dimension-repository_network_root_nwo | canopen-python/canopen |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width