Commercial software makers are exploiting designed obsolescence extract wealth and when hardware is involved this comes to the detriment of hte environment by needlessly generating copious e-waste.
So new rule: when a copyright holder decides that their non-free software is no longer profitable enough to maintain and distribute despite the continued useful existence of the hardware it runs on, they shall publish the source code regardless of time left on their copyright. The copyright shall be relinquished and either converted into public domain, or reassigned under a FOSS license to a free software custodian. To the extent that the docs, SDK, and test artifacts are also owned by the copyright holder, those must also be released to the public.
Alternatively, if a copyright holder prefers to keep their code secret, they may elect to port an existing FOSS project to the hardware that their obsoleted software otherwise renders useless. They must finance the porting effort to the extent of reaching comparable functionality as the original factory state of the device.
This use-it-or-lose-it component is missing from the #rightToRepair legislation being implemented.
Well hardware makers will do anything to cut costs, but a right to repair law which includes fully complete repair information (here are the parts used in making the device) and banning sole customer deals (Companies making parts for the device must offer for sale to all customers any parts that they make for any customer) would be sufficient for a dozen people working together to keep all new hardware flowing into community supported projects. And provide a route for commercial repair companies to justify funding such community efforts.