Hi Gonzalo, I think you'll find that Jasper van den Eshof has already fixed this issue and sent patches here, although they've yet to be merged upstream.
See recent threads here: https://lists.osmocom.org/hyperkitty/list/[email protected]/thread/7TKOAOP5KNQBBCDJRV7EI67AFKEDTNCP/ https://lists.osmocom.org/hyperkitty/list/[email protected]/thread/MN2PVFRDQUBUO6SAPLFK7EE7G6LEQJ5S/ Of course you may want to propose a different solution, but it would probably make sense to start by comparing notes with the above. Regards, Martin On Fri, Feb 04, 2022 at 12:36:53PM +0100, Gonzalo José Carracedo Carballal wrote: > > Hi, > > Long story short: I have a fix for a crash in Windows in librtlsdr > when closing the device, and I'd love to submit a patch. I went > through this page: > https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards > and saw that I have to follow certain steps (design, review, etc) but > I am not quite sure who to contact. For some projects, this is somehow > automatized by means of Gerrit, but it looks that this is not the case > for librtlsdr (yet) > > I'd like to do it the right way, how should I proceed? Should I post > the patch here directly? Do I have to document the design of my fix > and have it reviewed first somewhere else? > > Bit of backstory: some days ago I came across a crash in librtlsdr for > Windows when closing the device (initially reported as a potential > libusb bug, see https://github.com/libusb/libusb/issues/1043). > Although workarounds existed > (https://github.com/TALUAtGitHub/librtlsdr/commit/27d79d258c0fffb73afd3fffd3bd8b10ed825a68) > they relied on a somewhat arbitrary (1 ms) delay to give some time for > libusb event callbacks to be triggered before resource cleanup. This > was not working anymore, so I decided to look into it and ended up > working on a solution. This solution involved refactoring the transfer > / buffer array into an array of transfer objects that enabled > synchronous cancellation of pending transfers (see > https://github.com/BatchDrake/rtl-sdr-blog/blob/feature/xfer-completion/src/librtlsdr.c#L110). > Since it seems to work rather well, I though it could be interesting > to submit a patch to have this fixed upstream. > > Thanks in advance, > -- > >> Gonzalo José Carracedo Carballal >
