Title: Re: program code from linux to windows
Post by: MarkMLl on March 25, 2023, 07:47:12 am
libusb, and generally speaking trying to treat it like a stream won't work.
Broadly speaking, the data coming from (or expected by) a USB device is highly-device-specific: unless it's one of the standard classes, and in that case I'd expect it to be at e.g. /dev/lp0 rather than /dev/usb/lp0 or somewhere on the /dev/bus/usb tree.
If you were actually trying to read /dev/lp0 you could probably get at that via the kernel; same applies to network devices (i.e. USB-connected Ethernet) etc. However for just about anything else you'll find few alternatives to going via libusb, even if somebody's written a higher-level library.
MarkMLl
Title: Re: program code from linux to windows
Post by: Fixik2022 on March 25, 2023, 08:25:59 am
function TForm1.OpenUsb:boolean; begin result:=false; try FUsb:=TFileStream.Create('/dev/lp0',fmOpenReadWrite); result:=true; except on e:exception do begin log(e.message); end; end; end;
does not work on windows
Title: Re: program code from linux to windows
Post by: Thaddy on March 25, 2023, 09:00:29 am
Of course not! '/dev/lp0' is unix specific and is a pseudo file. There is no direct Windows equivalent.
Title: Re: program code from linux to windows
Post by: Fixik2022 on March 25, 2023, 09:03:14 am
how can i do it for windows
Title: Re: program code from linux to windows
Post by: Thaddy on March 25, 2023, 09:59:40 am
libusb.dll is available for Windows, as Mark implicitly wrote. FPC comes with bindings for it.