11-22-2023 01:13 PM
I want to use "Call Library Function Node" to send in command to the Linux. My command has some special character, like "@" and "-", the Call Library Function Node can send most character (like "root") but doesn't send "@" and "-" (are empty). I tried different combination on Parameter type, no luck. Can some one help? Thank you in advance.
I attach my VI. I also tried with System Execution, nothing input to Linux.
Solved! Go to Solution.
11-22-2023 01:31 PM - edited 11-22-2023 01:32 PM
@yuntan wrote:
I want to use "Call Library Function Node" to send in command to the Linux. My command has some special character, like "@" and "-", the Call Library Function Node can send most character (like "root") but doesn't send "@" and "-" (are empty). I tried different combination on Parameter type, no luck. Can some one help? Thank you in advance.
I attach my VI. I also tried with System Execution, nothing input to Linux.
Never saw anything like this. The only reason why the Call Library Node might stop passing string data to the shared library function might be if it contains embedded NULL characters. But even that is actually only happening after the Call Library Node returns, not when passing a buffer to the function.
It's also a bit unclear what you actually try to do. Sending commands to Linux is very broad. If you had selected Save for Previous and saved to LabVIEW 2020 or earlier I could look at your VI, but now I just can guess things.
System Exec would be indeed the more logical function to call Linux commands. But as you forgot to mention what sort of command you tried this with I can't even start to guess what the problem might be.
11-22-2023 02:11 PM
I convert it to version 2019. Just want to know how Function Node can do key board output "@" or "-" to my application. Thanks.
11-22-2023 02:33 PM
Please explain to me where Linux from your first post comes into play. You call keybd_event() which is a Windows API function. There is nothing like that on Linux!
Second: check out the documentation for keybd_event. There you have a list of Virtual Key Codes. Ranges 0x3A to 0x40 (58 to 64) are documented to be "undefined". This means Windows is free to do with them whatever it likes including simply ignoring them. Code 0x5F (95) is the SleepKey.
While the VirtualKey codes indeed match the ASCII codes for letters and digits this is not true for the others.
11-24-2023 10:07 AM - edited 11-24-2023 10:09 AM
You are using the keyboard call. For the two characters you are having problems with (@, _), they require the shift key to be pressed before sending the ASCII codes and released after. So you need to add the commands for the shift key too.
11-24-2023 11:37 AM
Attached is what I got to work. The only question I have is the keyboard code for the -/_ key. Wasn't what I expected.
11-27-2023 09:34 AM
Randall,
Thank you so much for your help. Appreciate it. You have resolved my problem.