On Wed, Jul 13, 2016 at 10:59:10AM +0530, Malith Yapa wrote:
> I think i am.
>
> int readDword(int addr) {
>
> uint16_t reg[1];// will store read registers values
>
> int num = modbus_read_registers(ctx, addr, 1, reg); //16386 = X2
>
> usleep(5);
>
> if (num != 1) {
> fprintf(stderr, "Failed(%i) to read: %s\n", num,
> modbus_strerror(errno));
> modbus_close(ctx);
> modbus_free(ctx);
> sleep(5);
> int wait = 1;
> while(initModbus()) {
> cerr << "Waiting for PLC.. SLEEP[" << wait*20 << "]" << endl;
> sleep(wait*20);
> wait++;
> }
> }
>
> return reg[0];
> }
>
> according to modbus documentation, "The modbus_close() function shall
> close the connection established with the backend set in the context."
>
> Even if not. Shouldn't the minor number's go upto 512 (as Johan
> pointed out) before giving up?
Yes it should.
> The system is an Olimex A20-micro,
> Linux version 3.4.90+ (gcc version 4.7.1 (Debian 4.7.1-7) )
Ugh, 3.4 is a very old, and obsolete kernel version. Please get support
for it from the vendor that is forcing you to use such a thing, as you
are already paying for it from them.
We can help you out if you can reproduce this on 4.6, have you tried
that?
thanks,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html