A drive file change method, device, medium and equipment
By identifying and synchronizing the attribute values of the device characteristic description files (PPD files) for the first and second paths in the Linux/Unix operating system, user issues caused by inconsistencies in PPD files after driver updates are resolved, improving user experience and device stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHUHAI PANTUM ELECTRONICS CO LTD
- Filing Date
- 2022-11-18
- Publication Date
- 2026-05-12
AI Technical Summary
In Linux/Unix operating systems, after a driver update, the contents of the PPD file in the second path are inconsistent with those in the first path, causing users to be unable to use the printing device normally, increasing the user's operational burden and confusion.
By responding to instructions, the preset attribute values of the device feature description files in the first path are determined, and the configuration parameters in the second path that match the attribute values are changed to be the same as those in the first path, ensuring consistency between the two, including synchronous processing of related files during software updates or deletions.
This prevents users from being unable to use the printing device properly after driver updates, simplifies user operations, improves user experience, and reduces misjudgments of device malfunctions caused by version differences.
Smart Images

Figure CN115718575B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of driver technology, and specifically to a method, apparatus, medium, and device for modifying driver files. Background Technology
[0002] In a typical Linux / Unix-based operating system, after the printer driver package is installed, the driver files are installed in the first path, which includes a PPD (Printer Postscript Description) file that describes information about the printer device. The PPD file can describe information such as manufacturer information, functions, and driver startup method; one PPD file corresponds to one device model.
[0003] When a user adds a printer, the printing system searches for a matching PPD file in the second path to generate an interactive device icon in order to match the correct driver. The user can use this icon to set printing parameters or issue print jobs. A corresponding PPD file is also generated in the second path, with the same content as the one in the first path by default. Furthermore, if the user changes printing parameters via the device icon in the driver interface, the operating system will make the same changes in the PPD file in the second path.
[0004] However, the operating system cannot always successfully keep the contents of the PPD file in the second path consistent with those in the first path. Summary of the Invention
[0005] One objective of this invention is to address the shortcomings of existing technologies in some cases where users are unable to use the printing device properly after a driver update.
[0006] According to a first aspect of the present invention, a driver file modification method is provided, the method comprising: responding to a first instruction, determining a preset attribute value of at least one first device feature description file in a first path; the first path being used to store driver installation files; modifying at least one configuration parameter in a second device feature description file in a second path that conforms to the preset attribute value to be the same as the corresponding first device feature description file; the second path being used to store system settings files.
[0007] Preferably, the first instruction is executed after the software update command is triggered, and the software update command is used to update at least the first device feature description file in the first path, without making the same changes to the second device feature description file in the second path that corresponds to the first device feature description file.
[0008] Preferably, the corresponding first device feature description file is a first feature description file that has the same preset attribute values as the second device feature description file.
[0009] Preferably, determining the preset attribute value of at least one first device feature description file in the first path includes: reading and saving the preset attribute values of all first device feature description files in the first path.
[0010] Changing at least one configuration parameter in a second device feature description file that conforms to the preset attribute value in the second path to be the same as the corresponding first device feature description file includes: traversing all second device feature description files in the second path, and for a second device feature description file that conforms to the preset attribute value, updating the configuration parameter in the first feature description file that has the same preset attribute value as the second device feature description file in the first path to the second device feature description file.
[0011] Preferably, before responding to the first instruction, the method further includes: determining whether the triggered command is a software update command or a software deletion command; if it is a software deletion command, then after the software deletion command is triggered: responding to the second instruction, determining the preset attribute value of at least one first device feature description file to be deleted in the first path; and deleting the second device feature description file in the second path that matches the preset attribute value.
[0012] Preferably, changing at least one configuration parameter in the second device feature description file that conforms to the preset attribute value in the second path to be the same as the corresponding first device feature description file specifically involves: generating a new second device feature description file based on the corresponding first device feature description file, replacing the original second device feature description file; before replacement, saving at least one configuration parameter of the original second device feature description file; the method further includes: when replacing the original second device feature description file, restoring the corresponding configuration parameters of the new second device feature description file to be the same as the original second device feature description file.
[0013] According to a second aspect of the present invention, a driver file modification apparatus is provided, comprising: a determining unit, configured to determine, in response to a first instruction, a preset attribute value of at least one first device feature description file in a first path; the first path being used to store driver installation files; and a modification unit, configured to modify at least one configuration parameter in a second device feature description file in a second path that conforms to the preset attribute value to be identical to the corresponding first device feature description file; the second path being used to store system setting files.
[0014] Preferably, the driver file modification device further includes a software update command detection unit, which executes a first instruction after detecting a software update command; the software update command is used to update at least the first device feature description file in the first path, without making the same change to the second device feature description file in the second path corresponding to the first device feature description file.
[0015] Preferably, the corresponding first device feature description file is a first feature description file that has the same preset attribute values as the second device feature description file.
[0016] Preferably, the driver file modification device further includes: a software deletion command detection unit, configured to execute a second instruction after detecting a software deletion command; a second determination unit, configured to determine a preset attribute value of at least one first device feature description file to be deleted in the first path in response to the second instruction; and a deletion unit, configured to delete files in the second path that conform to the preset attribute value.
[0017] Preferably, the modification unit is specifically used to: generate a new second device feature description file based on the corresponding first device feature description file, and replace the original second device feature description file; before replacement, save at least one configuration parameter of the original second device feature description file; the device further includes: a restoration unit, used to restore the corresponding configuration parameters of the new second device feature description file to be the same as those of the original second device feature description file when replacing the original second device feature description file.
[0018] According to a third aspect of the present invention, a computer-readable storage medium is provided, the storage medium including a stored program that, when the program is executed, controls the device where the storage medium is located to perform the driver file modification method as described in the first aspect of the present invention.
[0019] According to a fourth aspect of the present invention, an information processing device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the driver file modification method described in the first aspect of the present invention.
[0020] One technical advantage of this invention is that it can prevent the problem of users being unable to use the printing device through the device interaction components already added by the driver application after the system performs a software update.
[0021] Other features and advantages of the invention will become clear from the following detailed description of exemplary embodiments of the invention with reference to the accompanying drawings. Attached Figure Description
[0022] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments of the invention and, together with their description, serve to explain the principles of the invention.
[0023] Figure 1 This is a flowchart of a method according to an embodiment of the present invention;
[0024] Figure 2 This is a structural diagram of a device according to an embodiment of the present invention;
[0025] Figure 3 This is a structural diagram of an information processing device according to an embodiment of the present invention;
[0026] Figure 4(a) is a schematic diagram of the prior art before the improvement of the present invention;
[0027] Figure 4(b) is a schematic diagram of the user clicking button B1 to add a device in Figure 4(a);
[0028] Figure 4(c) shows a schematic diagram after a user updates the version;
[0029] Figure 5 This is an execution flowchart of an embodiment of the present invention;
[0030] Figure 6 The execution flowchart further includes step S513. Detailed Implementation
[0031] Various exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values of the components and steps set forth in these embodiments do not limit the scope of the invention.
[0032] The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the invention or its application or use.
[0033] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.
[0034] In all the examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values.
[0035] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.
[0036] One objective of this invention is to address the problem that, in some cases, the contents of the PPD file in the second path are inconsistent with those in the first path, which prevents users from using the printing device as expected.
[0037] For example, in an existing Linux-based domestic operating system (such as UOS), if a user updates the driver software via an online store or command line, the PPD file in the first path will be updated along with the installation directory, but the PPD file in the second path will not be updated. When the user opens the driver software after the update to use the printing device, the interactive component displayed in the driver software (which can be exemplarily an icon button for the user to click) is coupled to the older version of the PPD file in the second path. This version difference may cause the user to be unable to use some functions or even complete a printing job. The user can correct this anomaly by deleting the interactive component and re-adding it, but on the one hand, this increases the burden on the user and affects the user experience; on the other hand, operating systems such as UOS have automatic software update functions, which may update the driver software without the user's notice. When the user clicks the interactive component in the driver software and finds that the printing device cannot be used as expected, they may mistakenly believe that the device is malfunctioning, deepening the user's confusion.
[0038] To address the above problems, embodiments of the present invention provide a method for modifying driver files, such as... Figure 1 As shown, it includes:
[0039] Step S101: In response to the first instruction, determine the preset attribute value of at least one first device feature description file in the first path.
[0040] In one embodiment, the first path can be a storage path that allows the user to store driver installation files. The first path can be a local computer storage path, or a storage path on a server or in the cloud. The first device characteristic description file can be a PPD file copied to the first path along with the driver installation package. The preset attribute value can be the attribute value corresponding to the keywords in the PPD file used to describe the manufacturer and device model, which can uniquely identify a device. For example, to filter out PPD files related to device model A, the attribute value corresponding to the keyword "*ModelName" in each PPD file can be read, and the attribute value can be used to determine whether it is a device from manufacturer A. The first instruction can be an input signal that enables step S101 to be executed, such as an instruction in a program statement, a user interaction instruction, etc. In one example, when the preset attribute value is used to characterize the device model, one PPD file in the first path will only correspond to one device model, meaning that the preset attribute value can serve as a unique device identifier.
[0041] Furthermore, determining the preset attribute values of the first device feature description file can be achieved by reading and saving the preset attribute values of all first device feature description files in the first path.
[0042] Step S102: Change at least one configuration parameter in the second device feature description file that meets the preset attribute value in the second path to be the same as the corresponding first device feature description file.
[0043] In one embodiment, the second path refers to a directory for storing system-generated files. For example, it could be a corresponding PPD file generated by the system in the second path based on the PPD file in the first path after the user operates the interactive component. The PPD file in the second path is the second device feature description file in step 102. Configuration parameters can be keywords in the PPD file; for example, the keyword "*DefaultInputSlot" can be used to describe paper tray features, and the keyword "*DefaultPageSize" can be used to describe paper size features, etc. The first feature description file under the first path and the second feature description file under the second path can point to the same device model from the same manufacturer. For example, the keywords related to the device model in the first feature description file and the second feature description file have the same key value.
[0044] In step S102, it is determined which PPD files in the second path also contain the attribute values determined in step S101. Then, the attribute values corresponding to at least one keyword of these PPD files in the second path are changed to enable the user to use the printing device normally. Which keywords are changed can be set as needed; for example, the attributes of all keywords can be changed, or only specific keywords can be changed. Changes can be additions, modifications, or deletions. Further, step S102 can be implemented by: traversing all second device feature description files in the second path; for second device feature description files that meet preset attribute values, updating the configuration parameters in the first feature description file in the first path that has the same preset attribute values as the second device feature description file to the second device feature description file.
[0045] In an optional embodiment, the first instruction can be executed after a software update command is triggered. The software update command updates at least the first device feature description file in the first path, without making the same changes to the second device feature description file corresponding to the first device feature description file in the second path. For example, the update command can be triggered by a user selecting the software update option in an online store, or by the operating system automatically executing the driver software update function. When the update command is triggered, the software driver package will be downloaded or copied to the first path, but no modifications will be made to the files in the second path. The method in this example can be implemented by an executable file in the software driver package. For example, when a user clicks the update button in an online store or enters an update command in the command line, the executable file is invoked to update the files in the first path. Then, the executable file issues the first instruction, and the update program responds to the first instruction to execute the driver file modification method of this embodiment.
[0046] In some existing operating systems, if a user selects the software uninstallation function in the app store, the driver files in the first path will be deleted, but the second device feature description file in the second path will not be deleted, resulting in residual software uninstallation. Therefore, in another optional embodiment, it can be determined first whether the triggered command is a software update command or a software uninstallation command. If it is a software uninstallation command, then after the software uninstallation command is triggered: in response to the second instruction, a preset attribute value of at least one first device feature description file to be deleted in the first path is determined; and the second device feature description file in the second path that matches the preset attribute value is deleted. That is, in this example, if it is determined that a software update command has been triggered, the step of synchronously updating the second device feature file to the same level as the first device feature file is executed; if it is determined that a software uninstallation command has been triggered, the second device feature file with the same preset attribute value as the first device feature file to be deleted is deleted along with it in the second path.
[0047] There are several ways to change at least one configuration parameter in the second device feature description file to be the same as the corresponding first device feature description file. In one example, the differences in keywords and attribute values between the PPD file of the first path and the PPD file of the second path can be compared, and the inconsistent parts of the second path PPD file can be modified to be the same as the first path PPD file. For example, if the first path PPD file adds a new keyword compared to the second path PPD file, then that keyword should also be added to the second path PPD file. Or, if the first path PPD file no longer has a certain keyword as in the second path PPD file, then that keyword and its corresponding attribute value can be deleted from the second path PPD file. As another example, if the minimum allowed value for the keyword related to print density in the first path PPD file is 1, while the minimum value in the second path PPD file is 0, then that value should be changed from 0 to 1 in the second path PPD file. In another example, a new second device feature description file can be generated based on the corresponding first device feature description file, replacing the original second device feature description file. This allows for a faster change of the PPD file in the second path to match the PPD file in the first path. However, this method may overwrite the configuration parameters already set by the user with the manufacturer's default configuration. Therefore, to ensure user experience, at least one configuration parameter from the original second device feature description file (which could be a configuration parameter of interest to the user or a parameter that the user has already configured) can be saved before replacement. Then, when replacing the original second device feature description file, the corresponding configuration parameters of the new second device feature description file should be restored to match those of the original second device feature description file. This ensures that users can still use the same configuration as before the update after the update, without having to reconfigure parameters after each update. "Corresponding configuration parameters" refers to configuration parameters that match the configuration parameters saved before replacement. It should be noted that sometimes new versions of drivers remove some configuration parameters. Understandably, these configuration parameters removed after the update will not be restored to the same state as before the update.
[0048] The present invention also includes a driver file changing device 200, such as Figure 2 As shown, it includes a determining unit 201 and a changing unit 202. Wherein:
[0049] The determining unit 201 is configured to, in response to the first instruction, determine the preset attribute values of at least one first device feature description file in the first path.
[0050] The modification unit 202 is used to modify at least one configuration parameter in the second device feature description file that conforms to the preset attribute value in the second path to be the same as the corresponding first device feature description file. The corresponding first device feature description file is a first feature description file that points to the same device model as the second device feature description file.
[0051] This embodiment is a virtual device corresponding to the method implementation. In one embodiment, the determining unit 201 and the changing unit 202 can be program modules located in the same or different locations in a software program. For example:
[0052] For the determining unit 201, the first instruction can be a program call statement, which executes the functional module of the determining unit 201 when called. When called, the determining unit 201 reads the first device feature description file in the first path (such as the storage path where the driver installation file is stored, which can be a local or cloud storage path). This reading can be done line by line, character by character, or other reading methods, or it can be done by matching the input string using a search algorithm; the search can be an exact search or a fuzzy search. The preset attribute value can be the key value corresponding to the keyword in the PPD file. For example, if the driver file is installed in the / usr / share / cups / model path, the PPD file in this path contains the setting item "*PageSizeA4:" recorded in the form of a string, where "PageSize" is the keyword and "A4" is its key value. In this case, "A4" can be used as the attribute value in this example. In one embodiment, the determining unit 201 can read the "PageSize" keyword of each PPD file one by one and record its corresponding key value as the attribute value. In another example, if the manufacturer information is the object of interest, then the keyword "ModelName" can be read, and the attribute value corresponding to the keyword and its corresponding device model can be recorded for use by the change unit 202.
[0053] For the modification unit 202, a second device feature description file matching preset attribute values can be searched in the second path (such as the storage path where system configuration files are stored). For example, the system configuration file is stored in the / etc / cups / ppd path, and the PPD files in this path are generated after the user adds a printer in the driver interface. Assuming that this embodiment intends to modify the PPD files corresponding to all manufacturers' devices involved in the first path, and the attribute values corresponding to the model and manufacturer information of these files have been recorded in the determination unit 101, then in the modification unit 202, the configuration parameters of the PPD files in the second path that match the aforementioned attribute values are modified with reference to the PPD files of the same model in the first path.
[0054] In an optional embodiment, the driver file modification device further includes: a software update command detection unit, configured to execute a first instruction upon detecting a software update command; the software update command is used to update at least a first device feature description file in a first path, without making the same change to a second device feature description file in a second path corresponding to the first device feature description file. The software update command detection unit can be a program module used to detect which interactive interface the user has selected. For example, a software store provides three interactive interfaces: "Install," "Update," and "Uninstall." When the user clicks the "Update" button, the software update command detection unit is triggered, first executing the driver file installation, and then issuing the first instruction after the driver file installation is complete, enabling the determination unit 201 to execute. In this embodiment, the software update command can at least update the first device feature description file in the first path when executing the driver file installation function; however, the software update command will not replace the update unit 202 in updating the first device feature description file. It should be noted that the software update instruction may also be automatically updated by the operating system at a predetermined update time, rather than being selected by the user.
[0055] In another optional embodiment, the system further includes: a software deletion command detection unit, configured to execute a second instruction upon detecting a software deletion command; a second determination unit, configured to, in response to the second instruction, determine a preset attribute value for at least one first device feature description file to be deleted in the first path; and a deletion unit, configured to delete a second device feature description file in the second path that matches the preset attribute value. That is, if this embodiment detects that a user has selected a deletion command, it deletes a second feature description file in the second path that points to the same model as the first feature description file to be deleted, based on the same logic.
[0056] The modification unit 202 can perform modifications in various ways. In one example, the modification unit 202 is specifically used to: generate a new second device feature description file based on the corresponding first device feature description file, replacing the original second device feature description file; before replacement, save at least one configuration parameter of the original second device feature description file; the device further includes: a restoration unit, used to restore the corresponding configuration parameters of the new second device feature description file to be the same as those of the original second device feature description file when replacing the original second device feature description file. The present invention also includes a computer-readable storage medium, including a stored program, which, when running, controls the device where the storage medium is located to execute the aforementioned driver file modification method.
[0057] The present invention also includes an information processing device, such as... Figure 3As shown, the device includes a processor 301, a memory 302, and a computer program 303 stored in the memory and executable on the processor 301. When the processor 301 executes the computer program 303, it implements the driver file modification method in the embodiment. To avoid repetition, these details are not elaborated here. Alternatively, when the computer program is executed by the processor 301, it implements the functions of each model / unit in the device of the embodiment. To avoid repetition, these details are not elaborated here.
[0058] Computer device 300 can be a desktop computer, laptop, handheld computer, cloud server, image forming apparatus, or other computing device. The computer device may include, but is not limited to, processor 301 and memory 302. Those skilled in the art will understand that... Figure 3 This is merely an example of computer device 300 and does not constitute a limitation on computer device 300. It may include more or fewer components than shown, or combine certain components, or different components. For example, computer device may also include input / output devices, network access devices, buses, etc.
[0059] The processor 301 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0060] The memory 302 can be an internal storage unit of the computer device 300, such as a hard disk or RAM of the computer device 300. The memory 302 can also be an external storage device of the computer device 300, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the computer device 300. Furthermore, the memory 302 can include both internal and external storage units of the computer device 300. The memory 302 is used to store computer programs and other programs and data required by the computer device. The memory 302 can also be used to temporarily store data that has been output or will be output.
[0061] <Application Example 1>
[0062] Figure 4(a) shows an example of the prior art before implementing the improvements of the present invention. R1 is a first path storing a first device feature description file F1 of version 1.0. R2 is a second path, where a second device feature description file has not yet been generated. D1 is the driver interface, where B1 is a button for adding a device, and C1 is a user-controllable cursor. The user can control the cursor C1 to click button B1 to add a printing device.
[0063] Figure 4(b) illustrates a user's manipulation of cursor C1 to click button B1 and add a printing device. After adding a device, the driver interface D1 generates a device icon P1 to represent the specific model of the added printing device. Simultaneously, a second device feature description file F2 is generated in the second path R2 based on the first device feature description file F1 stored in the first path R1. Clicking the device icon P1 brings up a parameter configuration interface, allowing the user to change the parameter configuration as needed. The dashed line in Figure 4(b) represents the relationship between the device icon P1 and the second device feature description file F2.
[0064] In this example, the driver version before the update was ver1.0, and the updated version is ver2.0. When the user clicks the "Add" button in the ver1.0 driver application interface, the operating system locates the corresponding PPD file in the first path based on the user's selected device model and generates a PPD file with the same content in the second path. When sending a print job to the printing device, the attribute values of the PPD file in the second path are used. In this example, in ver1.0, the driver application allows the user to set an adjustable value to 0 via an interactive component.
[0065] Figure 4(c) illustrates the scenario where the driver file is updated without using the method described in this example. The user performs the update function, upgrading the driver version to V2.0. At this point, both the first device feature description file F1 and the driver are updated to version 2.0, while the second device feature description file F2 under the second path R2 remains version 1.0. However, the version 2.0 driver requires the minimum adjustable value to be no less than 1. The adjustable value of 0 configured by the user in the version 1.0 driver is not a valid value. Therefore, when the user clicks on the device icon P1, which was added before the driver update, in the driver interface to send a print job, the user cannot successfully send the print job because the input parameters are not within the range allowed by version 2.0. The user can delete the device icon P1 and re-add it, allowing the system to regenerate a PPD file consistent with the first path in the second path based on this addition operation. However, this undoubtedly increases the complexity of the user's operation and requires the user to be familiar with the causes and solutions to the above problems. In particular, if the user is using an operating system such as UOS that performs automatic updates, the user may not realize that the system version has changed after the update, and it will be even more difficult to find the cause of the above problems. The user may mistakenly believe that the device is malfunctioning, thus hindering the user's normal use of the device.
[0066] The improved solution in this example is implemented through an installation script. After the user clicks the update function in the online store, the installation script is executed. The script contains instructions for copying the driver installation package and instructions for implementing steps S101 and S102. After the driver installation package is successfully copied to the first path, the installation script executes the first instruction to synchronize the PPD file in the second path with the corresponding PPD file in the first path through steps S101 and S102. Thus, after the user updates to ver2.0, the device icon P1 generated before the update corresponds to the ver2.0 version PPD file. The user can click this icon to issue print jobs or configure parameters without needing to resolve the aforementioned anomaly manually.
[0067] <Application Example 2>
[0068] This example, building upon application example 1, further improves the deletion function. If the system detects that a user has selected the deletion function on the online store interface, it first determines the device model corresponding to the deletion operation. Then, when deleting the driver files in the first path, it also deletes the corresponding PPD files for the same model in the second path. This prevents uninstallation remnants.
[0069] <Application Example 3>
[0070] The process in this example is as follows: Figure 5 As shown.
[0071] In step S501, the user selects the install, update, or uninstall function from the application store, or enters commands via the command line to install, update (i.e., overwrite installation), or uninstall the driver. The selection in the application store can include the user manually clicking the install, update, or uninstall button, or the operating system automatically performing the update operation according to its settings. The command-line operation allows the user to manually enter installation commands in the command line to install the driver package, bypassing the application store.
[0072] In step S502, the installation script is invoked based on the command issued in step S501. The installation script includes a first program module for installing the driver file and a second program module for updating the PPD file. After the first program module installs the driver file to the first path, it sends a first instruction to the second program module to execute.
[0073] In step S503, the second program module determines the type of command selected in step S501. If it is an update operation, step S513 is executed; otherwise, step S523 is executed.
[0074] In step S513, the PPD files in the second path are updated to match the content of the PPD files in the first path. In step S523, it is further determined whether it is a deletion operation. If so, step S524 is executed to delete the PPD files in the second path that belong to the same model as the PPD files in the first path to be deleted.
[0075] Step S513 further includes Figure 6 The execution flow is shown.
[0076] In step S601, the attribute value of the keyword "ModelName" and its corresponding file path are read and saved from all PPD files in the driver installation package. The PPDs in the driver installation package are installed under a first path. An example of the first path is / usr / share / cups / model. A first path may contain PPD files corresponding to multiple device models. By reading the attribute value of "ModelName", the manufacturer of the device can be determined, and the PPD file for that manufacturer's device can be modified. It can be understood that this step can also read attribute values other than "ModelName" as a filtering criterion.
[0077] In step S602, all PPD files in the second path are traversed, and the ModelName of each PPD file in the second path is read. An example of the second path is / etc / cups / ppd. It should be noted that the first and second paths may vary depending on the operating system; the above is just one example. In actual use, the operator can determine the path where the driver installation file is located as the first path and the path where the system settings file is located as the second path. The PPD files in the second path are generated based on when the user adds a printing device in the driver application interface. By reading the ModelName of the PPD files in the second path, it can be determined which device's corresponding PPD files the user has added. Whether the content of these PPD files in the second path is consistent with the PPD files in the first path will affect whether the user can use the printing device normally in the driver application.
[0078] In step S603, it is determined whether a PPD file with the same ModelName attribute value as the PPD file in the second path exists in the first path. If it does not exist, step S623 is executed, assuming that the PPD file in the second path does not need to be updated. If it exists, step S613 is executed, and the configuration parameters of the PPD file in the second path are updated using the PPD file with the same ModelName in the first path.
[0079] <Application Example 4>
[0080] This example further clarifies step S613. The specific process of updating the configuration parameters in S613 can be as follows: A new PPD file with identical content to the PPD file in the first path is generated, replacing the original PPD file in the second path by overwriting the existing file. Before overwriting, all configuration parameters of the original PPD file are saved. Then, after the replacement, the new PPD file is modified according to the saved configuration parameters, ensuring that the modified configuration parameters match the attribute values of the saved configuration parameters. In this example, no keywords are added or deleted to the new PPD file. The purpose of this example is to conveniently maintain content consistency between the PPD file in the second path and the PPD file in the first path by replacing the PPD file, without needing to individually judge or modify the attribute values of keywords. However, this setting may cause the user's configuration before the update to be overwritten with the manufacturer's default configuration, requiring manual reconfiguration after each update, thus degrading the user experience. This example can save the configuration parameters of the original PPD file before the update and then restore the configuration parameters of the new PPD file to the saved values after the update.
[0081] While specific embodiments of the invention have been described in detail by way of examples, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of the invention. Those skilled in the art should understand that modifications can be made to the above embodiments without departing from the scope and spirit of the invention. The scope of the invention is defined by the appended claims.
Claims
1. A method for modifying a driver file, used to modify a PPD file, characterized in that, The method includes: In response to a first instruction, a preset attribute value is determined for at least one first device feature description file in a first path; the first path is used to store driver installation files. At least one configuration parameter in the second device feature description file that conforms to the preset attribute value in the second path is changed to be the same as the corresponding first device feature description file; the second path is used to store system setting files; The first instruction is executed after the software update command is triggered. The software update command is used to update at least the first device feature description file in the first path, without making the same changes to the second device feature description file corresponding to the first device feature description file in the second path. Both the first device feature description file and the second device feature description file are PPD files.
2. The driver file modification method according to claim 1, characterized in that, The corresponding first device feature description file is: A first feature description file that has the same preset attribute values as the second device feature description file.
3. The driver file modification method according to claim 1, characterized in that, Determining preset attribute values for at least one first device feature description file in the first path includes: Read and save the preset attribute values of all first device feature description files in the first path.
4. The driver file modification method according to claim 1 or 3, characterized in that, Changing at least one configuration parameter in the second device feature description file that matches the preset attribute value in the second path to be the same as the corresponding first device feature description file includes: Traverse all second device feature description files in the second path. For a second device feature description file that meets the preset attribute value, update the configuration parameters in the first feature description file that has the same preset attribute value as the second device feature description file in the first path to the second device feature description file.
5. The driver file modification method according to claim 1, characterized in that, The response to the first instruction also includes: Determine whether the triggered command is a software update command or a software uninstallation command. If it is a software uninstallation command, then after the software uninstallation command is triggered: In response to the second instruction, a preset attribute value is determined for at least one first device feature description file to be deleted in the first path; Delete the second device feature description file in the second path that matches the preset attribute value.
6. The driver file modification method according to claim 1, characterized in that, Specifically, changing at least one configuration parameter in the second device feature description file that matches the preset attribute value in the second path to be the same as the corresponding first device feature description file involves: A new second device feature description file is generated based on the corresponding first device feature description file, replacing the original second device feature description file; Before replacement, save at least one configuration parameter of the original second device feature description file; The method further includes: When replacing the original second device feature description file, the corresponding configuration parameters of the new second device feature description file are restored to be the same as those of the original second device feature description file.
7. A driver file modification device for modifying PPD files, characterized in that, The device includes: The first determining unit is configured to, in response to a first instruction, determine a preset attribute value for at least one first device feature description file in a first path; the first path is used to store driver installation files. The modification unit is used to modify at least one configuration parameter in the second device feature description file that conforms to the preset attribute value in the second path to be the same as the corresponding first device feature description file; the second path is used to store system setting files; The first instruction is executed after the software update command is triggered. The software update command is used to update at least the first device feature description file in the first path, without making the same changes to the second device feature description file corresponding to the first device feature description file in the second path. Both the first device feature description file and the second device feature description file are PPD files.
8. The driver file modification device according to claim 7, characterized in that, The corresponding first device feature description file is: A first feature description file that has the same preset attribute values as the second device feature description file.
9. The driver file modification device according to claim 8, characterized in that, Also includes: The software removal command detection unit is used to execute a second instruction after detecting a software removal command; The second determining unit is configured to, in response to the second instruction, determine the preset attribute value of at least one first device feature description file to be deleted in the first path; The deletion unit is used to delete the second device feature description file in the second path that matches the preset attribute value.
10. The driver file modification device according to claim 7, characterized in that, The change unit is specifically used for: A new second device feature description file is generated based on the corresponding first device feature description file, replacing the original second device feature description file; Before replacement, save at least one configuration parameter of the original second device feature description file; The device further includes: The restoration unit is used to restore the corresponding configuration parameters of the new second device feature description file to be the same as those of the original second device feature description file when replacing the original second device feature description file.
11. A computer-readable storage medium, characterized in that, The storage medium includes a stored program that, when the program is executed, controls the device where the storage medium is located to perform the driver file modification method according to any one of claims 1 to 6.
12. An information processing device, characterized in that, The device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the driver file modification method according to any one of claims 1 to 6.