[Interest] Return value from QProcess

Jérôme Godbout jerome at bodycad.com
Wed Apr 6 21:00:01 CEST 2016


You should use a more complete bash command that perform the insert mod,
not an actual command but just the raw idea here:

if [[ $(lsmod | grep "Profibus") != "ProfileBus" ]]; then insmod Profibus fi

Maybe you should check with modprobe to check if the -i or -f flag can help
you to get proper behavior.

That way your command will return error only when the insert fail and you
will not insert mod when already there.

On Wed, Apr 6, 2016 at 1:26 PM, Duane <duane.hebert at group-upc.com> wrote:

> On 06/04/2016 11:47 AM, Thiago Macieira wrote:
>
>> On quarta-feira, 6 de abril de 2016 10:47:39 PDT Duane wrote:
>>
>>> This works in the sense that it returns 0 when there's no error but it
>>> doesn't seem to return the return value from insmod.  For example,
>>> insmod returns 4531 when the file is already loaded but
>>> QProcess::exitCode is 17.  I can rmmod module I guess.
>>>
>>
>> The error code cannot be 4531. There aren't enough bits in the kernel
>> structure that returns status codes.
>>
>> /* If WIFEXITED(STATUS), the low-order 8 bits of the status.  */
>> #define __WEXITSTATUS(status)   (((status) & 0xff00) >> 8)
>>
>>
> 4352. Sorry typo.
>
> Using this call:
> int res = std::system("/sbin/insmod /mnt/sdb1/uio_netx.ko");
>
> Anyway, I don't really need to do this.  I use this to load a Profibus
> mini pci module.  When the module isn't loaded I get a failure trying to
> initialize the "board" that's more explicit.
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160406/cb95748a/attachment.html>


More information about the Interest mailing list