Skip to content
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

problem about send_bs_remain #24

Open
zhangjinus opened this issue Jan 19, 2023 · 1 comment
Open

problem about send_bs_remain #24

zhangjinus opened this issue Jan 19, 2023 · 1 comment

Comments

@zhangjinus
Copy link

when sending multi-frame, tp_poll handle remain packets. but in isotp_send_with_id function,send_bs_remain set to 0, causing tp_poll can not do sending. link->send_status will stay in ISOTP_SEND_STATUS_INPROGRESS.
/* send multi-frame */
ret = isotp_send_first_frame(link, id);
if (ISOTP_RET_OK == ret) {
link->send_bs_remain = 0;
link->send_st_min = 0;
link->send_wtf_count = 0;
link->send_timer_st = link->isotp_user_get_ms();
link->send_timer_bs = link->isotp_user_get_ms() + ISO_TP_DEFAULT_RESPONSE_TIMEOUT;
link->send_protocol_result = ISOTP_PROTOCOL_RESULT_OK;
link->send_status = ISOTP_SEND_STATUS_INPROGRESS;
}
....
void isotp_poll(IsoTpLink *link) {
int ret;

/* only polling when operation in progress */
if (ISOTP_SEND_STATUS_INPROGRESS == link->send_status) {

    /* continue send data */
    if (/* send data if bs_remain is invalid or bs_remain large than zero */
    **(ISOTP_INVALID_BS == link->send_bs_remain || link->send_bs_remain > 0)** &&
    /* and if st_min is zero or go beyond interval time */
    (0 == link->send_st_min || (0 != link->send_st_min && IsoTpTimeAfter(link->isotp_user_get_ms(), link->send_timer_st)))) {
        
        ret = isotp_send_consecutive_frame(link);

......

@prj
Copy link

prj commented Apr 13, 2023

When you initiate a send, then link status gets set to ISOTP_SEND_STATUS_INPROGRESS.
This never changes unless it fails (ERROR) or completes (IDLE).

So not sure where you see a problem.

There is a check before:

if (ISOTP_SEND_STATUS_INPROGRESS == link->send_status) {
    isotp_user_debug("Abort previous message, transmission in progress.\n");
    return ISOTP_RET_INPROGRESS;
}

driftregion pushed a commit to driftregion/isotp-c that referenced this issue Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants