Bitcoin Forum
July 22, 2018, 03:52:41 AM *
News: Latest stable version of Bitcoin Core: 0.16.1  [Torrent]. (New!)
 
   Home   Help Search Donate Login Register  
Pages: « 1 ... 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 [280] 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 ... 847 »
  Print  
Author Topic: OFFICIAL CGMINER mining software thread for linux/win/osx/mips/arm/r-pi 4.10.0  (Read 5756986 times)
This is a self-moderated topic. If you do not want to be moderated by the person who started this topic, create a new topic.
P_Shep
Legendary
*
Offline Offline

Activity: 1176
Merit: 1000


View Profile
May 24, 2012, 06:24:40 AM
 #5581

Code:
bool hex2bin(unsigned char *p, const char *hexstr, size_t len)
{
while (*hexstr && len) {
char hex_byte[3];
unsigned int v;

if (!hexstr[1]) {
applog(LOG_ERR, "hex2bin str truncated");
return false;
}

hex_byte[0] = hexstr[0];
hex_byte[1] = hexstr[1];
hex_byte[2] = 0;

if (sscanf(hex_byte, "%x", &v) != 1) {
applog(LOG_ERR, "hex2bin sscanf '%s' failed", hex_byte);
return false;
}

*p = (unsigned char) v;

p++;
hexstr += 2;
len--;
}

return (len == 0 && *hexstr == 0) ? true : false;
}

Should the return value not be || rather than &&?
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1532231561
Hero Member
*
Offline Offline

Posts: 1532231561

View Profile Personal Message (Offline)

Ignore
1532231561
Reply with quote  #2

1532231561
Report to moderator
af_newbie
Legendary
*
Offline Offline

Activity: 1414
Merit: 1039



View Profile
May 24, 2012, 01:48:48 PM
 #5582

Code:
bool hex2bin(unsigned char *p, const char *hexstr, size_t len)
...
return (len == 0 && *hexstr == 0) ? true : false;
}

Should the return value not be || rather than &&?

I think the code is correct.  It also checks input parameters.

If size of buffer (p) is too small for a given hex str,the caller would know that something is wrong.
If the hexStr is truncated to size less than buffer (p) length, the caller would know.

For example: if hexStr points to 32 hex numbers, but the size of buffer pointed by p is 64, the function would return false.
If you had || instead of &&, the function would return true and the caller would assume that there are 64 valid (0-255) bytes.

If you had a prototype:

bool hex2bin(unsigned char *buf, int bufSize, const char *hexstr, int * outlen)

it would allow callers to check the size of the converted binary buffer.

cengique
Member
**
Offline Offline

Activity: 63
Merit: 10


View Profile
May 24, 2012, 02:17:32 PM
 #5583

...
I did the sudo aticonfig -f --adapter=all --initial and rebooted, I also deleted the .bin file in cgminer's directory.

CGminer gave an error about the number of devices not matching. It saw three devices, but OpenCL was only seeing one?
...
opencl has nothing to do with xorg I'm afraid, but what you need before starting cgminer is:
Code:
export DISPLAY=:0


I'm not running as root. DISPLAY is already set. And I'm not using SSH, I'm on the local console.

I just suffered from the same problem. If your DISPLAY is set to ":0.0", clinfo only finds one card!!! This is dumb.

You can correct it by setting it to ":0" as suggested above.

I found the solution haphazardly from here: http://devgurus.amd.com/thread/140667
crazyates
Legendary
*
Offline Offline

Activity: 952
Merit: 1000



View Profile
May 24, 2012, 02:25:41 PM
 #5584

...
I did the sudo aticonfig -f --adapter=all --initial and rebooted, I also deleted the .bin file in cgminer's directory.

CGminer gave an error about the number of devices not matching. It saw three devices, but OpenCL was only seeing one?
...
opencl has nothing to do with xorg I'm afraid, but what you need before starting cgminer is:
Code:
export DISPLAY=:0


I'm not running as root. DISPLAY is already set. And I'm not using SSH, I'm on the local console.

I just suffered from the same problem. If your DISPLAY is set to ":0.0", clinfo only finds one card!!! This is dumb.

You can correct it by setting it to ":0" as suggested above.

I found the solution haphazardly from here: http://devgurus.amd.com/thread/140667

It's not dumb - it's the way Xorg works. Before I was using CGMiner, I had 3 instances of phoenix on :0.0 :0.1 and :0.2 . That's how you specify cards.

Tips? 1crazy8pMqgwJ7tX7ZPZmyPwFbc6xZKM9
Previous Trade History - Sale Thread
P_Shep
Legendary
*
Offline Offline

Activity: 1176
Merit: 1000


View Profile
May 24, 2012, 03:24:38 PM
 #5585

Code:
bool hex2bin(unsigned char *p, const char *hexstr, size_t len)
...
return (len == 0 && *hexstr == 0) ? true : false;
}

Should the return value not be || rather than &&?

I think the code is correct.  It also checks input parameters.

If size of buffer (p) is too small for a given hex str,the caller would know that something is wrong.
If the hexStr is truncated to size less than buffer (p) length, the caller would know.

For example: if hexStr points to 32 hex numbers, but the size of buffer pointed by p is 64, the function would return false.
If you had || instead of &&, the function would return true and the caller would assume that there are 64 valid (0-255) bytes.

If you had a prototype:

bool hex2bin(unsigned char *buf, int bufSize, const char *hexstr, int * outlen)

it would allow callers to check the size of the converted binary buffer.



Thing is, the BFL uses hex2bin the other way round: the string is longer than p. The BFL returns a string of nonces, hex2bin is used to extract these nonces. There's no null terminator on each nonce, so hex2bin is returning an error, even though everything is fine.
af_newbie
Legendary
*
Offline Offline

Activity: 1414
Merit: 1039



View Profile
May 24, 2012, 04:02:19 PM
 #5586

Code:
bool hex2bin(unsigned char *p, const char *hexstr, size_t len)
...
return (len == 0 && *hexstr == 0) ? true : false;
}

Should the return value not be || rather than &&?

I think the code is correct.  It also checks input parameters.

If size of buffer (p) is too small for a given hex str,the caller would know that something is wrong.
If the hexStr is truncated to size less than buffer (p) length, the caller would know.

For example: if hexStr points to 32 hex numbers, but the size of buffer pointed by p is 64, the function would return false.
If you had || instead of &&, the function would return true and the caller would assume that there are 64 valid (0-255) bytes.

If you had a prototype:

bool hex2bin(unsigned char *buf, int bufSize, const char *hexstr, int * outlen)

it would allow callers to check the size of the converted binary buffer.



Thing is, the BFL uses hex2bin the other way round: the string is longer than p. The BFL returns a string of nonces, hex2bin is used to extract these nonces. There's no null terminator on each nonce, so hex2bin is returning an error, even though everything is fine.

Not sure which version of driver-bitforce.c you are looking at but 2.4.1 does not check return code from hex2bin().  Sure, terminating after first 4 hex numbers would be better for BFL and Icarus, but jobj_binary()/work_decode() also uses this and checks the return code.  
P_Shep
Legendary
*
Offline Offline

Activity: 1176
Merit: 1000


View Profile
May 24, 2012, 04:28:24 PM
 #5587


Not sure which version of driver-bitforce.c you are looking at but 2.4.1 does not check return code from hex2bin().  Sure, terminating after first 4 hex numbers would be better for BFL and Icarus, but jobj_binary()/work_decode() also uses this and checks the return code. 


I'm bug chasing, so I edited the code to use the return value.
af_newbie
Legendary
*
Offline Offline

Activity: 1414
Merit: 1039



View Profile
May 24, 2012, 04:32:24 PM
 #5588


Not sure which version of driver-bitforce.c you are looking at but 2.4.1 does not check return code from hex2bin().  Sure, terminating after first 4 hex numbers would be better for BFL and Icarus, but jobj_binary()/work_decode() also uses this and checks the return code. 


I'm bug chasing, so I edited the code to use the return value.
P_Shep, I think the code is ok as is.  It actually terminates after 4 hex numbers are converted (len =0)
P_Shep
Legendary
*
Offline Offline

Activity: 1176
Merit: 1000


View Profile
May 24, 2012, 04:44:30 PM
 #5589

I don't know, I think success should return success, and failure should return failure.
In this case, it terminates a successful conversion with failure.

Also, I changed it in my code to || last night... still working fine for me Smiley
wogaut
Donator
Sr. Member
*
Offline Offline

Activity: 448
Merit: 250



View Profile
May 24, 2012, 04:50:06 PM
 #5590

I'm reposting this from this newbie thread (since I think here's a better place for it:
Re: Running an FPGA on Raspberry Pi, possible?

OK, here's how far I got installing cgminer on my Raspberry Pi:
Code:
sudo apt-get update
sudo apt-get install autoconf
sudo apt-get install libtool
sudo apt-get install libncurses-dev
sudo apt-get install yasm
sudo apt-get install curl
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install pkg-config
Download zip archive from https://github.com/ckolivas/cgminer
Code:
unzip ckolivas-cgminer-v2.4.1-9-gb69d735.zip
cd ckolivas-cgminer-b69d735/
./autogen.sh
./configure --enable-bitforce
configure then quits after a while with the following errors:
Code:
./configure: line 9269: syntax error near unexpected token `PKG_CHECK_MODULES'
./configure: line 9269: `PKG_CHECK_MODULES(LIBCURL, libcurl >= 7.15.6, AC_DEFINE([CURL_HAS_SOCKOPT], [1], [Defined if version of curl supports sockopts.]),'

Doing a
Code:
curl-config --version
results in
Code:
libcurl 7.21.0
so the libcurl version should work.

Does anybody have an idea what the issue might be?



Inaba
Legendary
*
Offline Offline

Activity: 1260
Merit: 1000



View Profile WWW
May 24, 2012, 04:51:47 PM
 #5591

got libcurl-dev installed?

If you're searching these lines for a point, you've probably missed it.  There was never anything there in the first place.
P_Shep
Legendary
*
Offline Offline

Activity: 1176
Merit: 1000


View Profile
May 24, 2012, 04:54:01 PM
 #5592


Does anybody have an idea what the issue might be?


to get it working in openwrt, i had to manually specify the location of the lib.

LIBCURL_CFLAGS=-L/path/to/lib LIBCURL_LIBS=-lcurl
wogaut
Donator
Sr. Member
*
Offline Offline

Activity: 448
Merit: 250



View Profile
May 24, 2012, 05:40:55 PM
 #5593


Does anybody have an idea what the issue might be?


to get it working in openwrt, i had to manually specify the location of the lib.

LIBCURL_CFLAGS=-L/path/to/lib LIBCURL_LIBS=-lcurl


Good catch, but after defining these variables myself ./configure works
Code:
LIBCURL_CFLAGS='-I/usr/include/curl'
LIBCURL_LIBS='-L/usr/lib -lcurl'
and having a closer look at the error, it appears to me that it doesn't like the syntax of PKG_CHECK_MODULES.
Commenting out these two lines unfortunately leads to an undefined variable ACEOF which causes more issues.
Did you have these issues too?


Scratch that, I had to run aclocal before ./autogen.sh



P_Shep
Legendary
*
Offline Offline

Activity: 1176
Merit: 1000


View Profile
May 24, 2012, 06:00:46 PM
 #5594

Great! Smiley
crazyates
Legendary
*
Offline Offline

Activity: 952
Merit: 1000



View Profile
May 24, 2012, 09:34:44 PM
 #5595

Question: If I upgrade one of my 58XX cards to a 79XX card, and consequently upgrade my SDK from 2.5 to 2.6, I can still use the phatk .bin from 2.5 on the 5870, correct?

2.6 will be installed, but I'd be using a phatk.bin from 2.5 on my 5870, and a diakgcn.bin from 2.6 on the 79XX for the best speed, correct?

Now how do I keep those .bins in use in future versions of CGMiner? (I do keep backups of my known good working bins in a separate folder)

Tips? 1crazy8pMqgwJ7tX7ZPZmyPwFbc6xZKM9
Previous Trade History - Sale Thread
bulanula
Hero Member
*****
Offline Offline

Activity: 518
Merit: 500



View Profile
May 25, 2012, 03:15:23 PM
 #5596

They will only clock back up if the temperature drops enough again.

How long will this take ? I left them about 15 minutes after the heat stopped and the cold begun and they did not clock back automatically ( I had to do it manually ).

Thanks !
wogaut
Donator
Sr. Member
*
Offline Offline

Activity: 448
Merit: 250



View Profile
May 25, 2012, 06:39:58 PM
 #5597

I've been trying to run cgminer with remoting into my Raspberry Pi via ssh.
I tried no use nohup to avoid for cgminer to receive a SIGHUP when I leave ssh, but whenever the input is redirected no /dev/null (what nohup does), cgminer maxes out the CPU usage. Bad thing on the RPi.

How can I get around this?


P_Shep
Legendary
*
Offline Offline

Activity: 1176
Merit: 1000


View Profile
May 25, 2012, 06:50:32 PM
 #5598

Use screen instead?

Look at the scripts in my dd-wrt implementation in my sig. may help you.
wogaut
Donator
Sr. Member
*
Offline Offline

Activity: 448
Merit: 250



View Profile
May 25, 2012, 07:10:14 PM
 #5599

Use screen instead?

Look at the scripts in my dd-wrt implementation in my sig. may help you.

Ah, the S99cgminer script I presume.  I'll try the screen command. 

Thanks!

P_Shep
Legendary
*
Offline Offline

Activity: 1176
Merit: 1000


View Profile
May 25, 2012, 07:16:56 PM
 #5600

There's an updated to that script I've not added yet:

For the kill commands, change them to the following:

Code:
Killall -s SIGINT cgminer
sleep 1
Killall screen
Pages: « 1 ... 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 [280] 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 ... 847 »
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!