Discussion:
[Wine] wineio (iowraping under wine)
Christian Schmitz (derem)
2016-05-02 16:33:30 UTC
Permalink
Hi everyone:
I am a wine user, and i migrate from opensuse 11.0 to the new opensuse
leap42.1.

I have a chip programmer connected via parallel port. This programmer is
esential to my work, and the program run only on windows.

In the past i use a IOWRAPPER in C that i call wineio.c. So after compile
wineio, give permissions (root and sticky) i can run the software and program
chips.

The iowrapper used is attached to this email. This was working on opensuse
11.0 (64 bits) but in opensuse LEAP 42.1 (64 bits) i got this error:

Executing prg :c:\Program Files (x86)\EEtools\Tmw.exe
/usr/bin/wineio: not an i386 ELF binary... don't know how to load it


I try recompile, i do make wineio, the program is compiled and run. The wineio
is operative becasue the text "executing prg" is in line 90 of wineio.c


I dont know how get working my hardware thru wine.

Best Regards to all, any clue will be appreciated.
Christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wineio.c
Type: text/x-csrc
Size: 2893 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-users/attachments/2
Fred
2016-05-02 18:56:24 UTC
Permalink
Hi,

Windows programs that need to load a custom driver for hardware like a
programmer don't work with wine. I suggest you look at the programmers
made by Conitec at http://www.conitec.com especially the GALEP-5D. Not
only do they work with Linux they are actually running Linux. I had the
same problem as you and have been very happy with the 5D.

Best regards,
Fred Boatwright
Post by Christian Schmitz (derem)
I am a wine user, and i migrate from opensuse 11.0 to the new opensuse
leap42.1.
I have a chip programmer connected via parallel port. This programmer is
esential to my work, and the program run only on windows.
In the past i use a IOWRAPPER in C that i call wineio.c. So after compile
wineio, give permissions (root and sticky) i can run the software and program
chips.
The iowrapper used is attached to this email. This was working on opensuse
Executing prg :c:\Program Files (x86)\EEtools\Tmw.exe
/usr/bin/wineio: not an i386 ELF binary... don't know how to load it
I try recompile, i do make wineio, the program is compiled and run. The wineio
is operative becasue the text "executing prg" is in line 90 of wineio.c
I dont know how get working my hardware thru wine.
Best Regards to all, any clue will be appreciated.
Christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wineio.c
Type: text/x-csrc
Size: 2893 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-users/attachments/20160502/9c982a9e/attachment.c>
Christian Schmitz (derem)
2016-05-02 19:22:55 UTC
Permalink
Post by Fred
Hi,
Windows programs that need to load a custom driver for hardware like a
programmer don't work with wine. I suggest you look at the programmers
made by Conitec at http://www.conitec.com especially the GALEP-5D. Not
only do they work with Linux they are actually running Linux. I had the
same problem as you and have been very happy with the 5D.
Best regards,
Fred Boatwright
Dear Fred.
The topmax (the chip programmer) do not use driver under wine, use direct
parallel port access (0x378 if my memory does not fail). I get working on
opensuse 11.0.

But now under opensuse 42.1 (into the wine) i dont know how give port access
to the application. And i dont know how solve the elf 386 binary problem.

Interesting programmer the GALEP-5D, i use TOPMAX (lpt version).

Best Regards
Christian
Post by Fred
Post by Christian Schmitz (derem)
I am a wine user, and i migrate from opensuse 11.0 to the new opensuse
leap42.1.
I have a chip programmer connected via parallel port. This programmer is
esential to my work, and the program run only on windows.
In the past i use a IOWRAPPER in C that i call wineio.c. So after compile
wineio, give permissions (root and sticky) i can run the software and
program chips.
The iowrapper used is attached to this email. This was working on
opensuse 11.0 (64 bits) but in opensuse LEAP 42.1 (64 bits) i got this
Executing prg :c:\Program Files (x86)\EEtools\Tmw.exe
/usr/bin/wineio: not an i386 ELF binary... don't know how to load it
I try recompile, i do make wineio, the program is compiled and run. The
wineio is operative becasue the text "executing prg" is in line 90 of
wineio.c
I dont know how get working my hardware thru wine.
Best Regards to all, any clue will be appreciated.
Christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wineio.c
Type: text/x-csrc
Size: 2893 bytes
Desc: not available
<http://www.winehq.org/pipermail/wine-users/attachments/20160502/9c982a9e
/attachment.c>
Christian Schmitz (derem)
2016-05-17 12:59:46 UTC
Permalink
Hi wine people
Finally i can grant parallel port acces to TOPmax EEtools chip programmer.
I dont know why i need to modify the wineio.c wrapper.
I put below the new code with the hope that was usefull to another people.
Best Regards
Christian

====================== wineio.c ===========================
/*
* Copyright (c) 2005 Nicolas Bernard <http://www.lafraze.net/nbernard/>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Modified by Christian Schmitz <http://www.schlabs.com.ar> 2016
*/
/* this is a wrapper to authorize the use of a port (eg: parallel port)
* by a program which assume it can (eg wine). */

/* this program must be setuid root */
//
// Usage:
// wineio [your program]
//
//
// Notes:
// 1-this executable replace the binary that you normally calls
// For example:
// Write
// wineio Tmw.exe
// instead
// wine Tmw.exe
//
// 2- The executable must be owned by root
// 3- This program must be setuid root
//
//
#include <sys/io.h>
#include <sys/types.h>

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

/**** adjust those values according to your configuration *****/

//#define
WINE_PATH "/usr/bin/wine /home/wolf/.wine/drive_c/EETools/Tmw.exe" /* the
program to launch */
//#define PORT_FROM 0x370 /* beginning of the memory area authorize
*/
//#define PORT_TO 0x37F /* end of it */
#define WINE_PATH "/usr/bin/wine" /* the program to launch */
//#define WINE_PATH "/home/wolf/bin/wineio2" /* the program to launch */
#define PORT_FROM 0x378 /* beginning of the memory area authorize
*/
#define PORT_TO 0x37F /* end of it */
#define UID 1000 /* uid of the user under which to launch the program */

/************************************************************/
int debuglevel=9;
int
main(int argc, char* argv[], char *const envp[])
{
char** nargv;
int i;
//Setting permissions
if (ioperm(PORT_FROM, PORT_TO - PORT_FROM + 1, 1)) {
fprintf(stderr, "ioperm: %s\n", strerror(errno));
return 1;
}
if(debuglevel>1){
printf("\tPermissions \tOK (%04x-%04x)\n",PORT_FROM,PORT_TO);
}
//Malloc
nargv = malloc((argc + 1) * sizeof(char*));
if (nargv == NULL) {
fprintf(stderr, "malloc: unable to allocate memory\n");
return 2;
}
for (i = 0; i < argc; i++)
nargv[i] = argv[i];
//old code do not work cannot execute wine saying
//"is not elf 386 program"
// nargv[argc] = NULL;
//New working code
nargv[0] = "wine";
nargv[argc] = 0;
if(debuglevel>1){
printf("\tMalloc \tOK (%d)\n",argc);
}
// Setuid
if (setuid(UID)) {
fprintf(stderr, "setuid: %s\n", strerror(errno));
return 3;
}
if(debuglevel>1){
printf("\tSetuid \tOK (%d)\n",UID);
}
// Program execution
if(debuglevel>1){
// printf("Executing prg :%s \n",nargv[1]);
printf("\tExecuting :%s %s\n",WINE_PATH,nargv[1]);
}
execve(WINE_PATH, nargv, envp);
fprintf(stderr, "execve: %s\n", strerror(errno));
return 4;
}
====================== end wineio.c =====================
Post by Christian Schmitz (derem)
Post by Fred
Hi,
Windows programs that need to load a custom driver for hardware like a
programmer don't work with wine. I suggest you look at the programmers
made by Conitec at http://www.conitec.com especially the GALEP-5D. Not
only do they work with Linux they are actually running Linux. I had the
same problem as you and have been very happy with the 5D.
Best regards,
Fred Boatwright
Dear Fred.
The topmax (the chip programmer) do not use driver under wine, use direct
parallel port access (0x378 if my memory does not fail). I get working on
opensuse 11.0.
But now under opensuse 42.1 (into the wine) i dont know how give port
access to the application. And i dont know how solve the elf 386 binary
problem.
Interesting programmer the GALEP-5D, i use TOPMAX (lpt version).
Best Regards
Christian
Post by Fred
Post by Christian Schmitz (derem)
I am a wine user, and i migrate from opensuse 11.0 to the new opensuse
leap42.1.
I have a chip programmer connected via parallel port. This programmer
is esential to my work, and the program run only on windows.
In the past i use a IOWRAPPER in C that i call wineio.c. So after
compile wineio, give permissions (root and sticky) i can run the
software and program chips.
The iowrapper used is attached to this email. This was working on
opensuse 11.0 (64 bits) but in opensuse LEAP 42.1 (64 bits) i got this
Executing prg :c:\Program Files (x86)\EEtools\Tmw.exe
/usr/bin/wineio: not an i386 ELF binary... don't know how to load it
I try recompile, i do make wineio, the program is compiled and run. The
wineio is operative becasue the text "executing prg" is in line 90 of
wineio.c
I dont know how get working my hardware thru wine.
Best Regards to all, any clue will be appreciated.
Christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wineio.c
Type: text/x-csrc
Size: 2893 bytes
Desc: not available
<http://www.winehq.org/pipermail/wine-users/attachments/20160502/9c982a
9e /attachment.c>
Loading...