Home > other >  How do I use python call USB mouse and keyboard interface output hardware signal to another computer
How do I use python call USB mouse and keyboard interface output hardware signal to another computer

Time:09-16

I have a project to use Linux to do,
Environment: the Linux machines use a USB cable and another computer (B) computer USB interface is linked together,
Main functions: to simulate USB signals, to the B computer USB, let the computer think that B is a USB keyboard input,
Development language: python
I want to ask, this code is how to do?


CodePudding user response:

Recommend pyserial

CodePudding user response:

reference 1st floor ligengyong2010 response:
recommended pyserial

Pro is different,
=============here is online to see operations using pyserial======================================
Ser=serial. Serial (0) is the first serial
Print ser. Portstr can see the first serial identification, under Windows is COM1
Ser. Write (" hello ") is to write a serial port with data
Ser. The close () is closed ser said serial port
Ser. The open () will open the serial port
Ser=serial. Serial (' COM1, 115200) to set the baud rate, of course, special function
Data=(https://bbs.csdn.net/topics/ser.read) can read one character
Data=https://bbs.csdn.net/topics/ser.read (20) is read 20 characters
Data=(https://bbs.csdn.net/topics/ser.readline) is reading a line, end with a/n, if there were no/n has been read, jam,
Data=(https://bbs.csdn.net/topics/ser.readlines) and ser. Xreadlines () will need to set the timeout time
Ser. Baudrate=9600 set the baud rate
Ser to view the current status of the serial port
Ser. IsOpen () to see if the serial port has been opened the
=============================================================================
I want to ask, if I want to input: ser. Write (" h "), is equivalent to give B computer according to the "h" button? # (like what baud rate, such as,)
Can you give an example code?

CodePudding user response:

Directly with a USB connection, if there are no other middle interface, it is not possible.
The PC USB port does not support OTG,

CodePudding user response:

Sprawling
reference 3 floor response:
directly with USB connection, if there are no other interface between, is impossible.
The PC USB port does not support OTG,


Among what kind of connector? In theory should be to, because is to simulate the hardware keyboard operation,

CodePudding user response:

reference 4 floor msn160 response:
Quote: reference sprawling reply: 3/f

Directly with a USB connection, if there are no other middle interface, it is not possible.
The PC USB port does not support OTG,


Among what kind of connector? In theory should be to, because the operation of the hardware keyboard is simulated, and the

Not a theory, the USB HOST can't directly to the HOST
http://www.oschina.net/question/657967_226027

CodePudding user response:

Sprawling
reference 5 floor response:
Quote: refer to 4th floor msn160 response:

Quote: refer to the third floor of the sprawling reply:

Directly with a USB connection, if there are no other middle interface, it is not possible.
The PC USB port does not support OTG,


Among what kind of connector? In theory should be to, because the operation of the hardware keyboard is simulated, and the

Not a theory, the USB HOST can't directly to the HOST
http://www.oschina.net/question/657967_226027


Analog keyboard driver can not? And then call the driver in python?

CodePudding user response:

Yes, finally you solve it? I now have a project have such demand, need through the usb signal to control the other PC keyboard operation

CodePudding user response:

refer to 7th floor imread_imshow response:
yes, finally you solve it? I now have a project have such demand, need through the usb signal to control the other PC keyboard operation

There is no... , I recently engaged in project management, don't have the technology
  • Related