Clemens,
(2014年03月10日 06:32), Clemens Ladisch wrote:
All these functions return errors with two different mechanisms, the AV/C response code or a negative Linux error code. This forces the caller to add a second error check that duplicates the one inside the function:
I realize a need to simplify these return value and decide to work for deferred transaction defined in 'AV/C Digital Interface Command Set General Specification'. If firewire-lib can handle deferred transaction, it's OK that AV/C functions in firewire-lib returns Linux error codes instead of combination error codes and response codes.
Well, can I request your comments about corresponding between response codes and Linux error codes?
Current my idea is below.
Return codes of CONTROL command: if (err != 8) /* length of response is out of specification */ err = -EIO; else if (buf[0] == 0x08) /* NOT IMPLEMENTED */ err = -ENOSYS; else if (buf[0] == 0x0a) /* REJECTED */ err = -EINVAL;
Return codes of STATUS command: if (err != 8) /* length of response is not our expectation */ err = -EIO; else if (buf[0] == 0x08) /* NOT IMPLEMENTED */ err = -ENOSYS; else if (buf[0] == 0x0a) /* REJECTED */ err = -EINVAL; else if (buf[0] == 0x0b) /* IN TRANSITION */ err = -EAGAIN;
Are these better?
Regards
Takashi Sakamoto o-takashi@sakamocchi.jp