mirror of
				https://review.coreboot.org/flashrom.git
				synced 2025-11-04 07:00:39 +01:00 
			
		
		
		
	serprog: fix missing device parameter error message on Windows
Previously, flashrom -p serprog didnt notice a completely missing dev= string on Windows. Also, the error message shown if no device name followed contained a misleading "/dev/...". Corresponding to flashrom svn r1908. Signed-off-by: Urja Rannikko <urjaman@gmail.com> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
This commit is contained in:
		
				
					committed by
					
						
						Stefan Tauner
					
				
			
			
				
	
			
			
			
						parent
						
							72587f85ec
						
					
				
				
					commit
					27b431bcee
				
			
							
								
								
									
										10
									
								
								serprog.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								serprog.c
									
									
									
									
									
								
							@@ -371,6 +371,8 @@ int serprog_init(void)
 | 
				
			|||||||
			have_device++;
 | 
								have_device++;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if !IS_WINDOWS
 | 
				
			||||||
	if (device && !strlen(device)) {
 | 
						if (device && !strlen(device)) {
 | 
				
			||||||
		msg_perr("Error: No device specified.\n"
 | 
							msg_perr("Error: No device specified.\n"
 | 
				
			||||||
			 "Use flashrom -p serprog:dev=/dev/device[:baud]\n");
 | 
								 "Use flashrom -p serprog:dev=/dev/device[:baud]\n");
 | 
				
			||||||
@@ -379,7 +381,6 @@ int serprog_init(void)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	free(device);
 | 
						free(device);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !IS_WINDOWS
 | 
					 | 
				
			||||||
	device = extract_programmer_param("ip");
 | 
						device = extract_programmer_param("ip");
 | 
				
			||||||
	if (have_device && device) {
 | 
						if (have_device && device) {
 | 
				
			||||||
		msg_perr("Error: Both host and device specified.\n"
 | 
							msg_perr("Error: Both host and device specified.\n"
 | 
				
			||||||
@@ -415,15 +416,20 @@ int serprog_init(void)
 | 
				
			|||||||
		free(device);
 | 
							free(device);
 | 
				
			||||||
		return 1;
 | 
							return 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	free(device);
 | 
						free(device);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!have_device) {
 | 
						if (!have_device) {
 | 
				
			||||||
 | 
					#if IS_WINDOWS
 | 
				
			||||||
 | 
							msg_perr("Error: No device specified.\n"
 | 
				
			||||||
 | 
								 "Use flashrom -p serprog:dev=comN[:baud]\n");
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
		msg_perr("Error: Neither host nor device specified.\n"
 | 
							msg_perr("Error: Neither host nor device specified.\n"
 | 
				
			||||||
			 "Use flashrom -p serprog:dev=/dev/device:baud or "
 | 
								 "Use flashrom -p serprog:dev=/dev/device:baud or "
 | 
				
			||||||
			 "flashrom -p serprog:ip=ipaddr:port\n");
 | 
								 "flashrom -p serprog:ip=ipaddr:port\n");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		return 1;
 | 
							return 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (register_shutdown(serprog_shutdown, NULL))
 | 
						if (register_shutdown(serprog_shutdown, NULL))
 | 
				
			||||||
		return 1;
 | 
							return 1;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user