Title: CGMiner stealing serial ports Post by: Nexus9090 on April 18, 2024, 12:10:37 PM Does anyone know how to prevent CGMiner from stealing all of the serial ports when it runs?
I need to access /dev/ttyUSB0 etc as it is being used for terminal outputs in another application, this device is an FTDI USB serial converter and has the same VID and PID as the CompacF miner When CGMiner is started it also claims the USB UART devices attached to /dev/ttyUSB0-4 If I press U for USB management in CGminer I get the following output:- Bus 1 Device 7 ID: 0403:6015 FTDI FT231X USB UART inactive Bus 1 Device 10 ID: 0403:6015 FTDI FT231X USB UART inactive Bus 1 Device 13 ID: 0403:6015 FTDI FT231X USB UART inactive Bus 1 Device 15 ID: 0403:6015 FTDI FT231X USB UART inactive Bus 1 Device 14 ID: 0403:6015 GekkoScience CompacF Bitcoin Miner active Bus 1 Device 11 ID: 0403:6015 GekkoScience CompacF Bitcoin Miner active Bus 1 Device 8 ID: 0403:6015 GekkoScience CompacF Bitcoin Miner active Bus 1 Device 5 ID: 0403:6015 GekkoScience CompacF Bitcoin Miner active But I cannot disable any of the USB UART devices so they can be used by other applications. If anyone can offer some advice it would be appreciated, thanks in advance. G. Title: Re: CGMiner stealing serial ports Post by: philipma1957 on April 18, 2024, 12:58:30 PM try doing the other application first .
get it running. then try to start cgminer and add the usb sticks Since the other app is in operation it may keep working and maybe cgminer will start and skip the occupied After closely reading what you wrote it looks as if you already had the first devices up and running and cgminer grabbed them and terminated the other app? Is this what is happening? 1) None cgminer app working 2) Cgminer app offline all good 3) put cgminer app online it works but kills the none cgminer app Title: Re: CGMiner stealing serial ports Post by: DaveF on April 18, 2024, 01:12:44 PM This *might* help from https://cgminer.info/documentation/arguments/
(I know it's also from someplace else just can't remember at the moment) Quote The –usb option can restrict how many USB devices are found: –usb 1:2,1:3,1:4,1:* or –usb BAS:1,BFL:1,MMQ:0,ICA:0,KLN:0 or –usb :10 You can only use one of the above 3 The first version –usb 1:2,1:3,1:4,1:* allows you to select which devices to mine on with a list of USB bus_number:device_address All other USB devices will be ignored Hotplug will also only look at the devices matching the list specified and find nothing new if they are all in use You can specify just the USB bus_number to find all devices like 1:* which means any devices on USB bus_number 1 This is useful if you unplug a device then plug it back in the same port, it usually reappears with the same bus_number but a different device_address You can see the list of all USB devices on linux with ‘sudo lsusb’ Cgminer will list the recognised USB devices with the ‘-n’ option or the ‘–usb-dump 0’ option The ‘–usb-dump N’ option with a value of N greater than 0 will dump a lot of details about each recognised USB device If you wish to see all USB devices, include the –usb-list-all option The second version –usb BAS:1,BFL:1,MMQ:0,ICA:0,KLN:0 allows you to specify how many devices to choose based on each device driver cgminer has - the current USB drivers are: AVA, BAS, BFL, BF1, DRB, HFA, ICA, KLN and MMQ. N.B. you can only specify which device driver to limit, not the type of each device, e.g. with BAS:n you can limit how many BFL ASIC devices will be checked, but you cannot limit the number of each type of BFL ASIC Also note that the MMQ count is the number of MMQ backplanes you have not the number of MMQ FPGAs The third version –usb :10 means only use a maximum of 10 devices of any supported USB devices Once cgminer has 10 devices it will not configure any more and hotplug will not scan for any more If one of the 10 devices stops working, hotplug - if enabled, as is default will scan normally again until it has 10 devices –usb :0 will disable all USB I/O other than to initialise libusb If that does not work, can you cgminer as a different user? -Dave Title: Re: CGMiner stealing serial ports Post by: Nexus9090 on April 18, 2024, 01:14:18 PM try doing the other application first . get it running. then try to start cgminer and add the usb sticks Since the other app is in operation it may keep working and maybe cgminer will start and skip the occupied After closely reading what you wrote it looks as if you already had the first devices up and running and cgminer grabbed them and terminated the other app? Is this what is happening? 1) None cgminer app working 2) Cgminer app offline all good 3) put cgminer app online it works but kills the none cgminer app Thanks for your help. Yes I tried that and yes it forces the all the other serial applications to quit (your note 3). CGMiner runs fine once its started I don't have an issue there, but it steals the other ports irrespecive of what applicaiton I have tied to them. They work fine without CGMiner running. It's a little frustrating. Title: Re: CGMiner stealing serial ports Post by: Nexus9090 on April 18, 2024, 01:16:56 PM This *might* help from https://cgminer.info/documentation/arguments/ (I know it's also from someplace else just can't remember at the moment) Quote The –usb option can restrict how many USB devices are found: –usb 1:2,1:3,1:4,1:* or –usb BAS:1,BFL:1,MMQ:0,ICA:0,KLN:0 or –usb :10 You can only use one of the above 3 The first version –usb 1:2,1:3,1:4,1:* allows you to select which devices to mine on with a list of USB bus_number:device_address All other USB devices will be ignored Hotplug will also only look at the devices matching the list specified and find nothing new if they are all in use You can specify just the USB bus_number to find all devices like 1:* which means any devices on USB bus_number 1 This is useful if you unplug a device then plug it back in the same port, it usually reappears with the same bus_number but a different device_address You can see the list of all USB devices on linux with ‘sudo lsusb’ Cgminer will list the recognised USB devices with the ‘-n’ option or the ‘–usb-dump 0’ option The ‘–usb-dump N’ option with a value of N greater than 0 will dump a lot of details about each recognised USB device If you wish to see all USB devices, include the –usb-list-all option The second version –usb BAS:1,BFL:1,MMQ:0,ICA:0,KLN:0 allows you to specify how many devices to choose based on each device driver cgminer has - the current USB drivers are: AVA, BAS, BFL, BF1, DRB, HFA, ICA, KLN and MMQ. N.B. you can only specify which device driver to limit, not the type of each device, e.g. with BAS:n you can limit how many BFL ASIC devices will be checked, but you cannot limit the number of each type of BFL ASIC Also note that the MMQ count is the number of MMQ backplanes you have not the number of MMQ FPGAs The third version –usb :10 means only use a maximum of 10 devices of any supported USB devices Once cgminer has 10 devices it will not configure any more and hotplug will not scan for any more If one of the 10 devices stops working, hotplug - if enabled, as is default will scan normally again until it has 10 devices –usb :0 will disable all USB I/O other than to initialise libusb If that does not work, can you cgminer as a different user? -Dave Hi Dave, Thanks for this information. I'll give it a go in a while and let you know how things work out. That sounds like it may be the answer, I'll give it a try. Thank you. Title: Re: CGMiner stealing serial ports Post by: Nexus9090 on April 18, 2024, 02:07:37 PM This *might* help from https://cgminer.info/documentation/arguments/ *SNIP -Dave Dave, Thats perfect. Once I'd worked out what ports the miners were attached to using the switch --usb 1:11,1:8,1:5,1:14 allows it to run without taking the other serial ports. I've no doubt if things move around I'll have to find which ports are which again but its a start. Thank you for your help. ;D Title: Re: CGMiner stealing serial ports Post by: NotFuzzyWarm on April 18, 2024, 07:14:58 PM Glad you got a solution to your issue.
Since you mentioned running a Compac-F I take it you are running Kano's latest version of cgminer? If not link to it is in my sig. I should add that Sidehack has a new Smart Hub (https://bitcointalk.org/index.php?topic=5476566.0) that may good for your needs. Oh course Kano hangs out there as well since he did the driver for the Compac F. Title: Re: CGMiner stealing serial ports Post by: Nexus9090 on April 18, 2024, 10:27:12 PM Glad you got a solution to your issue. Since you mentioned running a Compac-F I take it you are running Kano's latest version of cgminer? If not link to it is in my sig. I should add that Sidehack has a new Smart Hub (https://bitcointalk.org/index.php?topic=5476566.0) that may good for your needs. Oh course Kano hangs out there as well since he did the driver for the Compac F. Thanks, I'm running Kano's 4.12.1 it works well. been using it for a while now. Just run into this little snag with the serial ports, but all solved now Thanks for your help. Title: Re: CGMiner stealing serial ports Post by: Nexus9090 on April 19, 2024, 11:09:43 AM For anyone thats interested, I cobbled together this shell script based on usb-list
it scans for usb devices and compiles a list of available ports matching the product id then launches cgminer with the explicit list of usb devices --usb 1:1,1:2,1:3 Code: #!/bin/sh copy the code to your local cgminer directory as cgstart.sh chmod +x cgstart.sh then run it sudo ./cgstart.sh I'm no expert at shell scripts, but this seems to work in my environment. Obviously this doesnt take into account any cgminer.conf files, so if your set-up uses that then i'm not sure if the --usb switch will be passed on.' modify adapt and use as you see fit. No warranty expressed or implied, provided as-is, use at your own risk. Title: Re: CGMiner stealing serial ports Post by: DaveF on April 19, 2024, 11:52:27 AM For anyone thats interested, I cobbled together this shell script based on usb-list it scans for usb devices and compiles a list of available ports matching the product id then launches cgminer with the explicit list of usb devices --usb 1:1,1:2,1:3 Code: #!/bin/sh copy the code to your local cgminer directory as cgstart.sh chmod +x cgstart.sh then run it sudo ./cgstart.sh I'm no expert at shell scripts, but this seems to work in my environment. Obviously this doesnt take into account any cgminer.conf files, so if your set-up uses that then i'm not sure if the --usb switch will be passed on.' modify adapt and use as you see fit. No warranty expressed or implied, provided as-is, use at your own risk. Good script, will probably save a bunch of people setting up USB sticks / pods some time. A couple of thoughts. 1) I would make the sleep longer since cgminer does clear the screen when it starts so 5 seconds may not be enough. Or a press any key to continue thing. 2) People are more and more using different USB miners at the same time, would there be a way to loop it to add more devices? 3) [more like 2a] A list of devices that will NOT be included might help users with other debugging. This is how software becomes bloat. A programmer comes up with a good thing and users keep throwing in more things. :-) -Dave Title: Re: CGMiner stealing serial ports Post by: Nexus9090 on April 19, 2024, 12:05:44 PM Good script, will probably save a bunch of people setting up USB sticks / pods some time. A couple of thoughts. 1) I would make the sleep longer since cgminer does clear the screen when it starts so 5 seconds may not be enough. Or a press any key to continue thing. 2) People are more and more using different USB miners at the same time, would there be a way to loop it to add more devices? 3) [more like 2a] A list of devices that will NOT be included might help users with other debugging. This is how software becomes bloat. A programmer comes up with a good thing and users keep throwing in more things. :-) -Dave Hi Dave, Thanks, initially I had the sleep period set for 15 seconds, just while I was debugging it. Its easy enough to change. The script loops through all available USB devices, so if a new one was added it would show up in the list automatically once the script is run. To include another type of device, provided you know what the product id string is, that could be added or modified in the section:- Code:
I guess to something like this(updated):- Code:
I excluded not used devices simply because they were of no interest to CGMiner, but again it could be added if necessary just as an output. Thanks Garry Title: Re: CGMiner stealing serial ports Post by: Nexus9090 on April 19, 2024, 12:29:01 PM Good script, will probably save a bunch of people setting up USB sticks / pods some time. A couple of thoughts. 1) I would make the sleep longer since cgminer does clear the screen when it starts so 5 seconds may not be enough. Or a press any key to continue thing. 2) People are more and more using different USB miners at the same time, would there be a way to loop it to add more devices? 3) [more like 2a] A list of devices that will NOT be included might help users with other debugging. This is how software becomes bloat. A programmer comes up with a good thing and users keep throwing in more things. :-) -Dave I updated the code to show unused devices as well... Ouput as follows:- Code: 1:1 - Linux 6.1.21-v8+ dwc_otg_hcd : DWC OTG Controller - Not Used Updated code:- Code: #!/bin/sh Title: Re: CGMiner stealing serial ports Post by: Nexus9090 on April 19, 2024, 12:52:06 PM Just for fun I added an old antminer U2 to it.
It identifies as a CP2102 USB to UART Bridge Controller 1:1 - Linux 6.1.21-v8+ dwc_otg_hcd : DWC OTG Controller - Not Used 1:2 - Linux 6.1.21-v8+ dwc_otg_hcd : DWC OTG Controller - Not Used 1:3 - GekkoScience : CompacF Bitcoin Miner - Added to CGMiner USB list 1:5 - Silicon Labs : CP2102 USB to UART Bridge Controller - Added to CGMiner USB list 1:4 - FTDI : FT231X USB UART - Not Used ********************************** 1:3,1:5, 1:3,1:5 the code edits to include the device look like this Code: if [ "$product" = "CompacF Bitcoin Miner" ] || [ "$product" = "CP2102 USB to UART Bridge Controller" ]; then |