CN114047964A - Method for enabling Android-supported camera to be hot-plugged when Linux is compatible with Android system - Google Patents

Method for enabling Android-supported camera to be hot-plugged when Linux is compatible with Android system Download PDF

Info

Publication number
CN114047964A
CN114047964A CN202210034222.XA CN202210034222A CN114047964A CN 114047964 A CN114047964 A CN 114047964A CN 202210034222 A CN202210034222 A CN 202210034222A CN 114047964 A CN114047964 A CN 114047964A
Authority
CN
China
Prior art keywords
camera
android
linux
request
opening
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210034222.XA
Other languages
Chinese (zh)
Other versions
CN114047964B (en
Inventor
游远
马超
黄彩龙
黄晟
李翔
杨硕
彭韬
赵坤
谢辉军
杨陈博寰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kirin Software Co Ltd
Original Assignee
Kirin Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kirin Software Co Ltd filed Critical Kirin Software Co Ltd
Priority to CN202210034222.XA priority Critical patent/CN114047964B/en
Publication of CN114047964A publication Critical patent/CN114047964A/en
Application granted granted Critical
Publication of CN114047964B publication Critical patent/CN114047964B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4411Configuring for operating with peripheral devices; Loading of device drivers
    • G06F9/4413Plug-and-play [PnP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4063Device-to-bus coupling
    • G06F13/4068Electrical coupling
    • G06F13/4081Live connection to bus, e.g. hot-plugging

Abstract

The invention relates to a method for enabling Android to support hot plug of a camera when Linux is compatible with an Android system, which is applied to an operating environment of the Linux compatible with the Android system and provides plug and play of the camera in the operating environment of the Android; the method comprises the following steps: step S1: preparing an Android-compatible operating environment of the Linux system; step S2: establishing a Linux camera server; step S3: modifying a camera hardware abstract layer of an Android end; step S4: the Android application is started to access the camera, a request for opening the camera is transmitted to the camera hardware abstraction layer through the camera service framework, the camera hardware abstraction layer sends the request for opening the camera to the Linux end, the Linux end camera service end returns a corresponding file descriptor of the camera to the Android end after receiving the request for opening the camera of the Android end, and the Android end obtains the permission for operating the camera.

Description

Method for enabling Android-supported camera to be hot-plugged when Linux is compatible with Android system
Technical Field
The invention belongs to the technical field of Linux operating systems, and particularly relates to a method for enabling an Android-supported camera to be hot-plugged when Linux is compatible with an Android system.
Background
In recent years, with the growth of Android users and the maturity and development of Android software and hardware products, Android application ecology presents explosive development, exceeds Windows application ecology and IOS application ecology in many fields, and becomes the most widely used application ecology at present. Android develops based on a Linux kernel, is a Linux operating system with the highest market share in the current mobile terminal market, and has an excellent ecological environment in the field of mobile terminals; the Windows system occupies the largest share of the PC market, is used as an American closed source operating system, and has huge potential safety hazard in the aspect of information network safety; the Linux operating system, which is a precursor of Android, is slow in development due to the limitation of the number of developers and market share, and the ecological environment is in a bad state for a long time and is not colored all the time. With the rapid development of information technology, the national attention degree on information security is increasingly promoted, and domestic autonomous operating systems based on open source Linux operating systems are increasingly developed, but the serious shortage of the ecological application of the Linux operating systems still is a pain point which puzzles the real market promotion of the Linux operating systems.
In order to solve the ecological problem of the Linux operating system, two key points of insufficient user number and insufficient number of platform application software must be solved. Android has a wide user group in the field of mobile terminals, a mature development platform and an application software group, and has a certain reference value for solving the current embarrassment of a Linux operating system.
The Android operating system is developed based on the Linux kernel, and the characteristics of the mobile terminal device are greatly improved and enhanced in the user space, so that great possibility and convenience are provided for the Linux operating system to be compatible with Android applications, and rich applications of a mobile terminal can be successfully operated on a PC terminal. In recent years, compatible support of an Android application ecology on a Linux operating system becomes a research hotspot, many researchers at home and abroad try to migrate an Android operating environment to a Linux computer platform to realize the effect of compatible support of the Android application ecology on the Linux operating system, and various compatible technologies are derived, wherein the technologies comprise an ARC (application Runtime for chrome) technology of Google, a virtual machine and simulator technology, an Android (Android in a Box) project and the like, and the technologies fuse a PC end and a mobile end to successfully migrate the Android application ecology to the Linux, thereby greatly promoting the development of the Linux application ecology, making up for the defects of the Linux application to a great extent, facilitating daily office, entertainment and other requirements of users of the Linux operating system, and accelerating the pace of the Linux operating system to the consumer market, but all of the technologies have the problem of user experience which cannot be ignored, including stability, ease of use, functional completeness, etc., have not significantly advanced this area of technology.
For Android applications running on a Linux operating system, dependence of common human-computer interaction on Linux system side peripherals is particularly important; because of the indispensable requirements of the user on increasing online social contact, business communication, online shopping and the like, whether the user is convenient to use the camera and whether the function is stable becomes an indispensable optimization link for the Android application compatible Linux system.
Based on the use scene of the Android system of the current mobile terminal to the camera: and using a container correlation technology to map the camera equipment node to the Android environment when the container is created, so that the Android system can directly operate the camera equipment node in the container. The disadvantages of this approach are first: the method comprises the following steps that a user opens the Android environment under the condition that a camera is not accessed in advance, and at the moment, if the user wants to use the camera, the PC is restarted after the camera is connected; secondly, if the camera is plugged in or pulled out after the Android environment is started, the camera cannot be used; thirdly, the cameras can be accessed based on a plurality of usb ports of the PC terminal, and if a user wants to switch between a plurality of cameras for use, the whole PC environment also needs to be restarted after switching. Therefore, the great inconvenience undoubtedly brings great distress to users and hinders the ecological migration of Android applications.
Disclosure of Invention
In view of the above, the invention provides a method for enabling Android to support hot plug of a camera when Linux is compatible with an Android system, and the method establishes a camera service end at the Linux end, inputs a camera monitoring program, adapts and optimizes an Android camera hardware abstraction layer, breaks through a gap between the Android and the Linux system caused by a container, and enables Android applications to be plugged and used for the camera.
The invention provides a method for enabling an Android-supported camera to be hot-plugged when Linux is compatible with an Android system.
The method comprises the following steps:
step S1: preparing an Android-compatible operating environment of the Linux system;
step S2: the method comprises the steps that a Linux camera server is created and used for receiving a request for opening a camera of an Android terminal and returning a file descriptor of the camera, which is obtained by the request for opening the camera, to the Android terminal;
step S3: modifying a camera hardware abstraction layer of an Android end, sending a request for opening the camera to a Linux end, and receiving a file descriptor of the camera sent by the Linux end;
step S4: the Android application is started to access the camera, a request for opening the camera is transmitted to the camera hardware abstraction layer through the camera service framework, the camera hardware abstraction layer sends the request for opening the camera to the Linux end, the Linux end camera service end returns a corresponding file descriptor of the camera to the Android end after receiving the request for opening the camera of the Android end, and the Android end obtains the permission for operating the camera.
The technical scheme of the invention is further improved as follows: the preparation of the operating environment of step S1 includes the following specific steps:
step S101: loading an Android mirror image on a Linux system by using a docker container, and enabling the Linux and an Android system to share the same Linux kernel;
step S102: and starting an Android running environment in the docker container.
The technical scheme of the invention is further improved as follows: in step S2, creating a Linux camera server, including the following steps:
step S201: establishing a camera resident service at a Linux end, and starting the camera resident service along with the start of a Linux system;
step S202: the method comprises the steps of starting a thread in a camera resident service, establishing a socket communication server in the thread, wherein the socket communication server is used for monitoring a request for opening the camera sent by an Android terminal, and linking a created socket file into a socket container, so that the Android terminal and a Linux terminal carry out socket communication through the socket file.
The technical scheme of the invention is further improved as follows: the step S3 includes the following specific steps:
step S301: the hardware abstraction layer of the Android-end camera modifies and opens an open function of the camera, a socket communication client is established at the Android end,
step S302: and the socket communication client of the Android end is connected with the socket communication server of the Linux end.
The technical scheme of the invention is further improved as follows:
the step S4 includes the following steps:
step S401: the Android application initiates a request for accessing the camera;
step S402: the Android camera service framework judges whether an application occupies camera resources or not, and if not, a request for opening the camera is directly transmitted downwards; if so, closing the camera resource of the current application, and then resending a request for opening the camera to the bottom layer;
step S403: when an Android application sends a request for opening a camera, an open function in a camera hardware abstraction layer is called through a camera subsystem under the Android, and the request for opening the camera is sent to a Linux end through socket communication;
step S404: when the Linux end receives a request for opening the camera from the Android end, opening the camera by using an open function in the Linux;
step S405: opening the camera by using an open function in Linux to obtain a corresponding file descriptor of the camera, and returning the file descriptor of the camera to an Android terminal in a message form through a socket communication server;
step S406: the Android terminal waits for a message returned by a Linux terminal camera server side by using a recvmsg function, the returned message is in the structure msghdr, and then a file descriptor of the camera is analyzed from the structure msghdr;
step S407: the Android terminal obtains a file descriptor of the camera and has the same authority as that of the Linux terminal to operate the camera; and the Android terminal operates the camera by using the ioctl function to acquire the equipment attribute and acquire the image data.
The technical scheme of the invention is further improved as follows: in step S404: when the camera is inserted, the Linux system forms a device node path of the inserted camera under the/dev directory, and the device node path representing the camera in the open function generally comprises/dev/video 0,/dev/video 2 and the like.
The technical scheme of the invention is further improved as follows: in step S405, the file descriptor of the camera is allocated by the kernel when the open function in Linux opens the camera, the file descriptor of the camera is only valid in one process, two different processes use the same file descriptor of the camera, the two different processes do not point to the same file, and the two different processes have the same authority to operate the same file through the file descriptor transfer of the camera.
The technical scheme of the invention is further improved as follows: the file descriptor transmission of the camera is realized by utilizing an anonymous Unix domain socket sendmsg/recvmsg; sendmsg provides the functionality to pass control information; in the cmsghdr member of the msghdr variable, which is the second parameter of sendmsg, the control headers cmsg _ level and cmsg _ type set the file descriptor transfer attribute of the camera, and the transferred file descriptor of the camera is saved as a data part after the cmsghdr variable.
The technical scheme of the invention is further improved as follows: the method further includes step S5: randomly switching a plurality of cameras of the Linux end;
the step S5 of arbitrarily switching the plurality of cameras of the Linux side includes the steps of:
step S501: the method comprises the steps that a monitoring program for monitoring a camera equipment node is input by a Linux end, and the monitoring program is provided with a configuration interface for a user to select a camera;
step S502: when a camera provided for Android application is unplugged or a user selects another camera, switching to the next camera for selection or another camera selected by the user immediately;
step S503: and when the Android terminal requests to open the camera again, the newly configured camera is opened and the file descriptor of the newly configured camera is sent to the Android terminal, and the Android application opens the newly configured camera to complete the switching of the camera.
Compared with the prior art, the invention has the beneficial effects that: the plug-and-play function of the cameras is realized, the Android application running on the Linux system can also switch and use a plurality of cameras of the Linux end at will, the requirement of a user on convenience and rapidness in use of peripheral equipment is greatly met, and an important step is further provided for ecologically and better migration of the Android application to Linux.
Of course, it is not necessary for any one product in which the invention is practiced to achieve all of the above-described technical effects simultaneously.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a relational diagram of the main call flow of one embodiment of the invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the accompanying drawings in conjunction with the following detailed description. It should be understood that the description is intended to be exemplary only, and is not intended to limit the scope of the present invention. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present invention.
The method for enabling the Android to support the hot plug of the camera when the Linux is compatible with the Android system establishes the camera service end at the Linux end, inputs the camera monitoring program, adapts and optimizes the Android camera hardware abstraction layer, breaks through a gap between the Android and the Linux system caused by a container, and enables the Android application to be plug and play for the camera.
As shown in fig. 1, a method for enabling an Android-enabled camera to be hot-plugged when Linux is compatible with an Android system is applied to an operating environment of the Linux-compatible Android system, and the camera can be plugged and used in the operating environment of the Android;
the method comprises the following steps:
step S1: preparing an Android-compatible operating environment of the Linux system;
step S2: the method comprises the steps that a Linux camera server is created and used for receiving a request for opening a camera of an Android terminal and returning a file descriptor of the camera, which is obtained by the request for opening the camera, to the Android terminal;
step S3: modifying a camera hardware abstraction layer of an Android end, sending a request for opening the camera to a Linux end, and receiving a file descriptor of the camera sent by the Linux end;
step S4: the Android application is started to access the camera, a request for opening the camera is transmitted to the camera hardware abstraction layer through the camera service framework, the camera hardware abstraction layer sends the request for opening the camera to the Linux end, the Linux end camera service end returns a corresponding file descriptor of the camera to the Android end after receiving the request for opening the camera of the Android end, and the Android end obtains the permission for operating the camera.
Further, the preparation work of the operating environment compatible with Android of the Linux system in the step S1 is implemented according to the following steps:
step S101: loading the Android mirror image by using a docker container on a Linux system, so that the Linux and the Android system share the same Linux kernel;
step S102: and starting an Android running environment in the docker container.
Further, in step S2, creating a Linux camera server, including the following specific steps:
step S201: establishing a camera resident service at a Linux end, wherein the camera resident service is started along with the start of a Linux system;
step S202: the method comprises the steps of starting a thread in a camera resident service, establishing a socket communication server in the thread, wherein the socket communication server can be used for monitoring a request sent by an Android terminal for opening the camera, and linking a created socket file into a socket container, so that the Android terminal and a Linux terminal carry out socket communication through the socket file.
Further, the step S3 includes the following specific steps:
step S301: and the Android end camera hardware abstraction layer modifies and opens an open function of the camera, and a socket communication client is established at the Android end.
Step S302: the socket communication client side of the Android side is connected with the socket communication server side of the Linux side, and after the connection is established, the Android side and the Linux side can transmit messages.
Further, the step S4 includes the following steps:
step S401: the Android application initiates a request for accessing the camera;
step S402: the Android camera service framework judges whether an application occupies camera resources or not, and if not, a request for opening the camera is directly transmitted downwards; if so, closing the camera resource of the current application, and then resending a request for opening the camera to the bottom layer;
step S403: when an Android application sends a request for opening a camera, an open function in a camera hardware abstraction layer is called through a camera subsystem under the Android, and the request for opening the camera is sent to a Linux end through socket communication;
step S404: when the Linux end receives a request for opening the camera from the Android end, opening the camera by using an open function in the Linux; on one hand, when the camera is inserted, the Linux system forms an equipment node path of the inserted camera under the/dev directory, the equipment node path representing the camera in the open function generally comprises/dev/video 0,/dev/video 2 and the like, and the corresponding equipment node path disappears after the camera is pulled out; the open function can screen out camera equipment meeting the conditions from the equipment node path and open the camera equipment.
Step S405: opening the camera by using an open function in Linux to obtain a corresponding file descriptor of the camera, and returning the file descriptor of the camera to an Android terminal in a message form through a socket communication server;
the file descriptor of the camera is distributed by the kernel when the open function in Linux opens the camera, the file descriptor of the camera is only effective in one process, two different processes can use the same file descriptor of the camera, but the two different processes do not point to the same file. The two different processes have the same authority to operate the same file, and the operation is realized through the file descriptor transmission of the camera.
The file descriptor transmission of the camera is realized by utilizing an anonymous Unix domain socket sendmsg/recvmsg; sendmsg provides the functionality to pass control information; in the cmsghdr member of the second parameter msghdr variable of sendmsg, the control header cmsg _ level and cmsg _ type set the file descriptor transfer attribute of the camera, and the transferred file descriptor of the camera is stored as a data part behind the cmsghdr variable, so that the function of transferring the file descriptor of the camera can be realized.
Step S406: the Android terminal waits for a message returned by the Linux terminal camera service terminal by using a recvmsg function, the returned message is in the structure msghdr, and then a file descriptor of the camera is analyzed from the structure msghdr; the file descriptor of the camera is stored in the structure cmsghdr, and the member pointer variable msg _ control in the structure msghdr points to the cmsghdr structure address.
Step S407: the Android end obtains a file descriptor of the camera and has the same authority as the Linux end to operate the camera; and the Android terminal operates the camera by using the ioctl function to acquire the equipment attribute and acquire the image data.
The present invention is still further characterized in that the method further comprises step S5: randomly switching a plurality of cameras of the Linux end;
the step S5 of arbitrarily switching the plurality of cameras of the Linux side includes the steps of:
step S501: the method comprises the following steps that a monitoring program for monitoring a camera equipment node is input by a Linux end, and the monitoring program is provided with a configuration interface for a user to select a camera;
step S502: when a camera provided for Android application is unplugged or a user selects another camera, switching to the next camera for selection or another camera selected by the user immediately;
step S503: and when the Android terminal requests to open the camera again, the newly configured camera is opened and the file descriptor of the newly configured camera is sent to the Android terminal, and the Android application opens the newly configured camera to fulfill the aim of switching the camera.
The invention has the beneficial effects that: the Android application running on the Linux system can also use the camera as desired, so that the plug-and-play of the camera is really realized; meanwhile, under the condition of having a plurality of cameras, the possibility of selecting which one the cameras is used by a user is provided, the requirement of the user on convenient use of the peripheral equipment is greatly met, and an important step is also provided for ecologically migrating Android applications to Linux.
The method for enabling the Android-supported camera to be hot-plugged when the Linux is compatible with the Android system provided by the embodiment of the invention is described in detail above. The above description of the embodiments is only intended to facilitate the understanding of the method of the invention and its core ideas; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
As used in the specification and claims, certain terms are used to refer to particular components or modules. As one skilled in the art will appreciate, different mechanisms may refer to a same component or module by different names. This specification and claims do not intend to distinguish between components that differ in name but not function. In the following description and in the claims, the terms "include" and "comprise" are used in an open-ended fashion, and thus should be interpreted to mean "include, but not limited to. "substantially" means within an acceptable error range, and a person skilled in the art can solve the technical problem within a certain error range to substantially achieve the technical effect. The following description is of the preferred embodiment for carrying out the invention, and is made for the purpose of illustrating the general principles of the invention and not for the purpose of limiting the scope of the invention. The scope of the present invention is defined by the appended claims.
It is also noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a good or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such good or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a commodity or system that includes the element.
While the foregoing description shows and describes several preferred embodiments of the invention, it is to be understood, as noted above, that the invention is not limited to the forms herein, but is not to be construed as excluding other embodiments and is capable of use in various other combinations, modifications, and environments and is capable of changes within the scope of the inventive concept as expressed herein, commensurate with the above teachings, or the skill or knowledge of the relevant art. And that modifications and variations may be effected by those skilled in the art without departing from the scope of the invention, which is defined by the claims appended hereto.

Claims (9)

1. A method for enabling Android to support hot plug of a camera when Linux is compatible with an Android system is characterized in that the method is applied to an operating environment of the Linux compatible with the Android system;
the method comprises the following steps:
step S1: preparing an Android-compatible operating environment of the Linux system;
step S2: the method comprises the steps that a Linux camera server is created and used for receiving a request for opening a camera of an Android terminal and returning a file descriptor of the camera, which is obtained by the request for opening the camera, to the Android terminal;
step S3: modifying a camera hardware abstraction layer of an Android end, sending a request for opening the camera to a Linux end, and receiving a file descriptor of the camera sent by the Linux end;
step S4: the Android application is started to access the camera, a request for opening the camera is transmitted to the camera hardware abstraction layer through the camera service framework, the camera hardware abstraction layer sends the request for opening the camera to the Linux end, the Linux end camera service end returns a corresponding file descriptor of the camera to the Android end after receiving the request for opening the camera of the Android end, and the Android end obtains the permission for operating the camera.
2. The method for enabling the Android-enabled camera to be hot-plugged when the Linux is compatible with the Android system according to claim 1, wherein the method comprises the following steps: the preparation of the operating environment of step S1 includes the following specific steps:
step S101: loading an Android mirror image on a Linux system by using a docker container, and enabling the Linux and an Android system to share the same Linux kernel;
step S102: and starting an Android running environment in the docker container.
3. The method for enabling the Android-enabled camera to be hot-plugged when the Linux is compatible with the Android system according to claim 1, wherein the method comprises the following steps: in step S2, creating a Linux camera server, including the following steps:
step S201: establishing a camera resident service at a Linux end, and starting the camera resident service along with the start of a Linux system;
step S202: the method comprises the steps of starting a thread in a camera resident service, establishing a socket communication server in the thread, wherein the socket communication server is used for monitoring a request for opening the camera sent by an Android terminal, and linking a created socket file into a socket container, so that the Android terminal and a Linux terminal carry out socket communication through the socket file.
4. The method for enabling Android-enabled camera hot-plugging when Linux compatible with Android system according to claim 3, characterized in that: the step S3 includes the following specific steps:
step S301: the hardware abstraction layer of the Android-end camera modifies and opens an open function of the camera, a socket communication client is established at the Android end,
step S302: and the socket communication client of the Android end is connected with the socket communication server of the Linux end.
5. The method for enabling the Android-enabled camera to be hot-plugged when the Linux is compatible with the Android system according to claim 1, wherein the method comprises the following steps: the step S4 includes the following steps:
step S401: the Android application initiates a request for accessing the camera;
step S402: the Android camera service framework judges whether an application occupies camera resources or not, and if not, a request for opening the camera is directly transmitted downwards; if so, closing the camera resource of the current application, and then resending a request for opening the camera to the bottom layer;
step S403: when an Android application sends a request for opening a camera, an open function in a camera hardware abstraction layer is called through a camera subsystem under the Android, and the request for opening the camera is sent to a Linux end through socket communication;
step S404: when the Linux end receives a request for opening the camera from the Android end, opening the camera by using an open function in the Linux;
step S405: opening the camera by using an open function in Linux to obtain a corresponding file descriptor of the camera, and returning the file descriptor of the camera to an Android terminal in a message form through a socket communication server;
step S406: the Android terminal waits for a message returned by a Linux terminal camera server side by using a recvmsg function, the returned message is in the structure msghdr, and then a file descriptor of the camera is analyzed from the structure msghdr;
step S407: the Android terminal obtains a file descriptor of the camera and has the same authority as that of the Linux terminal to operate the camera; and the Android terminal operates the camera by using the ioctl function to acquire the equipment attribute and acquire the image data.
6. The method for enabling Android-enabled camera hot-plugging when Linux compatible with Android system according to claim 5, wherein: in step S404: when the camera is inserted, the Linux system forms a device node path of the inserted camera under the/dev directory, and the device node path representing the camera in the open function comprises/dev/video 0 and/dev/video 2.
7. The method for enabling Android-enabled camera hot-plugging when Linux compatible with Android system according to claim 5, wherein: in step S405, the file descriptor of the camera is allocated by the kernel when the open function in Linux opens the camera, and the file descriptor of the camera is valid only in one process; the two different processes use the same file descriptor of the camera, and the two different processes do not point to the same file; two different processes have the same authority to operate the same file through the file descriptor transfer of the camera.
8. The method for enabling Android enabled camera hot-plugging when Linux compatible with Android system as claimed in claim 7, wherein:
the file descriptor transmission of the camera is realized by utilizing an anonymous Unix domain socket sendmsg/recvmsg; sendmsg provides the function of passing control information; in the cmsghdr member of the msghdr variable, which is the second parameter of sendmsg, the control headers cmsg _ level and cmsg _ type set the file descriptor transfer attribute of the camera, and the transferred file descriptor of the camera is saved as a data part after the cmsghdr variable.
9. The method for enabling the Android-enabled camera to be hot-plugged when the Linux is compatible with the Android system according to claim 1, wherein the method comprises the following steps: the method further includes step S5: randomly switching a plurality of cameras of the Linux end;
step S5 includes the following steps:
step S501: the method comprises the steps that a monitoring program for monitoring a camera equipment node is input by a Linux end, and the monitoring program is provided with a configuration interface for a user to select a camera;
step S502: when a camera provided for Android application is unplugged or a user selects another camera, switching to the next camera for selection or another camera selected by the user immediately;
step S503: and when the Android terminal requests to open the camera again, the newly configured camera is opened and the file descriptor of the newly configured camera is sent to the Android terminal, and the Android application opens the newly configured camera to complete the switching of the camera.
CN202210034222.XA 2022-01-13 2022-01-13 Method for enabling Android-supported camera to be hot-plugged when Linux is compatible with Android system Active CN114047964B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210034222.XA CN114047964B (en) 2022-01-13 2022-01-13 Method for enabling Android-supported camera to be hot-plugged when Linux is compatible with Android system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210034222.XA CN114047964B (en) 2022-01-13 2022-01-13 Method for enabling Android-supported camera to be hot-plugged when Linux is compatible with Android system

Publications (2)

Publication Number Publication Date
CN114047964A true CN114047964A (en) 2022-02-15
CN114047964B CN114047964B (en) 2022-05-10

Family

ID=80196410

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210034222.XA Active CN114047964B (en) 2022-01-13 2022-01-13 Method for enabling Android-supported camera to be hot-plugged when Linux is compatible with Android system

Country Status (1)

Country Link
CN (1) CN114047964B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115118719A (en) * 2022-06-20 2022-09-27 福建升腾资讯有限公司 Method and system for connecting camera equipment of cloud desktop
CN117148959A (en) * 2023-02-27 2023-12-01 荣耀终端有限公司 Frame rate adjusting method for eye movement tracking and related device

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100195538A1 (en) * 2009-02-04 2010-08-05 Merkey Jeffrey V Method and apparatus for network packet capture distributed storage system
CN102799550A (en) * 2012-06-21 2012-11-28 华为终端有限公司 Awakening and hot-plugging methods and equipment based on high speed inter-chip (HSIC)
CN104133711A (en) * 2014-08-07 2014-11-05 深圳市元征科技股份有限公司 Camera safe switching method based on Android system
CN104516760A (en) * 2014-12-12 2015-04-15 华为技术有限公司 Operating system hot-switching method and device and mobile terminal
CN111581144A (en) * 2020-03-24 2020-08-25 惠州市德赛西威智能交通技术研究院有限公司 Vehicle-mounted camera hot-plug self-recovery method and device and storage medium
CN112612536A (en) * 2020-12-15 2021-04-06 麒麟软件有限公司 Method and device for controlling camera shooting based on Android application program in Linux system
CN113220363A (en) * 2021-05-06 2021-08-06 技德技术研究所(武汉)有限公司 File opening method and device compatible with Android system running on Linux
CN113342422A (en) * 2021-06-29 2021-09-03 技德技术研究所(武汉)有限公司 Linux-compatible Android multi-application camera access method and device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100195538A1 (en) * 2009-02-04 2010-08-05 Merkey Jeffrey V Method and apparatus for network packet capture distributed storage system
CN102799550A (en) * 2012-06-21 2012-11-28 华为终端有限公司 Awakening and hot-plugging methods and equipment based on high speed inter-chip (HSIC)
CN104133711A (en) * 2014-08-07 2014-11-05 深圳市元征科技股份有限公司 Camera safe switching method based on Android system
CN104516760A (en) * 2014-12-12 2015-04-15 华为技术有限公司 Operating system hot-switching method and device and mobile terminal
CN111581144A (en) * 2020-03-24 2020-08-25 惠州市德赛西威智能交通技术研究院有限公司 Vehicle-mounted camera hot-plug self-recovery method and device and storage medium
CN112612536A (en) * 2020-12-15 2021-04-06 麒麟软件有限公司 Method and device for controlling camera shooting based on Android application program in Linux system
CN113220363A (en) * 2021-05-06 2021-08-06 技德技术研究所(武汉)有限公司 File opening method and device compatible with Android system running on Linux
CN113342422A (en) * 2021-06-29 2021-09-03 技德技术研究所(武汉)有限公司 Linux-compatible Android multi-application camera access method and device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115118719A (en) * 2022-06-20 2022-09-27 福建升腾资讯有限公司 Method and system for connecting camera equipment of cloud desktop
CN115118719B (en) * 2022-06-20 2023-11-10 福建升腾资讯有限公司 Method and system for connecting camera equipment of cloud desktop
CN117148959A (en) * 2023-02-27 2023-12-01 荣耀终端有限公司 Frame rate adjusting method for eye movement tracking and related device

Also Published As

Publication number Publication date
CN114047964B (en) 2022-05-10

Similar Documents

Publication Publication Date Title
CN114047964B (en) Method for enabling Android-supported camera to be hot-plugged when Linux is compatible with Android system
JP7058654B2 (en) Resource sharing methods, equipment and systems
CN109496415B (en) Method and system for accessing remote acceleration equipment by virtual machine
CN104809369B (en) Packet sets method, client, server and the system of equipment access rights
CN106850384A (en) A kind of method and mobile terminal for realizing accessing equipment in LAN
CN103812900A (en) Data synchronization method, device and system
CN110784939B (en) Data communication method, device and system
CN108462701B (en) Hotspot-free shared mobile phone network surfing system and method
CN102858025A (en) Method and device of point-to-point interactive operation
CN107332894B (en) Live broadcast method, device and system, server and storage medium
CN114385304B (en) Method for calling Linux screenshot tool by android application
CN112954059A (en) Computing power sharing method, computing power sharing system and storage medium
CN104301400B (en) Multi-screen collaboration and resource share method based on Samba agreements
CN112187486B (en) Interaction method between intelligent devices and intelligent device
US10505811B2 (en) Multi-terminal interaction relation maintenance system and method
CN112791385A (en) Game running method and device, control equipment and server
CN111954162B (en) Method for realizing wireless screen transmission through autonomous networking among multiple devices, screen transmission end and receiving end
CN108712280B (en) Network function management method and device, storage medium and intelligent terminal
CN103781138A (en) Method, apparatus and system for connecting WiMo sending terminal to WLAN
CN113746909A (en) Network connection method, device, electronic equipment and computer readable storage medium
CN112399242A (en) Mobile network connection method, device, equipment and medium based on television
CN112383617A (en) Method, device, terminal equipment and medium for long connection
CN111278081B (en) Network access control method and related device
CN112333069B (en) Bus virtualization communication method
CN114095476B (en) Method for inquiring router interface by electronic equipment, router and communication system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant