CGMiner hijacking serial ports

12 replies 318 views
the_d3f1Full Member
Posts: 83 · Reputation: 655
#1Sep 24, 2019, 01:29 AM
Anyone know how to stop CGMiner from taking over all the serial ports when it starts up? I need to use /dev/ttyUSB0 and others because they’re tied to terminal outputs in another app. The device I’m working with is an FTDI USB serial converter, and it shares the same VID and PID with the CompacF miner. Once CGMiner runs, it grabs the USB UART devices from /dev/ttyUSB0-4. When I hit U for USB management in CGMiner, I see this 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 can’t seem to disable any of the USB UART devices so other applications can use them. If anyone has any tips, I’d appreciate it. Thanks!
7 Reply Quote Share
hodler2019Legendary
Posts: 2182 · Reputation: 12913
#2Sep 24, 2019, 07:43 AM
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
3 Reply Quote Share
colddiamondHero Member
Posts: 623 · Reputation: 2467
#3Sep 24, 2019, 08:52 AM
This *might* help from https://cgminer.info/documentation/arguments/ (I know it's also from someplace else just can't remember at the moment) If that does not work, can you cgminer as a different user? -Dave
3 Reply Quote Share
the_d3f1Full Member
Posts: 83 · Reputation: 655
#4Sep 24, 2019, 11:09 AM
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.
3 Reply Quote Share
the_d3f1Full Member
Posts: 83 · Reputation: 655
#5Sep 24, 2019, 11:19 AM
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.
1 Reply Quote Share
the_d3f1Full Member
Posts: 83 · Reputation: 655
#6Sep 24, 2019, 02:45 PM
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.
1 Reply Quote Share
darkguruHero Member
Posts: 849 · Reputation: 4147
#7Sep 24, 2019, 03:56 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 that may good for your needs. Oh course Kano hangs out there as well since he did the driver for the Compac F.
0 Reply Quote Share
the_d3f1Full Member
Posts: 83 · Reputation: 655
#8Sep 24, 2019, 09:27 PM
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.
3 Reply Quote Share
the_d3f1Full Member
Posts: 83 · Reputation: 655
#9Sep 25, 2019, 01:26 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 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.
6 Reply Quote Share
colddiamondHero Member
Posts: 623 · Reputation: 2467
#10Sep 25, 2019, 05:46 AM
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
3 Reply Quote Share
the_d3f1Full Member
Posts: 83 · Reputation: 655
#11Sep 25, 2019, 07:44 PM
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:- I guess to something like this(updated):- 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
3 Reply Quote Share
the_d3f1Full Member
Posts: 83 · Reputation: 655
#12Sep 25, 2019, 09:04 PM
I updated the code to show unused devices as well... Ouput as follows:- Updated code:-
0 Reply Quote Share
the_d3f1Full Member
Posts: 83 · Reputation: 655
#13Sep 26, 2019, 01:46 AM
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
4 Reply Quote Share

Related topics