-
Notifications
You must be signed in to change notification settings - Fork 3k
Cellular: Mark to be deprecated in CellularDevice #11935
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
Conversation
|
CI started |
|
|
||
| /** Get the current filehandle. | ||
| * | ||
| * @return pointer to filehandle or NULL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When will this return null? As I recall part of the reason for original API was that it wouldn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filehandle is used to identify serial link and/or data channels. When CellularDevice is over a non-filehandle alike link, it's possible that filehandle is NULL since data channels may not be immediately available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like some sort of redesign being planned? Got any more info?
Deprecations usually accompany or follow redesigns, not precede them - it's a bit hard to review a deprecation that's a hint of "things to come".
At the minute, the FileHandle is part of the fundamental channel ownership. Are you planning to increase complexity here by letting lower levels kill themselves/not exist while the higher levels remain active?
At the minute, we're generally preferring the "suspend/resume" API for that sort of thing, as that allows you to retain ownership.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marked CellularDevice::get_file_handle as deprecated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kjbracey-arm the update resolved this?
83ab23f to
d1456cd
Compare
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
|
CI restarted |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
| * | ||
| * @return reference to FileHandle | ||
| */ | ||
| MBED_DEPRECATED_SINCE("mbed-os-5.15", "Use CellularDevice::get_at_handler()->get_filehandle() instead.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not quite following - the CellularDevice is tied to a particular file handle. Always (at present). It might be switching control of that file handle between different users, in particular the AT handler and the PPP driver.
How does asking for the handle from the AT handler's copy improve things?
Is there some change of CellularDevice planned, so that it (and hence the AT handler) change handle? I can see why ATHandler was designed to be a bit more flexible on file handle switching - it's not always in control of the file handle, cos it has to hand over to PPP, but not sure that extends to CellularDevice.
Also, that suggested call seems unsafe as get_at_handler is a reference-counted claim - needs to be balanced with a release_at_handler().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kjbracey-arm FileHandle may have users such AT, PPP, MUX, and also application need to use it to enable deep-sleep. However, CellularDevice has no use for FileHandle per se, and thus, it kind of makes sense to ask that from CellularDevice dynamically, like if (CellularDevice::get_at_handler()) { get_filehandle()->do_something(); }.
This change is not at all about changing AT based cellular implementation. But there are other adaptations, where CellularDevice need not to have FileHandle, because a modem adaptation has separate "link" channels (also possibly in shared memory) for control and user data and also there can be many data channels, for example Android RIL adaptations may be deferring creation of data channels, and if FileHandle would be used in original (vendor specific which is hard to force) adaptation, it could still be NULL initially and not good as a reference.
A call to get_at_handler() should be balanced with a release, which is documented in CellularDevice::get_at_handler().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A call to get_at_handler() should be balanced with a release, which is documented in CellularDevice::get_at_handler().
That's not possible in either the example in the deprecation, or your if (get_at_handler()) code above, because you're not storing the return value to pass to release. So you're suggesting "could-never-be-correct" code snippets which people are very likely to copy.
A FileHandle is to a large extent a "handle" to a system, and there's no reason why a more-complex-than-just-a-single-stream device couldn't still present as something derived from a FileHandle. That would allow common functionality like the enable_input/enable_output calls.
Still, that's more Linux than Mbed OS, so okay, yes, if the base CellularDevice itself doesn't need a FileHandle, then it could be adjusted to allow for null, in case the derived class doesn't need it either. If that's the plan, then I suggest you make a more complete patch doing that. Something like:
- Remove the
MBED_ASSERT(fh)from CellularDevice constructor, so you can actually pass null. - Add a
= nullptrto the declaration so you can default-constructCellularDevicewith no filehandle - Deprecate the
get_file_handlein favour of aget_file_handle_ptrso you can read null.
I still don't see any need to complicate accessing the file handle - as long as you're passing it to CellularDevice's constructor, and it's having to store it anyway to pass to open_network it seems totally reasonable to be able to read it back out from the CellularDevice.
Maybe you could have no read in the base class, which would open the door the the base not storing it, but you don't yet have an adequate replacement - if it was in AT_CellularDevice only that's not public, and neither is ATHandler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has this been resolved ? IF not ,can it be asap?
|
@kjbracey-arm it would be nice if there was a very clean and standard way to organize, serialize and control access to hardware resources both in mcu and on the board. Something about file handles has always seemed like a stretched concept to me. |
The We are intending to extend a (We're making some moves to allow things to be static/compile-time where possible though - look at the pinmap PR for an example of that.) |
|
@AnttiKauppila @AriParkkila might be OoO today, can you help here? |
d1456cd to
088140e
Compare
|
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Description
Summary of change
Mark to be deprecated functions in CellularDevice.
Documentation
Pull request type
Test results
Reviewers
@AnttiKauppila
Release Notes
Summary of changes
Impact of changes
Migration actions required